SURFEX v8.1
General documentation of Surfex
write_diag_pgd_grdnn.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_diag_pgd_grdn_n (DTCO, HSELECT, U, OSURF_DIAG_ALBEDO, &
7  S, P, PEK, IO, HPROGRAM)
8 ! #########################################
9 !
10 !!**** *WRITE_DIAG_PGD_TEB_GARDEN_n* - writes the ISBA physiographic diagnostic fields
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/2004
36 !! Modified 10/2004 by P. Le Moigne: add XZ0REL, XVEGTYPE_PATCH
37 !! Modified 11/2005 by P. Le Moigne: limit length of VEGTYPE_PATCH field names
38 !-------------------------------------------------------------------------------
39 !
40 !* 0. DECLARATIONS
41 ! ------------
42 !
43 !
45 USE modd_surf_atm_n, ONLY : surf_atm_t
48 !
49 USE modd_surf_par, ONLY : xundef
50 !
51 !
53 !
54 USE modi_init_io_surf_n
56 USE modi_end_io_surf_n
57 !
58 !
59 USE yomhook ,ONLY : lhook, dr_hook
60 USE parkind1 ,ONLY : jprb
61 !
62 IMPLICIT NONE
63 !
64 !* 0.1 Declarations of arguments
65 ! -------------------------
66 !
67 !
68 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
69  CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: HSELECT
70 TYPE(surf_atm_t), INTENT(INOUT) :: U
71 LOGICAL, INTENT(IN) :: OSURF_DIAG_ALBEDO
72 TYPE(isba_s_t), INTENT(INOUT) :: S
73 TYPE(isba_p_t), INTENT(INOUT) :: P
74 TYPE(isba_pe_t), INTENT(INOUT) :: PEK
75 TYPE(isba_options_t), INTENT(INOUT) :: IO
76 !
77  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling
78 !
79 !* 0.2 Declarations of local variables
80 ! -------------------------------
81 !
82 INTEGER :: IRESP ! IRESP : return-code if a problem appears
83  CHARACTER(LEN=12) :: YRECFM ! Name of the article to be read
84  CHARACTER(LEN=100):: YCOMMENT ! Comment string
85  CHARACTER(LEN=2) :: YLVLV, YPAS
86 !
87 INTEGER :: JL, JP
88 REAL(KIND=JPRB) :: ZHOOK_HANDLE
89 !-------------------------------------------------------------------------------
90 !
91 ! Initialisation for IO
92 !
93 IF (lhook) CALL dr_hook('WRITE_DIAG_PGD_GRDN_N',0,zhook_handle)
94  CALL init_io_surf_n(dtco, u, hprogram,'TOWN ','TEB ','WRITE','TEB_PGD.OUT.nc')
95 !
96 !* Leaf Area Index
97 !
98 IF (io%CPHOTO=='NON' .OR. io%CPHOTO=='AST') THEN
99  !
100  yrecfm='GD_LAI'
101  ycomment='leaf area index (-)'
102  !
103  CALL write_surf(hselect,hprogram,yrecfm,pek%XLAI(:),iresp,hcomment=ycomment)
104  !
105 ENDIF
106 !
107 !-------------------------------------------------------------------------------
108 !
109 !* Vegetation fraction
110 !
111 yrecfm='GD_VEG'
112 ycomment='vegetation fraction (-)'
113 !
114  CALL write_surf(hselect,hprogram,yrecfm,pek%XVEG(:),iresp,hcomment=ycomment)
115 !
116 !* Surface roughness length (without snow)
117 !
118 yrecfm='GD_Z0VEG'
119 ycomment='surface roughness length (without snow) (M)'
120 !
121  CALL write_surf(hselect,hprogram,yrecfm,pek%XZ0(:),iresp,hcomment=ycomment)
122 !
123 !-------------------------------------------------------------------------------
124 !
125 !* Soil depth for each patch
126 !
127 DO jl=1,SIZE(p%XDG,2)
128  WRITE(yrecfm,fmt='(A5,I1)') 'GD_DG',jl
129  ycomment='soil depth'//' (M)'
130  CALL write_surf(hselect,hprogram,yrecfm,p%XDG(:,jl),iresp,hcomment=ycomment)
131 END DO
132 !
133 !-------------------------------------------------------------------------------
134 ! For Earth System Model
135 IF(lfanocompact.AND..NOT.lprep)THEN
136  CALL end_io_surf_n(hprogram)
137  IF (lhook) CALL dr_hook('WRITE_DIAG_PGD_GRDN_N',1,zhook_handle)
138  RETURN
139 ENDIF
140 !
141 !-------------------------------------------------------------------------------
142 !
143 !* Runoff soil ice depth for each patch
144 !
145 IF(io%CHORT=='SGH')THEN
146  yrecfm='GD_DICE'
147  ycomment='soil ice depth for runoff (m)'
148  CALL write_surf(hselect,hprogram,yrecfm,p%XD_ICE(:),iresp,hcomment=ycomment)
149 ENDIF
150 !
151 !-------------------------------------------------------------------------------
152 !
153 !* Fraction of each vegetation type for each patch
154 !
155 DO jl=1,SIZE(s%XVEGTYPE,2)
156  WRITE(ypas,'(I2)') jl
157  ylvlv=adjustl(ypas(:len_trim(ypas)))
158  WRITE(yrecfm,fmt='(A12)') 'GD_VEGTY_P'//ylvlv
159  ycomment='fraction of each vegetation type '//' (-)'
160  CALL write_surf(hselect,hprogram,yrecfm,s%XVEGTYPE(:,jl),iresp,hcomment=ycomment)
161 END DO
162 !-------------------------------------------------------------------------------
163 !
164 !* other surface parameters
165 !
166 yrecfm='GD_RSMIN'
167 ycomment='minimum stomatal resistance (SM-1)'
168  CALL write_surf(hselect,hprogram,yrecfm,pek%XRSMIN(:),iresp,hcomment=ycomment)
169 !
170 yrecfm='GD_GAMMA'
171 ycomment='coefficient for RSMIN calculation (-)'
172  CALL write_surf(hselect,hprogram,yrecfm,pek%XGAMMA(:),iresp,hcomment=ycomment)
173 !
174 yrecfm='GD_CV'
175 ycomment='vegetation thermal inertia coefficient (-)'
176  CALL write_surf(hselect,hprogram,yrecfm,pek%XCV(:),iresp,hcomment=ycomment)
177 !
178 yrecfm='GD_RGL'
179 ycomment='maximum solar radiation usable in photosynthesis (-)'
180  CALL write_surf(hselect,hprogram,yrecfm,pek%XRGL(:),iresp,hcomment=ycomment)
181 !
182 yrecfm='GD_EMIS_ISBA'
183 ycomment='surface emissivity (-)'
184  CALL write_surf(hselect,hprogram,yrecfm,pek%XEMIS(:),iresp,hcomment=ycomment)
185 !
186 yrecfm='GD_WRMAX_CF'
187 ycomment='coefficient for maximum water interception (-)'
188  CALL write_surf(hselect,hprogram,yrecfm,pek%XWRMAX_CF(:),iresp,hcomment=ycomment)
189 !
190 !-------------------------------------------------------------------------------
191 !
192 IF (osurf_diag_albedo) THEN
193 !
194 !* Soil albedos
195 !
196 !
197  yrecfm='GD_ALBNIR_S'
198  ycomment='soil near-infra-red albedo (-)'
199  CALL write_surf(hselect,hprogram,yrecfm,pek%XALBNIR_SOIL(:),iresp,hcomment=ycomment)
200 !
201 !-------------------------------------------------------------------------------
202 !
203  yrecfm='GD_ALBVIS_S'
204  ycomment='soil visible albedo (-)'
205  CALL write_surf(hselect,hprogram,yrecfm,pek%XALBVIS_SOIL(:),iresp,hcomment=ycomment)
206 !
207 !-------------------------------------------------------------------------------
208 !
209  yrecfm='GD_ALBUV_S'
210  ycomment='soil UV albedo (-)'
211  CALL write_surf(hselect,hprogram,yrecfm,pek%XALBUV_SOIL(:),iresp,hcomment=ycomment)
212 !
213 !-------------------------------------------------------------------------------
214 !
215 !* albedos
216 !
217  yrecfm='GD_ALBNIR_T'
218  ycomment='total near-infra-red albedo (-)'
219  CALL write_surf(hselect,hprogram,yrecfm,pek%XALBNIR(:),iresp,hcomment=ycomment)
220 !
221 !-------------------------------------------------------------------------------
222 !
223  yrecfm='GD_ALBVIS_T'
224  ycomment='total visible albedo (-)'
225  CALL write_surf(hselect,hprogram,yrecfm,pek%XALBVIS(:),iresp,hcomment=ycomment)
226 !
227 !-------------------------------------------------------------------------------
228 !
229  yrecfm='GD_ALBUV_T'
230  ycomment='total UV albedo (-)'
231  CALL write_surf(hselect,hprogram,yrecfm,pek%XALBUV(:),iresp,hcomment=ycomment)
232 !
233 END IF
234 !
235 !-------------------------------------------------------------------------------
236 !
237 ! End of IO
238 !
239  CALL end_io_surf_n(hprogram)
240 IF (lhook) CALL dr_hook('WRITE_DIAG_PGD_GRDN_N',1,zhook_handle)
241 !
242 !
243 END SUBROUTINE write_diag_pgd_grdn_n
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
subroutine end_io_surf_n(HPROGRAM)
Definition: end_io_surfn.F90:7
logical lhook
Definition: yomhook.F90:15
logical, save lprep
subroutine write_diag_pgd_grdn_n(DTCO, HSELECT, U, OSURF_DIAG_ALB
logical, save lfanocompact
subroutine init_io_surf_n(DTCO, U, HPROGRAM, HMASK, HSCHEME, HACTION