SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
prep_restart_coupl_topd.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !######
6 SUBROUTINE prep_restart_coupl_topd (UG, U, &
7  hprogram,ki)
8 !###################################################################
9 !
10 !!**** * PREP_RESTART_COUPL_TOPD*
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !! Write all files needed in case of restart of a simulation coupling SURFEX
16 !! and TOPODYN
17 !!
18 !! REFERENCE
19 !! ---------
20 !!
21 !! AUTHOR
22 !! ------
23 !! B. Vincendon
24 !!
25 !! MODIFICATIONS
26 !! -------------
27 !! Original 07/06/11
28 !-------------------------------------------------------------------------------
29 !
30 !* 0. DECLARATIONS
31 ! ------------
32 !
33 !
34 !
36 USE modd_surf_atm_n, ONLY : surf_atm_t
37 !
38 USE modd_topd_par, ONLY : nunit
39 USE modd_topodyn, ONLY : nncat, xqtot, nnb_topd_step,&
40  xqb_run, xqb_dr
41 USE modd_coupling_topd, ONLY : xas_nature,&
42  nnb_stp_restart, xwtopt,&
43  xrun_torout, xdr_torout
44 !
45 !
46 USE modi_get_luout
47 USE modi_open_file
48 USE modi_close_file
49 !
50 USE modi_write_file_map
52 USE modi_write_file_isbamap
53 !
54 USE yomhook ,ONLY : lhook, dr_hook
55 USE parkind1 ,ONLY : jprb
56 !
57 IMPLICIT NONE
58 !
59 !* 0.1 declarations of arguments
60 !
61 !
62 TYPE(surf_atm_grid_t), INTENT(INOUT) :: ug
63 TYPE(surf_atm_t), INTENT(INOUT) :: u
64 !
65  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
66 INTEGER, INTENT(IN) :: ki ! Surfex grid dimension
67 !
68 !* 0.2 declarations of local variables
69 !
70 INTEGER :: iluout ! unit of output listing file
71 INTEGER :: jstp, jj ! loop control indexes
72 REAL, DIMENSION(:),ALLOCATABLE :: zas ! Saturated area fraction for each Isba meshes
73  CHARACTER(LEN=30) :: yvar ! name of results file
74 REAL(KIND=JPRB) :: zhook_handle
75 !-------------------------------------------------------------------------------
76 IF (lhook) CALL dr_hook('PREP_RESTART_COUPL_TOPD',0,zhook_handle)
77 !
78  CALL get_luout(hprogram,iluout)
79 !
80 ! * 1. Write stock files
81 !
82 WRITE(iluout,*) 'Write STOCK file'
83 !
84  CALL open_file('ASCII ',nunit,hfile='stocks_sav.txt',hform='FORMATTED',haction='WRITE')
85 DO jstp = 1,nnb_stp_restart
86  WRITE(nunit,*) xrun_torout(1:nncat,jstp+nnb_topd_step), xdr_torout(1:nncat,jstp+nnb_topd_step)
87 ENDDO
88  CALL close_file('ASCII ',nunit)
89 !
90 ! * 2. Write pixels water content
91 !
92 WRITE(iluout,*) 'Write pixels water content files'
93 !
94 yvar = '_xwtop_sav.map'
95  CALL write_file_map(xwtopt,yvar)
96 !
97 ! * 3. Write Asat files
98 !
99 WRITE(iluout,*) 'Write Asat files'
100 !
101 ALLOCATE(zas(ki))
102  CALL unpack_same_rank(u%NR_NATURE,xas_nature,zas)
103 !
104  CALL open_file('ASCII ',nunit,hfile='surfcont_sav.map',hform='FORMATTED',haction='WRITE')
105  CALL write_file_isbamap(ug, &
106  nunit,zas,ki)
107  CALL close_file('ASCII ',nunit)
108 !
109 IF (lhook) CALL dr_hook('PREP_RESTART_COUPL_TOPD',1,zhook_handle)
110 !-------------------------------------------------------------------------------
111 !
112 END SUBROUTINE prep_restart_coupl_topd
subroutine write_file_isbamap(UG, KUNIT, PVAR, KI)
subroutine prep_restart_coupl_topd(UG, U, HPROGRAM, KI)
subroutine close_file(HPROGRAM, KUNIT)
Definition: close_file.F90:6
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine write_file_map(PVAR, HVAR)
subroutine open_file(HPROGRAM, KUNIT, HFILE, HFORM, HACTION, HACCESS, KRECL)
Definition: open_file.F90:6