SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
writesurf_teb_greenroofn.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_teb_greenroof_n (DGU, U, TVG, GRM, &
7  hprogram,hpatch)
8 ! #####################################
9 !
10 !!**** *WRITESURF_TEB_GREENROOF_n* - writes ISBA prognostic fields
11 !!
12 !!
13 !! PURPOSE
14 !! -------
15 !!
16 !!** METHOD
17 !! ------
18 !!
19 !! Based on "writesurf_teb_gardenn"
20 !!
21 !! EXTERNAL
22 !! --------
23 !!
24 !!
25 !! IMPLICIT ARGUMENTS
26 !! ------------------
27 !!
28 !! REFERENCE
29 !! ---------
30 !!
31 !!
32 !! AUTHOR
33 !! ------
34 !! A. Lemonsu & C. de Munck
35 !!
36 !! MODIFICATIONS
37 !! -------------
38 !! Original 07/2011
39 !-------------------------------------------------------------------------------
40 !
41 !* 0. DECLARATIONS
42 ! ------------
43 !
44 !
45 !
46 !
47 !
49 USE modd_surf_atm_n, ONLY : surf_atm_t
52 !
54 USE modi_writesurf_gr_snow
55 USE modd_dst_surf
56 !
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 !
69 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
70 TYPE(surf_atm_t), INTENT(INOUT) :: u
71 TYPE(teb_veg_options_t), INTENT(INOUT) :: tvg
72 TYPE(teb_greenroof_model_t), INTENT(INOUT) :: grm
73 !
74  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling
75  CHARACTER(LEN=3), INTENT(IN) :: hpatch ! current teb patch
76 !
77 !* 0.2 Declarations of local variables
78 ! -------------------------------
79 !
80 INTEGER :: iresp ! IRESP : return-code if a problem appears
81  CHARACTER(LEN=30) :: yrecfm ! Name of the article to be read
82  CHARACTER(LEN=100) :: ycomment ! Comment string
83  CHARACTER(LEN=14) :: yform ! Writing format
84  CHARACTER(LEN=4 ) :: ylvl
85 !
86 INTEGER :: jlayer ! loop counter on soil layers
87 !
88 REAL, DIMENSION(:), ALLOCATABLE :: zwork ! 2D array to write data in file
89 !
90 INTEGER :: iwork ! Work integer
91 !
92 INTEGER :: jsv, jnbiomass
93 !
94 REAL(KIND=JPRB) :: zhook_handle
95 !
96 !------------------------------------------------------------------------------
97 !
98 !* 2. Prognostic fields:
99 ! -----------------
100 !
101 IF (lhook) CALL dr_hook('WRITESURF_TEB_GREENROOF_N',0,zhook_handle)
102 ALLOCATE(zwork(SIZE(grm%TGR%CUR%XTG,1)))
103 !
104 !
105 !* soil temperatures
106 !
107 iwork=grm%TGRO%NLAYER_GR
108 !
109 DO jlayer=1,iwork
110  WRITE(ylvl,'(I2)') jlayer
111  yrecfm=hpatch//'GR_TG'//adjustl(ylvl(:len_trim(ylvl)))
112  yrecfm=adjustl(yrecfm)
113  yform='(A13,I1.1,A4)'
114  IF (jlayer >= 10) yform='(A13,I2.2,A4)'
115  WRITE(ycomment,fmt=yform) 'X_Y_TWN_TG_GR',jlayer,' (K)'
116  zwork=grm%TGR%CUR%XTG(:,jlayer)
117  CALL write_surf(dgu, u, &
118  hprogram,yrecfm,zwork,iresp,hcomment=ycomment)
119 END DO
120 !
121 !* soil liquid water content
122 !
123 DO jlayer=1,grm%TGRO%NLAYER_GR
124  WRITE(ylvl,'(I2)') jlayer
125  yrecfm=hpatch//'GR_WG'//adjustl(ylvl(:len_trim(ylvl)))
126  yrecfm=adjustl(yrecfm)
127  yform='(A13,I1.1,A8)'
128  IF (jlayer >= 10) yform='(A13,I2.2,A8)'
129  WRITE(ycomment,fmt=yform) 'X_Y_TWN_WG_GR',jlayer,' (m3/m3)'
130  zwork=grm%TGR%CUR%XWG(:,jlayer)
131  CALL write_surf(dgu, u, &
132  hprogram,yrecfm,zwork,iresp,hcomment=ycomment)
133 END DO
134 !
135 !
136 !* soil ice water content
137 !
138 DO jlayer=1,grm%TGRO%NLAYER_GR
139  WRITE(ylvl,'(I2)') jlayer
140  yrecfm=hpatch//'GR_WGI'//adjustl(ylvl(:len_trim(ylvl)))
141  yrecfm=adjustl(yrecfm)
142  yform='(A14,I1.1,A8)'
143  IF (jlayer >= 10) yform='(A14,I2.2,A8)'
144  WRITE(ycomment,yform) 'X_Y_GR_WGI',jlayer,' (m3/m3)'
145  zwork=grm%TGR%CUR%XWGI(:,jlayer)
146  CALL write_surf(dgu, u, &
147  hprogram,yrecfm,zwork,iresp,hcomment=ycomment)
148 END DO
149 !
150 DEALLOCATE(zwork)
151 !
152 !* water intercepted on leaves
153 !
154 yrecfm=hpatch//'GR_WR'
155 yrecfm=adjustl(yrecfm)
156 ycomment='X_Y_TWN_WR_GR (kg/m2)'
157  CALL write_surf(dgu, u, &
158  hprogram,yrecfm,grm%TGR%CUR%XWR(:),iresp,hcomment=ycomment)
159 !
160 !* Leaf Area Index
161 !
162 IF (tvg%CPHOTO/='NON' .AND. tvg%CPHOTO/='AGS' .AND. tvg%CPHOTO/='AST') THEN
163  yrecfm=hpatch//'GR_LAI'
164  yrecfm=adjustl(yrecfm)
165  ycomment='X_Y_GR_LAI (m2/m2)'
166  CALL write_surf(dgu, u, &
167  hprogram,yrecfm,grm%TGRPE%CUR%XLAI(:),iresp,hcomment=ycomment)
168 END IF
169 !
170 !
171 !* biomass
172 !
173 IF (tvg%CPHOTO=='NIT') THEN
174  DO jnbiomass=1,tvg%NNBIOMASS
175  WRITE(ylvl,'(I1)') jnbiomass
176  yrecfm=hpatch//'GR_BIOMA'//adjustl(ylvl(:len_trim(ylvl)))
177  yrecfm=adjustl(yrecfm)
178  yform='(A11,I1.1,A8)'
179  WRITE(ycomment,fmt=yform) 'X_Y_BIOMASS',jnbiomass,' (kg/m2)'
180  CALL write_surf(dgu, u, &
181  hprogram,yrecfm,grm%TGR%CUR%XBIOMASS(:,jnbiomass),iresp,hcomment=ycomment)
182  END DO
183  !
184  !
185  DO jnbiomass=2,tvg%NNBIOMASS
186  WRITE(ylvl,'(I1)') jnbiomass
187  yrecfm=hpatch//'GR_RESPI'//adjustl(ylvl(:len_trim(ylvl)))
188  yrecfm=adjustl(yrecfm)
189  yform='(A16,I1.1,A10)'
190  WRITE(ycomment,fmt=yform) 'X_Y_RESP_BIOMASS',jnbiomass,' (kg/m2/s)'
191  CALL write_surf(dgu, u, &
192  hprogram,yrecfm,grm%TGR%CUR%XRESP_BIOMASS(:,jnbiomass),iresp,hcomment=ycomment)
193  END DO
194 END IF
195 !
196 !* aerodynamical resistance
197 !
198 !
199 yrecfm=hpatch//'GR_RESA'
200 yrecfm=adjustl(yrecfm)
201 ycomment='X_Y_GR_RESA (s/m)'
202  CALL write_surf(dgu, u, &
203  hprogram,yrecfm,grm%TGR%CUR%XRESA(:),iresp,hcomment=ycomment)
204 !
205 !* snow mantel
206 !
207 yrecfm='GR'
208  CALL writesurf_gr_snow(dgu, u, &
209  hprogram,yrecfm,hpatch,grm%TGR%CUR%TSNOW)
210 !
211 IF (lhook) CALL dr_hook('WRITESURF_TEB_GREENROOF_N',1,zhook_handle)
212 !
213 !-------------------------------------------------------------------------------
214 !
215 END SUBROUTINE writesurf_teb_greenroof_n
subroutine writesurf_teb_greenroof_n(DGU, U, TVG, GRM, HPROGRAM, HPATCH)
subroutine writesurf_gr_snow(DGU, U, HPROGRAM, HSURFTYPE, HPREFIX, TPSNOW)