SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
write_pgd_surf_atmn.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 write_pgd_surf_atm_n (YSC, &
7  hprogram)
8 ! ####################################
9 !
10 !!**** *WRITE_PGD_SURF_ATM_n* - routine to write pgd surface variables
11 !! in their respective files or in file
12 !!
13 !! PURPOSE
14 !! -------
15 !!
16 !!** METHOD
17 !! ------
18 !!
19 !! EXTERNAL
20 !! --------
21 !!
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !! REFERENCE
27 !! ---------
28 !!
29 !!
30 !! AUTHOR
31 !! ------
32 !! B. Decharme *Meteo France*
33 !!
34 !! MODIFICATIONS
35 !! -------------
36 !! Original 05/2011 according to previous write_surf_atmn.f90
37 !-------------------------------------------------------------------------------
38 !
39 !* 0. DECLARATIONS
40 ! ------------
41 !
42 !
43 USE modd_surfex_n, ONLY : surfex_t
44 !
45 USE modd_surf_conf, ONLY : cprogname
46 USE modd_surf_par, ONLY : nversion, nbugfix
47 USE modd_io_surf_fa, ONLY : lfanocompact
48 !
49 USE modi_init_io_surf_n
51 USE modi_write_pgd_sea_n
52 USE modi_write_pgd_inland_water_n
53 USE modi_write_pgd_nature_n
54 USE modi_write_pgd_town_n
55 USE modi_end_io_surf_n
56 !
57 USE modi_flag_update
58 !
59 USE modi_writesurf_cover_n
60 USE modi_writesurf_sso_n
61 USE modi_writesurf_dummy_n
62 USE modi_writesurf_snap_n
63 USE modi_writesurf_ch_emis_n
64 USE modi_write_grid
65 !
66 USE modi_write_ecoclimap2_data
67 !
68 USE yomhook ,ONLY : lhook, dr_hook
69 USE parkind1 ,ONLY : jprb
70 !
71 IMPLICIT NONE
72 !
73 !* 0.1 Declarations of arguments
74 ! -------------------------
75 !
76 !
77 TYPE(surfex_t), INTENT(INOUT) :: ysc
78 !
79  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
80 !
81 !* 0.2 Declarations of local variables
82 ! -------------------------------
83 !
84  CHARACTER(LEN=3) :: ywrite
85  CHARACTER(LEN=100) :: ycomment
86 INTEGER :: iresp
87 REAL(KIND=JPRB) :: zhook_handle
88 !-------------------------------------------------------------------------------
89 !
90 IF (lhook) CALL dr_hook('WRITE_PGD_SURF_ATM_N',0,zhook_handle)
91 !
92 !* 0. Initialize some options:
93 ! ------------------------
94 !
95  cprogname = hprogram
96 !
97  CALL flag_update(ysc%IM%DGI, ysc%DGU, &
98  .false.,.true.,.false.,.false.)
99 !
100 !* 1. Configuration and cover fields:
101 ! ------------------------------
102 !
103 !
104 ! Initialisation for IO
105 !
106  CALL init_io_surf_n(ysc%DTCO, ysc%DGU, ysc%U, &
107  hprogram,'FULL ','SURF ','WRITE')
108 !
109 ywrite='PGD'
110 ycomment='(-)'
111  CALL write_surf(ysc%DGU, ysc%U, &
112  hprogram,'VERSION',nversion,iresp,ycomment)
113  CALL write_surf(ysc%DGU, ysc%U, &
114  hprogram,'BUG ',nbugfix ,iresp,ycomment)
115  CALL write_surf(ysc%DGU, ysc%U, &
116  hprogram,'STORAGETYPE',ywrite,iresp,ycomment)
117 !
118  CALL write_surf(ysc%DGU, ysc%U, &
119  hprogram,'SEA ',ysc%U%CSEA ,iresp,ycomment)
120  CALL write_surf(ysc%DGU, ysc%U, &
121  hprogram,'WATER ',ysc%U%CWATER ,iresp,ycomment)
122  CALL write_surf(ysc%DGU, ysc%U, &
123  hprogram,'NATURE',ysc%U%CNATURE,iresp,ycomment)
124  CALL write_surf(ysc%DGU, ysc%U, &
125  hprogram,'TOWN ',ysc%U%CTOWN ,iresp,ycomment)
126 !
127  CALL write_surf(ysc%DGU, ysc%U, &
128  hprogram,'DIM_FULL ',ysc%U%NDIM_FULL, iresp,hcomment=ycomment)
129  CALL write_surf(ysc%DGU, ysc%U, &
130  hprogram,'DIM_SEA ',ysc%U%NDIM_SEA, iresp,hcomment=ycomment)
131  CALL write_surf(ysc%DGU, ysc%U, &
132  hprogram,'DIM_NATURE',ysc%U%NDIM_NATURE,iresp,hcomment=ycomment)
133  CALL write_surf(ysc%DGU, ysc%U, &
134  hprogram,'DIM_WATER ',ysc%U%NDIM_WATER, iresp,hcomment=ycomment)
135  CALL write_surf(ysc%DGU, ysc%U, &
136  hprogram,'DIM_TOWN ',ysc%U%NDIM_TOWN, iresp,hcomment=ycomment)
137  CALL write_surf(ysc%DGU, ysc%U, &
138  hprogram,'ECOCLIMAP ',ysc%U%LECOCLIMAP ,iresp,ycomment)
139  CALL write_surf(ysc%DGU, ysc%U, &
140  hprogram,'WATER_TO_NAT',ysc%U%LWATER_TO_NATURE,iresp,ycomment)
141  CALL write_surf(ysc%DGU, ysc%U, &
142  hprogram,'TOWN_TO_ROCK',ysc%U%LTOWN_TO_ROCK,iresp,ycomment)
143  CALL write_surf(ysc%DGU, ysc%U, &
144  hprogram,'GARDEN',ysc%U%LGARDEN,iresp,ycomment)
145 IF (hprogram.NE.'BINARY' .AND. hprogram.NE.'TEXTE ') THEN
146  CALL write_ecoclimap2_data(ysc%DGU, ysc%U, &
147  hprogram)
148 ENDIF
149 !
150  CALL write_grid(ysc%DGU, ysc%U, &
151  hprogram,ysc%UG%CGRID,ysc%UG%XGRID_PAR,ysc%UG%XLAT,ysc%UG%XLON,&
152  ysc%UG%XMESH_SIZE,iresp,ysc%USS%XZ0EFFJPDIR)
153 !
154  CALL writesurf_cover_n(ysc%DGU, &
155  ysc%U, &
156  hprogram)
157  CALL writesurf_sso_n(ysc%DGU, ysc%U, &
158  ysc%USS, &
159  hprogram)
160  CALL writesurf_dummy_n(ysc%DGU, ysc%U, &
161  ysc%DUU, &
162  hprogram)
163 !
164 ycomment='CH_EMIS'
165  CALL write_surf(ysc%DGU, ysc%U, &
166  hprogram,'CH_EMIS',ysc%CHU%LCH_EMIS,iresp,hcomment=ycomment)
167 !
168 IF (ysc%CHU%LCH_EMIS) THEN
169  ycomment='CH_EMIS_OPT'
170  CALL write_surf(ysc%DGU, ysc%U, &
171  hprogram,'CH_EMIS_OPT',ysc%CHU%CCH_EMIS,iresp,hcomment=ycomment)
172 END IF
173 !
174 IF (ysc%CHU%LCH_EMIS) THEN
175  IF (ysc%CHU%CCH_EMIS=='AGGR') THEN
176  CALL writesurf_ch_emis_n(ysc%DGU, ysc%U, &
177  ysc%CHE, &
178  hprogram)
179  ELSE IF (ysc%CHU%CCH_EMIS=='SNAP') THEN
180  CALL writesurf_snap_n(ysc%DGU, ysc%U, &
181  ysc%CHN, &
182  hprogram)
183  ENDIF
184 ENDIF
185 !
186 ! End of IO
187 !
188  CALL end_io_surf_n(hprogram)
189 !
190 !
191 !* 2. Sea
192 ! ---
193 !
194 IF (ysc%U%NDIM_SEA>0) CALL write_pgd_sea_n(ysc%DTCO, ysc%DGU, ysc%U, &
195  ysc%SM%DTS, ysc%SM%SG, ysc%SM%S, &
196  hprogram)
197 !
198 !
199 !* 3. Inland water
200 ! ------------
201 !
202 IF (ysc%U%NDIM_WATER>0) CALL write_pgd_inland_water_n(ysc%DTCO, ysc%DGU, ysc%U, &
203  ysc%WM%WG, ysc%WM%W, ysc%FM%FG, ysc%FM%F, &
204  hprogram)
205 !
206 !
207 !* 4. Vegetation scheme
208 ! -----------------
209 !
210 IF (ysc%U%NDIM_NATURE>0) CALL write_pgd_nature_n(ysc%DTCO, ysc%DGU, ysc%U, &
211  ysc%IM%DTI, ysc%DTZ, ysc%IM%IG, ysc%IM%I, &
212  hprogram)
213 !
214 !
215 !* 5. Urban scheme
216 ! ------------
217 !
218 IF (ysc%U%NDIM_TOWN>0) CALL write_pgd_town_n(ysc%DTCO, ysc%DGU, ysc%U, &
219  ysc%TM, ysc%GDM, ysc%GRM, &
220  hprogram)
221 !
222 !
223 IF (lhook) CALL dr_hook('WRITE_PGD_SURF_ATM_N',1,zhook_handle)
224 !
225 !-------------------------------------------------------------------------------
226 !
227 END SUBROUTINE write_pgd_surf_atm_n
subroutine init_io_surf_n(DTCO, DGU, U, HPROGRAM, HMASK, HSCHEME, HACTION)
subroutine write_pgd_sea_n(DTCO, DGU, U, DTS, SG, S, HPROGRAM)
subroutine writesurf_dummy_n(DGU, U, DUU, HPROGRAM)
subroutine write_grid(DGU, U, HPROGRAM, HGRID, PGRID_PAR, PLAT, PLON, PMESH_SIZE, KRESP, PDIR, HDIR)
Definition: write_grid.F90:6
subroutine write_ecoclimap2_data(DGU, U, HPROGRAM)
subroutine write_pgd_surf_atm_n(YSC, HPROGRAM)
subroutine writesurf_cover_n(DGU, U, HPROGRAM)
subroutine writesurf_ch_emis_n(DGU, U, CHE, HPROGRAM)
subroutine write_pgd_nature_n(DTCO, DGU, U, DTI, DTZ, IG, I, HPROGRAM)
subroutine flag_update(DGI, DGU, ONOWRITE_CANOPY, OPGD, OPROVAR_TO_DIAG, OSELECT)
Definition: flag_update.F90:6
subroutine writesurf_sso_n(DGU, U, USS, HPROGRAM)
subroutine writesurf_snap_n(DGU, U, CHN, HPROGRAM)
subroutine end_io_surf_n(HPROGRAM)
Definition: end_io_surfn.F90:6
subroutine write_pgd_inland_water_n(DTCO, DGU, U, WG, W, FG, F, HPROGRAM)
subroutine write_pgd_town_n(DTCO, DGU, U, TM, GDM, GRM, HPROGRAM)