SURFEX v8.1
General documentation of Surfex
writesurf_pgd_isban.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 writesurf_pgd_isba_n (HSELECT, HNATURE, DTV, DTZ, G, ISS, IO, S, K, HPROGRAM)
7 ! ################################################
8 !
9 !!**** *WRITESURF_PGD_ISBA_n* - writes ISBA physiographic fields
10 !!
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !!** METHOD
16 !! ------
17 !!
18 !! EXTERNAL
19 !! --------
20 !!
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !!
29 !! AUTHOR
30 !! ------
31 !! V. Masson *Meteo France*
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 01/2003
36 !! P. Le Moigne 12/2004 : add type of photosynthesis
37 !! B. Decharme 06/2009 : add topographic index statistics
38 !! A.L. Gibelin 04/2009 : dimension NBIOMASS for ISBA-A-gs
39 !! B. Decharme 07/2011 : delete argument HWRITE
40 !! B. Decharme 07/2012 : files of data for permafrost area and for SOC top and sub soil
41 !! 11/2013 : same for groundwater distribution
42 !! 11/2014 : Write XSOILGRID as a series of real
43 !! P. Samuelsson 10/2014 : MEB
44 !! M. Moge 02/2015 parallelization using WRITE_LCOVER
45 !! 10/2016 B. Decharme : bug surface/groundwater coupling
46 !-------------------------------------------------------------------------------
47 !
48 !* 0. DECLARATIONS
49 ! ------------
50 !
51 #ifdef SFX_OL
52 USE modn_io_offline, ONLY : lwr_vegtype
53 #endif
54 !
55 USE modd_data_isba_n, ONLY : data_isba_t
56 USE modd_data_tsz0_n, ONLY : data_tsz0_t
57 USE modd_sfx_grid_n, ONLY : grid_t
58 USE modd_sso_n, ONLY : sso_t
60 USE modd_isba_n, ONLY : isba_s_t, isba_k_t
61 !
62 USE modd_surf_par, ONLY : xundef
63 USE modd_data_cover_par, ONLY : jpcover
64 !
66 !
68 USE modi_write_grid
69 USE modi_writesurf_pgd_isba_par_n
70 USE modi_writesurf_pgd_tsz0_par_n
71 USE modi_write_lcover
72 !
73 USE yomhook ,ONLY : lhook, dr_hook
74 USE parkind1 ,ONLY : jprb
75 !
76 IMPLICIT NONE
77 !
78 !* 0.1 Declarations of arguments
79 ! -------------------------
80 !
81  CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: HSELECT
82  CHARACTER(LEN=*), INTENT(IN) :: HNATURE
83 !
84 TYPE(data_isba_t), INTENT(INOUT) :: DTV
85 TYPE(data_tsz0_t), INTENT(INOUT) :: DTZ
86 TYPE(grid_t), INTENT(INOUT) :: G
87 TYPE(sso_t), INTENT(INOUT) :: ISS
88 TYPE(isba_options_t), INTENT(INOUT) :: IO
89 TYPE(isba_s_t), INTENT(INOUT) :: S
90 TYPE(isba_k_t), INTENT(INOUT) :: K
91 !
92  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling
93 !
94 !* 0.2 Declarations of local variables
95 ! -------------------------------
96 !
97 INTEGER :: IRESP ! IRESP : return-code if a problem appears
98  CHARACTER(LEN=12) :: YRECFM ! Name of the article to be read
99  CHARACTER(LEN=100):: YCOMMENT ! Comment string
100  CHARACTER(LEN=4 ) :: YLVL
101 !
102 INTEGER :: JJ, JLAYER
103 INTEGER :: ISIZE_LMEB_PATCH ! Number of patches with MEB=true
104 !
105 REAL(KIND=JPRB) :: ZHOOK_HANDLE
106 !
107 !
108 !-------------------------------------------------------------------------------
109 !
110 !
111 !* soil scheme option
112 !
113 IF (lhook) CALL dr_hook('WRITESURF_PGD_ISBA_N',0,zhook_handle)
114 yrecfm='ISBA'
115 ycomment=yrecfm
116  CALL write_surf(hselect, hprogram,yrecfm,io%CISBA,iresp,hcomment=ycomment)
117 !
118 !* Pedo-transfert function
119 !
120 yrecfm='PEDOTF'
121 ycomment=yrecfm
122  CALL write_surf(hselect, hprogram,yrecfm,io%CPEDOTF,iresp,hcomment=ycomment)
123 !
124 !* type of photosynthesis
125 !
126 yrecfm='PHOTO'
127 ycomment=yrecfm
128  CALL write_surf(hselect, hprogram,yrecfm,io%CPHOTO,iresp,hcomment=ycomment)
129 !
130 !* new radiative transfert
131 !
132 yrecfm='TR_ML'
133 ycomment=yrecfm
134  CALL write_surf(hselect, hprogram,yrecfm,io%LTR_ML,iresp,hcomment=ycomment)
135 !
136 !* calbedo
137 !
138 yrecfm='ALBEDO'
139 ycomment=yrecfm
140  CALL write_surf(hselect, hprogram,yrecfm,io%CALBEDO,iresp,hcomment=ycomment)
141 !
142 !* threshold to remove little fractions of patches
143 !
144 yrecfm='RM_PATCH'
145 ycomment=yrecfm
146  CALL write_surf(hselect, hprogram,yrecfm,io%XRM_PATCH,iresp,hcomment=ycomment)
147 
148 !* number of soil layers
149 !
150 yrecfm='GROUND_LAYER'
151 ycomment=yrecfm
152  CALL write_surf(hselect, hprogram,yrecfm,io%NGROUND_LAYER,iresp,hcomment=ycomment)
153 !
154 !* Reference grid for DIF
155 !
156 IF(io%CISBA=='DIF') THEN
157  DO jlayer=1,io%NGROUND_LAYER
158  WRITE(ylvl,'(I4)') jlayer
159  yrecfm='SOILGRID'//adjustl(ylvl(:len_trim(ylvl)))
160  ycomment='Depth of ISBA soilgrid layer '//adjustl(ylvl(:len_trim(ylvl)))
161  CALL write_surf(hselect, hprogram,yrecfm,io%XSOILGRID(jlayer),iresp,hcomment=ycomment)
162  END DO
163 ENDIF
164 !
165 !* number of biomass pools
166 !
167 yrecfm='NBIOMASS'
168 ycomment=yrecfm
169  CALL write_surf(hselect, hprogram,yrecfm,io%NNBIOMASS,iresp,hcomment=ycomment)
170 !
171 !* number of tiles
172 !
173 yrecfm='PATCH_NUMBER'
174 ycomment=yrecfm
175  CALL write_surf(hselect, hprogram,yrecfm,io%NPATCH,iresp,hcomment=ycomment)
176 !
177 !* flag indicating if fields are computed from ecoclimap or not
178 !
179 yrecfm='ECOCLIMAP'
180 ycomment=yrecfm
181  CALL write_surf(hselect, hprogram,yrecfm,io%LECOCLIMAP,iresp,hcomment=ycomment)
182 !
183 !* logical vector indicating for which patches MEB should be applied
184 !
185 yrecfm='MEB_PATCH'
186 ycomment='(LOGICAL LIST)'
187  CALL write_surf(hselect, hprogram,yrecfm,io%LMEB_PATCH(:),iresp,hcomment=ycomment,hdir='-')
188 !
189 isize_lmeb_patch = count(io%LMEB_PATCH(:))
190 !
191 IF (isize_lmeb_patch>0)THEN
192 !
193 !* flag indicating if forcing is from observed measurements or not
194 !
195  yrecfm='FORC_MEASURE'
196  ycomment=yrecfm
197  CALL write_surf(hselect, hprogram,yrecfm,io%LFORC_MEASURE,iresp,hcomment=ycomment)
198 !
199 !* flag indicating if litter layer is used or not
200 !
201  yrecfm='MEB_LITTER'
202  ycomment=yrecfm
203  CALL write_surf(hselect, hprogram,yrecfm,io%LMEB_LITTER,iresp,hcomment=ycomment)
204 !
205 !* flag indicating if ground resistance is used or not
206 !
207  yrecfm='MEB_GNDRES'
208  ycomment=yrecfm
209  CALL write_surf(hselect, hprogram,yrecfm,io%LMEB_GNDRES,iresp,hcomment=ycomment)
210 !
211 ENDIF
212 !
213 !* 2. Physiographic data fields:
214 ! -------------------------
215 !
216 !* cover classes
217 !
218  CALL write_lcover(hselect,hprogram,s%LCOVER)
219 !
220 #ifdef SFX_OL
221 IF (lwr_vegtype) THEN
222  yrecfm='VEGTYPE'
223  ycomment='(X_Y_VEGTYPE)'
224  CALL write_surf(hselect, hprogram,yrecfm,k%XVEGTYPE,iresp,hcomment=ycomment)
225 ENDIF
226 #endif
227 !
228 !* orography
229 !
230 yrecfm='ZS'
231 ycomment='ZS'
232  CALL write_surf(hselect, hprogram,yrecfm,s%XZS(:),iresp,hcomment=ycomment)
233 !
234 !* latitude, longitude
235 !
236  CALL write_grid(hselect, hprogram,g%CGRID,g%XGRID_PAR,g%XLAT,g%XLON,g%XMESH_SIZE,iresp)
237 !
238 !
239 !* clay fraction
240 !
241 !
242 yrecfm='CLAY'
243 ycomment='X_Y_CLAY'
244  CALL write_surf(hselect, hprogram,yrecfm,k%XCLAY(:,1),iresp,hcomment=ycomment)
245 !
246 !* sand fraction
247 !
248 yrecfm='SAND'
249 ycomment='X_Y_SAND'
250  CALL write_surf(hselect, hprogram,yrecfm,k%XSAND(:,1),iresp,hcomment=ycomment)
251 !
252 !* soil organic carbon
253 !
254 yrecfm='SOCP'
255 ycomment=''
256  CALL write_surf(hselect, hprogram,yrecfm,io%LSOCP,iresp,hcomment=ycomment)
257 !
258 IF(io%LSOCP)THEN
259  !
260  ycomment='X_Y_SOC'
261  yrecfm='SOC_TOP'
262  CALL write_surf(hselect, hprogram,yrecfm,s%XSOC(:,1),iresp,hcomment=ycomment)
263  yrecfm='SOC_SUB'
264  CALL write_surf(hselect, hprogram,yrecfm,s%XSOC(:,2),iresp,hcomment=ycomment)
265  !
266 ENDIF
267 !
268 !* permafrost distribution
269 !
270 yrecfm='PERMAFROST'
271 ycomment=''
272  CALL write_surf(hselect, hprogram,yrecfm,io%LPERM,iresp,hcomment=ycomment)
273 !
274 IF(io%LPERM)THEN
275  ycomment='X_Y_PERM'
276  yrecfm='PERM'
277  CALL write_surf(hselect, hprogram,yrecfm,k%XPERM(:),iresp,hcomment=ycomment)
278 ENDIF
279 !
280 !SOILNOX
281 !
282 yrecfm='NO'
283 ycomment=''
284  CALL write_surf(hselect, hprogram,yrecfm,io%LNOF,iresp,hcomment=ycomment)
285 !
286 IF (io%LNOF) THEN
287  !
288  yrecfm='PH'
289  ycomment='X_Y_PH'
290  CALL write_surf(hselect, hprogram,yrecfm,s%XPH(:),iresp,hcomment=ycomment)
291  !
292  yrecfm='FERT'
293  ycomment='X_Y_FERT'
294  CALL write_surf(hselect, hprogram,yrecfm,s%XFERT(:),iresp,hcomment=ycomment)
295  !
296 ENDIF
297 !
298 !* subgrid-scale orography parameters to compute dynamical roughness length
299 !
300 yrecfm='AOSIP'
301 ycomment='X_Y_AOSIP'
302  CALL write_surf(hselect, hprogram,yrecfm,iss%XAOSIP,iresp,hcomment=ycomment)
303 !
304 yrecfm='AOSIM'
305 ycomment='X_Y_AOSIM'
306  CALL write_surf(hselect, hprogram,yrecfm,iss%XAOSIM,iresp,hcomment=ycomment)
307 !
308 yrecfm='AOSJP'
309 ycomment='X_Y_AOSJP'
310  CALL write_surf(hselect, hprogram,yrecfm,iss%XAOSJP,iresp,hcomment=ycomment)
311 !
312 yrecfm='AOSJM'
313 ycomment='X_Y_AOSJM'
314  CALL write_surf(hselect, hprogram,yrecfm,iss%XAOSJM,iresp,hcomment=ycomment)
315 !
316 yrecfm='HO2IP'
317 ycomment='X_Y_HO2IP'
318  CALL write_surf(hselect, hprogram,yrecfm,iss%XHO2IP,iresp,hcomment=ycomment)
319 !
320 yrecfm='HO2IM'
321 ycomment='X_Y_HO2IM'
322  CALL write_surf(hselect, hprogram,yrecfm,iss%XHO2IM,iresp,hcomment=ycomment)
323 !
324 yrecfm='HO2JP'
325 ycomment='X_Y_HO2JP'
326  CALL write_surf(hselect, hprogram,yrecfm,iss%XHO2JP,iresp,hcomment=ycomment)
327 !
328 yrecfm='HO2JM'
329 ycomment='X_Y_HO2JM'
330  CALL write_surf(hselect, hprogram,yrecfm,iss%XHO2JM,iresp,hcomment=ycomment)
331 !
332 yrecfm='SSO_SLOPE'
333 ycomment='X_Y_SSO_SLOPE (-)'
334  CALL write_surf(hselect, hprogram,yrecfm,iss%XSSO_SLOPE,iresp,hcomment=ycomment)
335 !
336 !* orographic runoff coefficient
337 !
338 yrecfm='RUNOFFB'
339 ycomment='X_Y_RUNOFFB'
340  CALL write_surf(hselect, hprogram,yrecfm,k%XRUNOFFB,iresp,hcomment=ycomment)
341 !
342 !* subgrid drainage coefficient
343 !
344 yrecfm='WDRAIN'
345 ycomment='X_Y_WDRAIN'
346  CALL write_surf(hselect, hprogram,yrecfm,k%XWDRAIN,iresp,hcomment=ycomment)
347 !
348 !* topographic index statistics
349 !
350 yrecfm='CTI'
351 ycomment=''
352  CALL write_surf(hselect, hprogram,yrecfm,io%LCTI,iresp,hcomment=ycomment)
353 !
354 IF(io%LCTI)THEN
355 !
356 yrecfm='TI_MIN'
357 ycomment='X_Y_TI_MIN'
358  CALL write_surf(hselect, hprogram,yrecfm,s%XTI_MIN,iresp,hcomment=ycomment)
359 !
360 yrecfm='TI_MAX'
361 ycomment='X_Y_TI_MAX'
362  CALL write_surf(hselect, hprogram,yrecfm,s%XTI_MAX,iresp,hcomment=ycomment)
363 !
364 yrecfm='TI_MEAN'
365 ycomment='X_Y_TI_MEAN'
366  CALL write_surf(hselect, hprogram,yrecfm,s%XTI_MEAN,iresp,hcomment=ycomment)
367 !
368 yrecfm='TI_STD'
369 ycomment='X_Y_TI_STD'
370  CALL write_surf(hselect, hprogram,yrecfm,s%XTI_STD,iresp,hcomment=ycomment)
371 !
372 yrecfm='TI_SKEW'
373 ycomment='X_Y_TI_SKEW'
374  CALL write_surf(hselect, hprogram,yrecfm,s%XTI_SKEW,iresp,hcomment=ycomment)
375 !
376 ENDIF
377 !
378 !-------------------------------------------------------------------------------
379  CALL writesurf_pgd_isba_par_n(hselect, dtv, hprogram)
380 IF (hnature=='TSZ0') CALL writesurf_pgd_tsz0_par_n(hselect, dtz, hprogram)
381 !
382 IF (lhook) CALL dr_hook('WRITESURF_PGD_ISBA_N',1,zhook_handle)
383 !-------------------------------------------------------------------------------
384 !
385 END SUBROUTINE writesurf_pgd_isba_n
subroutine writesurf_pgd_isba_n(HSELECT, HNATURE, DTV, DTZ, G, IS
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
subroutine write_grid(HSELECT, HPROGRAM, HGRID, PGRID_PAR, PLAT, PLON,
Definition: write_grid.F90:7
subroutine writesurf_pgd_isba_par_n(HSELECT, DTV, HPROGRAM)
logical lhook
Definition: yomhook.F90:15
subroutine write_lcover(HSELECT, HPROGRAM, OCOVER)
Definition: write_lcover.F90:7
subroutine writesurf_pgd_tsz0_par_n(HSELECT, DTZ, HPROGRAM)
static int count
Definition: memory_hook.c:21