Juan 8/12/2016: add management of LEN_HREC in MNH & SURFEX
[MNH-git_open_source-lfs.git] / src / SURFEX / modd_diag_surf_atmn.F90
1 !SURFEX_LIC Copyright 1994-2014 Meteo-France 
2 !SURFEX_LIC This is part of the SURFEX software governed by the CeCILL-C  licence
3 !SURFEX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SURFEX_LIC for details. version 1.
5 !     ######################
6       MODULE MODD_DIAG_SURF_ATM_n
7 !     ######################
8 !
9 !!****  *MODD_DIAG_SURF_ATM - declaration of diagnostics for the surface
10 !!
11 !!    PURPOSE
12 !!    -------
13 !
14 !!
15 !!**  IMPLICIT ARGUMENTS
16 !!    ------------------
17 !!      None 
18 !!
19 !!    REFERENCE
20 !!    ---------
21 !!
22 !!    AUTHOR
23 !!    ------
24 !!      V. Masson   *Meteo France*
25 !!
26 !!    MODIFICATIONS
27 !!    -------------
28 !!      Original       01/2004
29 !!      Modified    01/2006 : sea flux parameterization.
30 !!      Modified    04/2009 : precip for/from restart file.
31 !!      Modified    08/2009 : BUDGETC for all tiles
32 !
33 !*       0.   DECLARATIONS
34 !             ------------
35 !
36 USE MODD_TYPE_DATE_SURF
37 !
38 !
39 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
40 USE PARKIND1  ,ONLY : JPRB
41 !
42 IMPLICIT NONE
43
44 TYPE DIAG_SURF_ATM_t
45 !------------------------------------------------------------------------------
46 !
47   REAL    :: XDIAG_TSTEP  ! time step for diagnostics writing
48 !
49   INTEGER :: N2M          ! flag for 2 meters (and 10 meters) quantities
50   LOGICAL :: L2M_MIN_ZS   ! flag for 2 meters quantities evaluated on
51 !                         ! the minimum orographyy of the grid 
52   LOGICAL :: LSURF_BUDGET ! flag for surface energy budget
53   LOGICAL :: LRAD_BUDGET  ! flag for radiative energy budget      
54   LOGICAL :: LCOEF        ! flag for transfer coefficients
55   LOGICAL :: LSURF_VARS   ! flag for surface variables
56   LOGICAL :: LFRAC        ! flag for writing fractions of each four tiles
57   LOGICAL :: LDIAG_GRID   ! flag for mean grid diag
58   LOGICAL :: LSURF_BUDGETC       ! flag for surface cumulated energy budget
59   LOGICAL :: LRESET_BUDGETC      ! flag for surface cumulated energy budget
60   LOGICAL :: LREAD_BUDGETC       ! flag for surface cumulated energy budget
61   LOGICAL :: LPROVAR_TO_DIAG     ! switch to write (or not) prognostic variable
62                                  ! and allows puting field in diagnostics 
63   LOGICAL    :: LSELECT          ! switch to control which fields are written
64                                  ! (only those whose naem appears in in text array)
65 !  
66   TYPE(DATE_TIME):: TIME_BUDGETC
67 !
68 !* variables for each tile
69 !
70   REAL, POINTER, DIMENSION(:,:) :: XRI_TILE     ! Bulk-Richardson number           (-)
71   REAL, POINTER, DIMENSION(:,:) :: XCD_TILE     ! drag coefficient for wind        (W/s2)
72   REAL, POINTER, DIMENSION(:,:) :: XCH_TILE     ! drag coefficient for heat        (W/s)
73   REAL, POINTER, DIMENSION(:,:) :: XCE_TILE     ! drag coefficient for vapor       (W/s/K)
74   REAL, POINTER, DIMENSION(:,:) :: XRN_TILE     ! net radiation at surface         (W/m2)
75   REAL, POINTER, DIMENSION(:,:) :: XH_TILE      ! sensible heat flux               (W/m2)
76   REAL, POINTER, DIMENSION(:,:) :: XLE_TILE     ! total latent heat flux           (W/m2) 
77   REAL, POINTER, DIMENSION(:,:) :: XLEI_TILE    ! sublimation latent heat flux     (W/m2) 
78   REAL, POINTER, DIMENSION(:,:) :: XGFLUX_TILE  ! net soil-vegetation flux         (W/m2)
79   REAL, POINTER, DIMENSION(:,:) :: XTS_TILE     ! surface temperature              (K)
80   REAL, POINTER, DIMENSION(:,:) :: XT2M_TILE    ! air temperature at 2 meters      (K)
81   REAL, POINTER, DIMENSION(:,:) :: XT2M_MIN_TILE! Minimum air temperature at 2 meters (K)
82   REAL, POINTER, DIMENSION(:,:) :: XT2M_MAX_TILE! Maximum air temperature at 2 meters (K)
83   REAL, POINTER, DIMENSION(:,:) :: XQ2M_TILE    ! air humidity at 2 meters         (kg/kg)
84   REAL, POINTER, DIMENSION(:,:) :: XHU2M_TILE   ! air relative humidity at 2 meters(-)
85   REAL, POINTER, DIMENSION(:,:) :: XHU2M_MIN_TILE! Minimum air relative humidity at 2 meters(-)
86   REAL, POINTER, DIMENSION(:,:) :: XHU2M_MAX_TILE! Maximum air relative humidity at 2 meters(-)
87   REAL, POINTER, DIMENSION(:,:) :: XZON10M_TILE ! zonal wind at 10 meters          (m/s)
88   REAL, POINTER, DIMENSION(:,:) :: XMER10M_TILE ! meridian wind at 10 meters       (m/s)
89   REAL, POINTER, DIMENSION(:,:) :: XWIND10M_TILE! wind at 10 meters                (m/s)
90   REAL, POINTER, DIMENSION(:,:) :: XWIND10M_MAX_TILE ! Maximumwind at 10 meters    (m/s)
91   REAL, POINTER, DIMENSION(:,:) :: XQS_TILE
92   REAL, POINTER, DIMENSION(:,:) :: XZ0_TILE     ! roughness length for momentum    (m)
93   REAL, POINTER, DIMENSION(:,:) :: XZ0H_TILE    ! roughness length for heat        (m)
94   REAL, POINTER, DIMENSION(:,:) :: XSWD_TILE    ! short wave downward radiation (W/m2)
95   REAL, POINTER, DIMENSION(:,:) :: XSWU_TILE    ! short wave upward radiation (W/m2)
96   REAL, POINTER, DIMENSION(:,:) :: XLWD_TILE    ! longt wave downward radiation (W/m2)
97   REAL, POINTER, DIMENSION(:,:) :: XLWU_TILE    ! longt wave upward radiation (W/m2)
98   REAL, POINTER, DIMENSION(:,:,:) :: XSWBD_TILE ! short wave downward radiation by spectral band(W/m2)
99   REAL, POINTER, DIMENSION(:,:,:) :: XSWBU_TILE ! short wave upward radiation by spectral band(W/m2)
100   REAL, POINTER, DIMENSION(:,:) :: XFMU_TILE    ! zonal friction
101   REAL, POINTER, DIMENSION(:,:) :: XFMV_TILE    ! meridian friction
102 !
103 !* Cumulated variables for each tile
104 !
105   REAL, POINTER, DIMENSION(:,:) :: XRNC_TILE     ! net radiation at surface         (J/m2)
106   REAL, POINTER, DIMENSION(:,:) :: XHC_TILE      ! sensible heat flux               (J/m2)
107   REAL, POINTER, DIMENSION(:,:) :: XLEC_TILE     ! total latent heat flux           (J/m2) 
108   REAL, POINTER, DIMENSION(:,:) :: XLEIC_TILE    ! sublimation latent heat flux     (J/m2) 
109   REAL, POINTER, DIMENSION(:,:) :: XGFLUXC_TILE  ! net soil-vegetation flux         (J/m2)
110   REAL, POINTER, DIMENSION(:,:) :: XSWDC_TILE    ! short wave downward radiation    (J/m2)
111   REAL, POINTER, DIMENSION(:,:) :: XSWUC_TILE    ! short wave upward radiation      (J/m2)
112   REAL, POINTER, DIMENSION(:,:) :: XLWDC_TILE    ! longt wave downward radiation    (J/m2)
113   REAL, POINTER, DIMENSION(:,:) :: XLWUC_TILE    ! longt wave upward radiation      (J/m2)
114   REAL, POINTER, DIMENSION(:,:) :: XFMUC_TILE    ! zonal friction
115   REAL, POINTER, DIMENSION(:,:) :: XFMVC_TILE    ! meridian friction
116 !
117 !* averaged variables
118 !
119   REAL, POINTER, DIMENSION(:)   :: XAVG_RI      ! Bulk-Richardson number           (-)
120   REAL, POINTER, DIMENSION(:)   :: XAVG_CD       ! drag coefficient for wind        (W/s2)
121   REAL, POINTER, DIMENSION(:)   :: XAVG_CH       ! drag coefficient for heat        (W/s)
122   REAL, POINTER, DIMENSION(:)   :: XAVG_CE       ! drag coefficient for vapor       (W/s/K)
123   REAL, POINTER, DIMENSION(:)   :: XAVG_RN      ! net radiation at surface         (W/m2)
124   REAL, POINTER, DIMENSION(:)   :: XAVG_H       ! sensible heat flux               (W/m2)
125   REAL, POINTER, DIMENSION(:)   :: XAVG_LE      ! total latent heat flux           (W/m2) 
126   REAL, POINTER, DIMENSION(:)   :: XAVG_LEI     ! sublimation latent heat flux     (W/m2) 
127   REAL, POINTER, DIMENSION(:)   :: XAVG_GFLUX   ! net soil-vegetation flux         (W/m2)
128   REAL, POINTER, DIMENSION(:)   :: XAVG_TS      ! surface temperature              (K)
129   REAL, POINTER, DIMENSION(:)   :: XAVG_T2M     ! air temperature at 2 meters      (K)
130   REAL, POINTER, DIMENSION(:)   :: XAVG_Q2M     ! air humidity at 2 meters         (kg/kg)
131   REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M    ! air relative humidity at 2 meters(-)
132   REAL, POINTER, DIMENSION(:)   :: XAVG_ZON10M  ! zonal wind at 10 meters          (m/s)
133   REAL, POINTER, DIMENSION(:)   :: XAVG_MER10M  ! meridian wind at 10 meters       (m/s)
134   REAL, POINTER, DIMENSION(:)   :: XAVG_SFCO2   ! CO2 flux                         (kg/m2/s)  
135   REAL, POINTER, DIMENSION(:)   :: XAVG_T2M_MIN_ZS ! air temperature at 2 meters   (K)
136   REAL, POINTER, DIMENSION(:)   :: XAVG_Q2M_MIN_ZS ! air humidity at 2 meters      (kg/kg)
137   REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M_MIN_ZS! air relative humidity at 2 m  (-)
138   REAL, POINTER, DIMENSION(:)   :: XPS          ! air pressure at the surface      (Pa)
139   REAL, POINTER, DIMENSION(:)   :: XRHOA        ! air density  at the surface      (kg/m3)
140   REAL, POINTER, DIMENSION(:)   :: XAVG_QS
141   REAL, POINTER, DIMENSION(:)   :: XAVG_Z0      ! roughness length for momentum    (m)
142   REAL, POINTER, DIMENSION(:)   :: XAVG_Z0H     ! roughness length for heat        (m)
143   REAL, POINTER, DIMENSION(:)   :: XAVG_SWD     ! short wave downward radiation (W/m2)
144   REAL, POINTER, DIMENSION(:)   :: XAVG_SWU     ! short wave upward radiation (W/m2)
145   REAL, POINTER, DIMENSION(:)   :: XAVG_LWD     ! longt wave downward radiation (W/m2)
146   REAL, POINTER, DIMENSION(:)   :: XAVG_LWU     ! longt wave upward radiation (W/m2)
147   REAL, POINTER, DIMENSION(:,:) :: XAVG_SWBD    ! short wave downward radiation by spectral band(W/m2)
148   REAL, POINTER, DIMENSION(:,:) :: XAVG_SWBU    ! short wave upward radiation by spectral band(W/m2)
149   REAL, POINTER, DIMENSION(:)   :: XAVG_FMU     ! zonal friction
150   REAL, POINTER, DIMENSION(:)   :: XAVG_FMV     ! meridian friction
151   REAL, POINTER, DIMENSION(:)   :: XSSO_FMU     ! zonal friction    (with SSO)     (Pa)
152   REAL, POINTER, DIMENSION(:)   :: XSSO_FMV     ! meridian friction (with SSO)     (Pa)
153 !
154   REAL, POINTER, DIMENSION(:)   :: XDIAG_UREF   ! reference height for momentum    (m)
155   REAL, POINTER, DIMENSION(:)   :: XDIAG_ZREF   ! reference height for heat        (m)
156   REAL, POINTER, DIMENSION(:)   :: XDIAG_TRAD   ! radiative temperature at t       (K)
157   REAL, POINTER, DIMENSION(:)   :: XDIAG_EMIS   ! surface emissivity at t          (-)
158 !
159   REAL, POINTER, DIMENSION(:)   :: XAVG_T2M_MIN ! Minimun air temperature at 2 meters      (K)
160   REAL, POINTER, DIMENSION(:)   :: XAVG_T2M_MAX ! Maximum air temperature at 2 meters      (K)
161   REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M_MIN! Minimun air relative humidity at 2 meters(-)
162   REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M_MAX! Maximum air relative humidity at 2 meters(-)
163   REAL, POINTER, DIMENSION(:)   :: XAVG_WIND10M ! wind at 10 meters                      (m/s)
164   REAL, POINTER, DIMENSION(:)   :: XAVG_WIND10M_MAX ! Maximum wind at 10 meters          (m/s)
165 !
166 !* cumulated averaged variables
167 !
168   REAL, POINTER, DIMENSION(:)   :: XAVG_RNC      ! net radiation at surface         (J/m2)
169   REAL, POINTER, DIMENSION(:)   :: XAVG_HC       ! sensible heat flux               (J/m2)
170   REAL, POINTER, DIMENSION(:)   :: XAVG_LEC      ! total latent heat flux           (J/m2) 
171   REAL, POINTER, DIMENSION(:)   :: XAVG_LEIC     ! sublimation latent heat flux     (J/m2) 
172   REAL, POINTER, DIMENSION(:)   :: XAVG_GFLUXC   ! net soil-vegetation flux         (J/m2)
173   REAL, POINTER, DIMENSION(:)   :: XAVG_SWDC     ! short wave downward radiation    (J/m2)
174   REAL, POINTER, DIMENSION(:)   :: XAVG_SWUC     ! short wave upward radiation      (J/m2)
175   REAL, POINTER, DIMENSION(:)   :: XAVG_LWDC     ! longt wave downward radiation    (J/m2)
176   REAL, POINTER, DIMENSION(:)   :: XAVG_LWUC     ! longt wave upward radiation      (J/m2)
177   REAL, POINTER, DIMENSION(:)   :: XAVG_FMUC     ! zonal friction
178   REAL, POINTER, DIMENSION(:)   :: XAVG_FMVC     ! meridian friction
179 !
180 !* restart variables (for ARPEGE/ALADAIN)
181 !
182   REAL, POINTER, DIMENSION(:) :: XRW_RAIN       ! Init/End rainfall rate   (kg/m2/s)
183   REAL, POINTER, DIMENSION(:) :: XRW_SNOW       ! Init/End snowfall rate   (kg/m2/s)
184 !                                   
185   CHARACTER(LEN=LEN_HREC), POINTER, DIMENSION(:) :: CSELECT  ! Name of ouput fields if LSELECT=true
186 !
187 !------------------------------------------------------------------------------
188 !
189
190 END TYPE DIAG_SURF_ATM_t
191
192 TYPE(DIAG_SURF_ATM_t), ALLOCATABLE, TARGET, SAVE :: DIAG_SURF_ATM_MODEL(:)
193
194 REAL, POINTER :: XDIAG_TSTEP=>NULL()
195 !$OMP THREADPRIVATE(XDIAG_TSTEP)
196 INTEGER, POINTER :: N2M=>NULL()
197 !$OMP THREADPRIVATE(N2M)
198 LOGICAL, POINTER :: L2M_MIN_ZS=>NULL()
199 !$OMP THREADPRIVATE(L2M_MIN_ZS)
200 LOGICAL, POINTER :: LSURF_BUDGET=>NULL()
201 !$OMP THREADPRIVATE(LSURF_BUDGET)
202 LOGICAL, POINTER :: LRAD_BUDGET=>NULL()
203 !$OMP THREADPRIVATE(LRAD_BUDGET)
204 LOGICAL, POINTER :: LCOEF=>NULL()
205 !$OMP THREADPRIVATE(LCOEF)
206 LOGICAL, POINTER :: LSURF_VARS=>NULL()
207 !$OMP THREADPRIVATE(LSURF_VARS)
208 LOGICAL, POINTER :: LFRAC=>NULL()
209 !$OMP THREADPRIVATE(LFRAC)
210 LOGICAL, POINTER :: LDIAG_GRID=>NULL()
211 !$OMP THREADPRIVATE(LDIAG_GRID)
212 LOGICAL, POINTER :: LSURF_BUDGETC=>NULL()
213 !$OMP THREADPRIVATE(LSURF_BUDGETC)
214 LOGICAL, POINTER :: LRESET_BUDGETC=>NULL()
215 !$OMP THREADPRIVATE(LRESET_BUDGETC)
216 LOGICAL, POINTER :: LREAD_BUDGETC=>NULL()
217 !$OMP THREADPRIVATE(LREAD_BUDGETC)
218 LOGICAL, POINTER :: LPROVAR_TO_DIAG=>NULL()
219 !$OMP THREADPRIVATE(LPROVAR_TO_DIAG)
220 LOGICAL, POINTER :: LSELECT=>NULL()
221 !$OMP THREADPRIVATE(LSELECT)
222  CHARACTER(LEN=LEN_HREC), DIMENSION(:), POINTER :: CSELECT=>NULL()
223 !$OMP THREADPRIVATE(CSELECT)
224 TYPE(DATE_TIME), POINTER :: TIME_BUDGETC=>NULL()
225 !$OMP THREADPRIVATE(TIME_BUDGETC)
226 REAL, POINTER, DIMENSION(:,:) :: XRI_TILE=>NULL()
227 !$OMP THREADPRIVATE(XRI_TILE)
228 REAL, POINTER, DIMENSION(:,:) :: XCD_TILE=>NULL()
229 !$OMP THREADPRIVATE(XCD_TILE)
230 REAL, POINTER, DIMENSION(:,:) :: XCH_TILE=>NULL()
231 !$OMP THREADPRIVATE(XCH_TILE)
232 REAL, POINTER, DIMENSION(:,:) :: XCE_TILE=>NULL()
233 !$OMP THREADPRIVATE(XCE_TILE)
234 REAL, POINTER, DIMENSION(:,:) :: XRN_TILE=>NULL()
235 !$OMP THREADPRIVATE(XRN_TILE)
236 REAL, POINTER, DIMENSION(:,:) :: XH_TILE=>NULL()
237 !$OMP THREADPRIVATE(XH_TILE)
238 REAL, POINTER, DIMENSION(:,:) :: XLE_TILE=>NULL()
239 !$OMP THREADPRIVATE(XLE_TILE)
240 REAL, POINTER, DIMENSION(:,:) :: XLEI_TILE=>NULL()
241 !$OMP THREADPRIVATE(XLEI_TILE)
242 REAL, POINTER, DIMENSION(:,:) :: XGFLUX_TILE=>NULL()
243 !$OMP THREADPRIVATE(XGFLUX_TILE)
244 REAL, POINTER, DIMENSION(:,:) :: XTS_TILE=>NULL()
245 !$OMP THREADPRIVATE(XTS_TILE)
246 REAL, POINTER, DIMENSION(:,:) :: XT2M_TILE=>NULL()
247 !$OMP THREADPRIVATE(XT2M_TILE)
248 REAL, POINTER, DIMENSION(:,:) :: XT2M_MAX_TILE=>NULL()
249 !$OMP THREADPRIVATE(XT2M_MAX_TILE)
250 REAL, POINTER, DIMENSION(:,:) :: XT2M_MIN_TILE=>NULL()
251 !$OMP THREADPRIVATE(XT2M_MIN_TILE)
252 REAL, POINTER, DIMENSION(:,:) :: XQ2M_TILE=>NULL()
253 !$OMP THREADPRIVATE(XQ2M_TILE)
254 REAL, POINTER, DIMENSION(:,:) :: XHU2M_TILE=>NULL()
255 !$OMP THREADPRIVATE(XHU2M_TILE)
256 REAL, POINTER, DIMENSION(:,:) :: XHU2M_MAX_TILE=>NULL()
257 !$OMP THREADPRIVATE(XHU2M_MAX_TILE)
258 REAL, POINTER, DIMENSION(:,:) :: XHU2M_MIN_TILE=>NULL()
259 !$OMP THREADPRIVATE(XHU2M_MIN_TILE)
260 REAL, POINTER, DIMENSION(:,:) :: XZON10M_TILE=>NULL()
261 !$OMP THREADPRIVATE(XZON10M_TILE)
262 REAL, POINTER, DIMENSION(:,:) :: XMER10M_TILE=>NULL()
263 !$OMP THREADPRIVATE(XMER10M_TILE)
264 REAL, POINTER, DIMENSION(:,:) :: XWIND10M_TILE=>NULL()
265 !$OMP THREADPRIVATE(XWIND10M_TILE)
266 REAL, POINTER, DIMENSION(:,:) :: XWIND10M_MAX_TILE=>NULL()
267 !$OMP THREADPRIVATE(XWIND10M_MAX_TILE)
268 REAL, POINTER, DIMENSION(:,:) :: XQS_TILE=>NULL()
269 !$OMP THREADPRIVATE(XQS_TILE)
270 REAL, POINTER, DIMENSION(:,:) :: XZ0_TILE=>NULL()
271 !$OMP THREADPRIVATE(XZ0_TILE)
272 REAL, POINTER, DIMENSION(:,:) :: XZ0H_TILE=>NULL()
273 !$OMP THREADPRIVATE(XZ0H_TILE)
274 REAL, POINTER, DIMENSION(:,:) :: XSWD_TILE=>NULL()
275 !$OMP THREADPRIVATE(XSWD_TILE)
276 REAL, POINTER, DIMENSION(:,:) :: XSWU_TILE=>NULL()
277 !$OMP THREADPRIVATE(XSWU_TILE)
278 REAL, POINTER, DIMENSION(:,:) :: XLWD_TILE=>NULL()
279 !$OMP THREADPRIVATE(XLWD_TILE)
280 REAL, POINTER, DIMENSION(:,:) :: XLWU_TILE=>NULL()
281 !$OMP THREADPRIVATE(XLWU_TILE)
282 REAL, POINTER, DIMENSION(:,:,:) :: XSWBD_TILE=>NULL()
283 !$OMP THREADPRIVATE(XSWBD_TILE)
284 REAL, POINTER, DIMENSION(:,:,:) :: XSWBU_TILE=>NULL()
285 !$OMP THREADPRIVATE(XSWBU_TILE)
286 REAL, POINTER, DIMENSION(:,:) :: XFMU_TILE=>NULL()
287 !$OMP THREADPRIVATE(XFMU_TILE)
288 REAL, POINTER, DIMENSION(:,:) :: XFMV_TILE=>NULL()
289 !$OMP THREADPRIVATE(XFMV_TILE)
290 REAL, POINTER, DIMENSION(:,:) :: XRNC_TILE=>NULL()
291 !$OMP THREADPRIVATE(XRNC_TILE)
292 REAL, POINTER, DIMENSION(:,:) :: XHC_TILE=>NULL()
293 !$OMP THREADPRIVATE(XHC_TILE)
294 REAL, POINTER, DIMENSION(:,:) :: XLEC_TILE=>NULL()
295 !$OMP THREADPRIVATE(XLEC_TILE)
296 REAL, POINTER, DIMENSION(:,:) :: XLEIC_TILE=>NULL()
297 !$OMP THREADPRIVATE(XLEIC_TILE)
298 REAL, POINTER, DIMENSION(:,:) :: XGFLUXC_TILE=>NULL()
299 !$OMP THREADPRIVATE(XGFLUXC_TILE)
300 REAL, POINTER, DIMENSION(:,:) :: XSWDC_TILE=>NULL()
301 !$OMP THREADPRIVATE(XSWDC_TILE)
302 REAL, POINTER, DIMENSION(:,:) :: XSWUC_TILE=>NULL()
303 !$OMP THREADPRIVATE(XSWUC_TILE)
304 REAL, POINTER, DIMENSION(:,:) :: XLWDC_TILE=>NULL()
305 !$OMP THREADPRIVATE(XLWDC_TILE)
306 REAL, POINTER, DIMENSION(:,:) :: XLWUC_TILE=>NULL()
307 !$OMP THREADPRIVATE(XLWUC_TILE)
308 REAL, POINTER, DIMENSION(:,:) :: XFMUC_TILE=>NULL()
309 !$OMP THREADPRIVATE(XFMUC_TILE)
310 REAL, POINTER, DIMENSION(:,:) :: XFMVC_TILE=>NULL()
311 !$OMP THREADPRIVATE(XFMVC_TILE)
312 REAL, POINTER, DIMENSION(:)   :: XAVG_RI=>NULL()
313 !$OMP THREADPRIVATE(XAVG_RI)
314 REAL, POINTER, DIMENSION(:)   :: XAVG_CD=>NULL()
315 !$OMP THREADPRIVATE(XAVG_CD)
316 REAL, POINTER, DIMENSION(:)   :: XAVG_CH=>NULL()
317 !$OMP THREADPRIVATE(XAVG_CH)
318 REAL, POINTER, DIMENSION(:)   :: XAVG_CE=>NULL()
319 !$OMP THREADPRIVATE(XAVG_CE)
320 REAL, POINTER, DIMENSION(:)   :: XAVG_RN=>NULL()
321 !$OMP THREADPRIVATE(XAVG_RN)
322 REAL, POINTER, DIMENSION(:)   :: XAVG_H=>NULL()
323 !$OMP THREADPRIVATE(XAVG_H)
324 REAL, POINTER, DIMENSION(:)   :: XAVG_LE=>NULL()
325 !$OMP THREADPRIVATE(XAVG_LE)
326 REAL, POINTER, DIMENSION(:)   :: XAVG_LEI=>NULL()
327 !$OMP THREADPRIVATE(XAVG_LEI)
328 REAL, POINTER, DIMENSION(:)   :: XAVG_GFLUX=>NULL()
329 !$OMP THREADPRIVATE(XAVG_GFLUX)
330 REAL, POINTER, DIMENSION(:)   :: XAVG_TS=>NULL()
331 !$OMP THREADPRIVATE(XAVG_TS)
332 REAL, POINTER, DIMENSION(:)   :: XAVG_T2M=>NULL()
333 !$OMP THREADPRIVATE(XAVG_T2M)
334 REAL, POINTER, DIMENSION(:)   :: XAVG_T2M_MIN=>NULL()
335 !$OMP THREADPRIVATE(XAVG_T2M_MIN)
336 REAL, POINTER, DIMENSION(:)   :: XAVG_T2M_MAX=>NULL()
337 !$OMP THREADPRIVATE(XAVG_T2M_MAX)
338 REAL, POINTER, DIMENSION(:)   :: XAVG_Q2M=>NULL()
339 !$OMP THREADPRIVATE(XAVG_Q2M)
340 REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M=>NULL()
341 !$OMP THREADPRIVATE(XAVG_HU2M)
342 REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M_MIN=>NULL()
343 !$OMP THREADPRIVATE(XAVG_HU2M_MIN)
344 REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M_MAX=>NULL()
345 !$OMP THREADPRIVATE(XAVG_HU2M_MAX)
346 REAL, POINTER, DIMENSION(:)   :: XAVG_ZON10M=>NULL()
347 !$OMP THREADPRIVATE(XAVG_ZON10M)
348 REAL, POINTER, DIMENSION(:)   :: XAVG_MER10M=>NULL()
349 !$OMP THREADPRIVATE(XAVG_MER10M)
350 REAL, POINTER, DIMENSION(:)   :: XAVG_WIND10M=>NULL()
351 !$OMP THREADPRIVATE(XAVG_WIND10M)
352 REAL, POINTER, DIMENSION(:)   :: XAVG_WIND10M_MAX=>NULL()
353 !$OMP THREADPRIVATE(XAVG_WIND10M_MAX)
354 REAL, POINTER, DIMENSION(:)   :: XAVG_SFCO2=>NULL()
355 !$OMP THREADPRIVATE(XAVG_SFCO2)
356 REAL, POINTER, DIMENSION(:)   :: XAVG_T2M_MIN_ZS=>NULL()
357 !$OMP THREADPRIVATE(XAVG_T2M_MIN_ZS)
358 REAL, POINTER, DIMENSION(:)   :: XAVG_Q2M_MIN_ZS=>NULL()
359 !$OMP THREADPRIVATE(XAVG_Q2M_MIN_ZS)
360 REAL, POINTER, DIMENSION(:)   :: XAVG_HU2M_MIN_ZS=>NULL()
361 !$OMP THREADPRIVATE(XAVG_HU2M_MIN_ZS)
362 REAL, POINTER, DIMENSION(:)   :: XPS=>NULL()
363 !$OMP THREADPRIVATE(XPS)
364 REAL, POINTER, DIMENSION(:)   :: XRHOA=>NULL()
365 !$OMP THREADPRIVATE(XRHOA)
366 REAL, POINTER, DIMENSION(:)   :: XAVG_QS=>NULL()
367 !$OMP THREADPRIVATE(XAVG_QS)
368 REAL, POINTER, DIMENSION(:)   :: XAVG_Z0=>NULL()
369 !$OMP THREADPRIVATE(XAVG_Z0)
370 REAL, POINTER, DIMENSION(:)   :: XAVG_Z0H=>NULL()
371 !$OMP THREADPRIVATE(XAVG_Z0H)
372 REAL, POINTER, DIMENSION(:)   :: XAVG_SWD=>NULL()
373 !$OMP THREADPRIVATE(XAVG_SWD)
374 REAL, POINTER, DIMENSION(:)   :: XAVG_SWU=>NULL()
375 !$OMP THREADPRIVATE(XAVG_SWU)
376 REAL, POINTER, DIMENSION(:)   :: XAVG_LWD=>NULL()
377 !$OMP THREADPRIVATE(XAVG_LWD)
378 REAL, POINTER, DIMENSION(:)   :: XAVG_LWU=>NULL()
379 !$OMP THREADPRIVATE(XAVG_LWU)
380 REAL, POINTER, DIMENSION(:,:) :: XAVG_SWBD=>NULL()
381 !$OMP THREADPRIVATE(XAVG_SWBD)
382 REAL, POINTER, DIMENSION(:,:) :: XAVG_SWBU=>NULL()
383 !$OMP THREADPRIVATE(XAVG_SWBU)
384 REAL, POINTER, DIMENSION(:)   :: XAVG_FMU=>NULL()
385 !$OMP THREADPRIVATE(XAVG_FMU)
386 REAL, POINTER, DIMENSION(:)   :: XAVG_FMV=>NULL()
387 !$OMP THREADPRIVATE(XAVG_FMV)
388 REAL, POINTER, DIMENSION(:)   :: XSSO_FMU=>NULL()
389 !$OMP THREADPRIVATE(XSSO_FMU)
390 REAL, POINTER, DIMENSION(:)   :: XSSO_FMV=>NULL()
391 !$OMP THREADPRIVATE(XSSO_FMV)
392 REAL, POINTER, DIMENSION(:)   :: XDIAG_ZREF=>NULL()
393 !$OMP THREADPRIVATE(XDIAG_ZREF)
394 REAL, POINTER, DIMENSION(:)   :: XDIAG_UREF=>NULL()
395 !$OMP THREADPRIVATE(XDIAG_UREF)
396 REAL, POINTER, DIMENSION(:)   :: XDIAG_TRAD=>NULL()
397 !$OMP THREADPRIVATE(XDIAG_TRAD)
398 REAL, POINTER, DIMENSION(:)   :: XDIAG_EMIS=>NULL()
399 !$OMP THREADPRIVATE(XDIAG_EMIS)
400 REAL, POINTER, DIMENSION(:)   :: XAVG_RNC=>NULL()
401 !$OMP THREADPRIVATE(XAVG_RNC)
402 REAL, POINTER, DIMENSION(:)   :: XAVG_HC=>NULL()
403 !$OMP THREADPRIVATE(XAVG_HC)
404 REAL, POINTER, DIMENSION(:)   :: XAVG_LEC=>NULL()
405 !$OMP THREADPRIVATE(XAVG_LEC)
406 REAL, POINTER, DIMENSION(:)   :: XAVG_LEIC=>NULL()
407 !$OMP THREADPRIVATE(XAVG_LEIC)
408 REAL, POINTER, DIMENSION(:)   :: XAVG_GFLUXC=>NULL()
409 !$OMP THREADPRIVATE(XAVG_GFLUXC)
410 REAL, POINTER, DIMENSION(:)   :: XAVG_SWDC=>NULL()
411 !$OMP THREADPRIVATE(XAVG_SWDC)
412 REAL, POINTER, DIMENSION(:)   :: XAVG_SWUC=>NULL()
413 !$OMP THREADPRIVATE(XAVG_SWUC)
414 REAL, POINTER, DIMENSION(:)   :: XAVG_LWDC=>NULL()
415 !$OMP THREADPRIVATE(XAVG_LWDC)
416 REAL, POINTER, DIMENSION(:)   :: XAVG_LWUC=>NULL()
417 !$OMP THREADPRIVATE(XAVG_LWUC)
418 REAL, POINTER, DIMENSION(:)   :: XAVG_FMUC=>NULL()
419 !$OMP THREADPRIVATE(XAVG_FMUC)
420 REAL, POINTER, DIMENSION(:)   :: XAVG_FMVC=>NULL()
421 !$OMP THREADPRIVATE(XAVG_FMVC)
422 !
423 REAL, POINTER, DIMENSION(:)   :: XRW_RAIN=>NULL()
424 !$OMP THREADPRIVATE(XRW_RAIN)
425 REAL, POINTER, DIMENSION(:)   :: XRW_SNOW=>NULL()
426 !$OMP THREADPRIVATE(XRW_SNOW)
427
428 CONTAINS
429
430 SUBROUTINE DIAG_SURF_ATM_GOTO_MODEL(KFROM, KTO, LKFROM)
431 LOGICAL, INTENT(IN) :: LKFROM
432 INTEGER, INTENT(IN) :: KFROM, KTO
433 REAL(KIND=JPRB) :: ZHOOK_HANDLE
434 !
435 ! Save current state for allocated arrays
436 IF (LKFROM) THEN
437 DIAG_SURF_ATM_MODEL(KFROM)%CSELECT=>CSELECT
438 DIAG_SURF_ATM_MODEL(KFROM)%XRI_TILE=>XRI_TILE
439 DIAG_SURF_ATM_MODEL(KFROM)%XCD_TILE=>XCD_TILE
440 DIAG_SURF_ATM_MODEL(KFROM)%XCH_TILE=>XCH_TILE
441 DIAG_SURF_ATM_MODEL(KFROM)%XCE_TILE=>XCE_TILE
442 DIAG_SURF_ATM_MODEL(KFROM)%XRN_TILE=>XRN_TILE
443 DIAG_SURF_ATM_MODEL(KFROM)%XH_TILE=>XH_TILE
444 DIAG_SURF_ATM_MODEL(KFROM)%XLE_TILE=>XLE_TILE
445 DIAG_SURF_ATM_MODEL(KFROM)%XLEI_TILE=>XLEI_TILE
446 DIAG_SURF_ATM_MODEL(KFROM)%XGFLUX_TILE=>XGFLUX_TILE
447 DIAG_SURF_ATM_MODEL(KFROM)%XTS_TILE=>XTS_TILE
448 DIAG_SURF_ATM_MODEL(KFROM)%XT2M_TILE=>XT2M_TILE
449 DIAG_SURF_ATM_MODEL(KFROM)%XT2M_MIN_TILE=>XT2M_MIN_TILE
450 DIAG_SURF_ATM_MODEL(KFROM)%XT2M_MAX_TILE=>XT2M_MAX_TILE
451 DIAG_SURF_ATM_MODEL(KFROM)%XQ2M_TILE=>XQ2M_TILE
452 DIAG_SURF_ATM_MODEL(KFROM)%XHU2M_TILE=>XHU2M_TILE
453 DIAG_SURF_ATM_MODEL(KFROM)%XHU2M_MIN_TILE=>XHU2M_MIN_TILE
454 DIAG_SURF_ATM_MODEL(KFROM)%XHU2M_MAX_TILE=>XHU2M_MAX_TILE
455 DIAG_SURF_ATM_MODEL(KFROM)%XZON10M_TILE=>XZON10M_TILE
456 DIAG_SURF_ATM_MODEL(KFROM)%XMER10M_TILE=>XMER10M_TILE
457 DIAG_SURF_ATM_MODEL(KFROM)%XWIND10M_TILE=>XWIND10M_TILE
458 DIAG_SURF_ATM_MODEL(KFROM)%XWIND10M_MAX_TILE=>XWIND10M_MAX_TILE
459 DIAG_SURF_ATM_MODEL(KFROM)%XQS_TILE=>XQS_TILE
460 DIAG_SURF_ATM_MODEL(KFROM)%XZ0_TILE=>XZ0_TILE
461 DIAG_SURF_ATM_MODEL(KFROM)%XZ0H_TILE=>XZ0H_TILE
462 DIAG_SURF_ATM_MODEL(KFROM)%XSWD_TILE=>XSWD_TILE
463 DIAG_SURF_ATM_MODEL(KFROM)%XSWU_TILE=>XSWU_TILE
464 DIAG_SURF_ATM_MODEL(KFROM)%XLWD_TILE=>XLWD_TILE
465 DIAG_SURF_ATM_MODEL(KFROM)%XLWU_TILE=>XLWU_TILE
466 DIAG_SURF_ATM_MODEL(KFROM)%XSWBD_TILE=>XSWBD_TILE
467 DIAG_SURF_ATM_MODEL(KFROM)%XSWBU_TILE=>XSWBU_TILE
468 DIAG_SURF_ATM_MODEL(KFROM)%XFMU_TILE=>XFMU_TILE
469 DIAG_SURF_ATM_MODEL(KFROM)%XFMV_TILE=>XFMV_TILE
470 DIAG_SURF_ATM_MODEL(KFROM)%XRNC_TILE=>XRNC_TILE
471 DIAG_SURF_ATM_MODEL(KFROM)%XHC_TILE=>XHC_TILE
472 DIAG_SURF_ATM_MODEL(KFROM)%XLEC_TILE=>XLEC_TILE
473 DIAG_SURF_ATM_MODEL(KFROM)%XLEIC_TILE=>XLEIC_TILE
474 DIAG_SURF_ATM_MODEL(KFROM)%XGFLUXC_TILE=>XGFLUXC_TILE
475 DIAG_SURF_ATM_MODEL(KFROM)%XSWDC_TILE=>XSWDC_TILE
476 DIAG_SURF_ATM_MODEL(KFROM)%XSWUC_TILE=>XSWUC_TILE
477 DIAG_SURF_ATM_MODEL(KFROM)%XLWDC_TILE=>XLWDC_TILE
478 DIAG_SURF_ATM_MODEL(KFROM)%XLWUC_TILE=>XLWUC_TILE
479 DIAG_SURF_ATM_MODEL(KFROM)%XFMUC_TILE=>XFMUC_TILE
480 DIAG_SURF_ATM_MODEL(KFROM)%XFMVC_TILE=>XFMVC_TILE
481 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_RI=>XAVG_RI
482 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_CD=>XAVG_CD
483 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_CH=>XAVG_CH
484 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_CE=>XAVG_CE
485 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_RN=>XAVG_RN
486 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_H=>XAVG_H
487 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LE=>XAVG_LE
488 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LEI=>XAVG_LEI
489 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_GFLUX=>XAVG_GFLUX
490 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_TS=>XAVG_TS
491 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_T2M=>XAVG_T2M
492 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_T2M_MIN=>XAVG_T2M_MIN
493 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_T2M_MAX=>XAVG_T2M_MAX
494 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_Q2M=>XAVG_Q2M
495 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_HU2M=>XAVG_HU2M
496 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_HU2M_MIN=>XAVG_HU2M_MIN
497 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_HU2M_MAX=>XAVG_HU2M_MAX
498 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_ZON10M=>XAVG_ZON10M
499 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_MER10M=>XAVG_MER10M
500 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_WIND10M=>XAVG_WIND10M
501 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_WIND10M_MAX=>XAVG_WIND10M_MAX
502 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SFCO2=>XAVG_SFCO2
503 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_T2M_MIN_ZS=>XAVG_T2M_MIN_ZS
504 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_Q2M_MIN_ZS=>XAVG_Q2M_MIN_ZS
505 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_HU2M_MIN_ZS=>XAVG_HU2M_MIN_ZS
506 DIAG_SURF_ATM_MODEL(KFROM)%XPS=>XPS
507 DIAG_SURF_ATM_MODEL(KFROM)%XRHOA=>XRHOA
508 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_QS=>XAVG_QS
509 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_Z0=>XAVG_Z0
510 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_Z0H=>XAVG_Z0H
511 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SWD=>XAVG_SWD
512 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SWU=>XAVG_SWU
513 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LWD=>XAVG_LWD
514 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LWU=>XAVG_LWU
515 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SWBD=>XAVG_SWBD
516 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SWBU=>XAVG_SWBU
517 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_FMU=>XAVG_FMU
518 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_FMV=>XAVG_FMV
519 DIAG_SURF_ATM_MODEL(KFROM)%XSSO_FMU=>XSSO_FMU
520 DIAG_SURF_ATM_MODEL(KFROM)%XSSO_FMV=>XSSO_FMV
521 DIAG_SURF_ATM_MODEL(KFROM)%XDIAG_UREF=>XDIAG_UREF
522 DIAG_SURF_ATM_MODEL(KFROM)%XDIAG_ZREF=>XDIAG_ZREF
523 DIAG_SURF_ATM_MODEL(KFROM)%XDIAG_TRAD=>XDIAG_TRAD
524 DIAG_SURF_ATM_MODEL(KFROM)%XDIAG_EMIS=>XDIAG_EMIS
525 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_RNC=>XAVG_RNC
526 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_HC=>XAVG_HC
527 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LEC=>XAVG_LEC
528 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LEIC=>XAVG_LEIC
529 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_GFLUXC=>XAVG_GFLUXC
530 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SWDC=>XAVG_SWDC
531 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_SWUC=>XAVG_SWUC
532 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LWDC=>XAVG_LWDC
533 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_LWUC=>XAVG_LWUC
534 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_FMUC=>XAVG_FMUC
535 DIAG_SURF_ATM_MODEL(KFROM)%XAVG_FMVC=>XAVG_FMVC
536 !
537 DIAG_SURF_ATM_MODEL(KFROM)%XRW_RAIN=>XRW_RAIN
538 DIAG_SURF_ATM_MODEL(KFROM)%XRW_SNOW=>XRW_SNOW
539 ENDIF
540 !
541 ! Current model is set to model KTO
542 IF (LHOOK) CALL DR_HOOK('MODD_DIAG_SURF_ATM_N:DIAG_SURF_ATM_GOTO_MODEL',0,ZHOOK_HANDLE)
543 XDIAG_TSTEP=>DIAG_SURF_ATM_MODEL(KTO)%XDIAG_TSTEP
544 N2M=>DIAG_SURF_ATM_MODEL(KTO)%N2M
545 L2M_MIN_ZS=>DIAG_SURF_ATM_MODEL(KTO)%L2M_MIN_ZS
546 LSURF_BUDGET=>DIAG_SURF_ATM_MODEL(KTO)%LSURF_BUDGET
547 LRAD_BUDGET=>DIAG_SURF_ATM_MODEL(KTO)%LRAD_BUDGET
548 LCOEF=>DIAG_SURF_ATM_MODEL(KTO)%LCOEF
549 LSURF_VARS=>DIAG_SURF_ATM_MODEL(KTO)%LSURF_VARS
550 LFRAC=>DIAG_SURF_ATM_MODEL(KTO)%LFRAC
551 LDIAG_GRID=>DIAG_SURF_ATM_MODEL(KTO)%LDIAG_GRID
552 LSURF_BUDGETC=>DIAG_SURF_ATM_MODEL(KTO)%LSURF_BUDGETC
553 LRESET_BUDGETC=>DIAG_SURF_ATM_MODEL(KTO)%LRESET_BUDGETC
554 LREAD_BUDGETC=>DIAG_SURF_ATM_MODEL(KTO)%LREAD_BUDGETC
555 LPROVAR_TO_DIAG=>DIAG_SURF_ATM_MODEL(KTO)%LPROVAR_TO_DIAG
556 LSELECT=>DIAG_SURF_ATM_MODEL(KTO)%LSELECT
557 CSELECT=>DIAG_SURF_ATM_MODEL(KTO)%CSELECT
558 TIME_BUDGETC=>DIAG_SURF_ATM_MODEL(KTO)%TIME_BUDGETC
559 XRI_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XRI_TILE
560 XCD_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XCD_TILE
561 XCH_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XCH_TILE
562 XCE_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XCE_TILE
563 XRN_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XRN_TILE
564 XH_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XH_TILE
565 XLE_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLE_TILE
566 XLEI_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLEI_TILE
567 XGFLUX_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XGFLUX_TILE
568 XTS_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XTS_TILE
569 XT2M_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XT2M_TILE
570 XT2M_MIN_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XT2M_MIN_TILE
571 XT2M_MAX_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XT2M_MAX_TILE
572 XQ2M_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XQ2M_TILE
573 XHU2M_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XHU2M_TILE
574 XHU2M_MIN_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XHU2M_MIN_TILE
575 XHU2M_MAX_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XHU2M_MAX_TILE
576 XZON10M_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XZON10M_TILE
577 XMER10M_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XMER10M_TILE
578 XWIND10M_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XWIND10M_TILE
579 XWIND10M_MAX_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XWIND10M_MAX_TILE
580 XQS_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XQS_TILE
581 XZ0_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XZ0_TILE
582 XZ0H_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XZ0H_TILE
583 XSWD_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XSWD_TILE
584 XSWU_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XSWU_TILE
585 XLWD_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLWD_TILE
586 XLWU_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLWU_TILE
587 XSWBD_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XSWBD_TILE
588 XSWBU_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XSWBU_TILE
589 XFMU_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XFMU_TILE
590 XFMV_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XFMV_TILE
591 XRNC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XRNC_TILE
592 XHC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XHC_TILE
593 XLEC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLEC_TILE
594 XLEIC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLEIC_TILE
595 XGFLUXC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XGFLUXC_TILE
596 XSWDC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XSWDC_TILE
597 XSWUC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XSWUC_TILE
598 XLWDC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLWDC_TILE
599 XLWUC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XLWUC_TILE
600 XFMUC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XFMUC_TILE
601 XFMVC_TILE=>DIAG_SURF_ATM_MODEL(KTO)%XFMVC_TILE
602 XAVG_RI=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_RI
603 XAVG_CD=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_CD
604 XAVG_CH=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_CH
605 XAVG_CE=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_CE
606 XAVG_RN=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_RN
607 XAVG_H=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_H
608 XAVG_LE=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LE
609 XAVG_LEI=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LEI
610 XAVG_GFLUX=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_GFLUX
611 XAVG_TS=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_TS
612 XAVG_T2M=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_T2M
613 XAVG_T2M_MIN=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_T2M_MIN
614 XAVG_T2M_MAX=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_T2M_MAX
615 XAVG_Q2M=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_Q2M
616 XAVG_HU2M=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_HU2M
617 XAVG_HU2M_MIN=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_HU2M_MIN
618 XAVG_HU2M_MAX=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_HU2M_MAX
619 XAVG_ZON10M=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_ZON10M
620 XAVG_MER10M=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_MER10M
621 XAVG_WIND10M=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_WIND10M
622 XAVG_WIND10M_MAX=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_WIND10M_MAX
623 XAVG_SFCO2=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SFCO2
624 XAVG_T2M_MIN_ZS=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_T2M_MIN_ZS
625 XAVG_Q2M_MIN_ZS=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_Q2M_MIN_ZS
626 XAVG_HU2M_MIN_ZS=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_HU2M_MIN_ZS
627 XPS=>DIAG_SURF_ATM_MODEL(KTO)%XPS
628 XRHOA=>DIAG_SURF_ATM_MODEL(KTO)%XRHOA
629 XAVG_QS=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_QS
630 XAVG_Z0=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_Z0
631 XAVG_Z0H=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_Z0H
632 XAVG_SWD=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SWD
633 XAVG_SWU=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SWU
634 XAVG_LWD=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LWD
635 XAVG_LWU=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LWU
636 XAVG_SWBD=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SWBD
637 XAVG_SWBU=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SWBU
638 XAVG_FMU=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_FMU
639 XAVG_FMV=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_FMV
640 XSSO_FMU=>DIAG_SURF_ATM_MODEL(KTO)%XSSO_FMU
641 XSSO_FMV=>DIAG_SURF_ATM_MODEL(KTO)%XSSO_FMV
642 XDIAG_UREF=>DIAG_SURF_ATM_MODEL(KTO)%XDIAG_UREF
643 XDIAG_ZREF=>DIAG_SURF_ATM_MODEL(KTO)%XDIAG_ZREF
644 XDIAG_TRAD=>DIAG_SURF_ATM_MODEL(KTO)%XDIAG_TRAD
645 XDIAG_EMIS=>DIAG_SURF_ATM_MODEL(KTO)%XDIAG_EMIS
646 XAVG_RNC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_RNC
647 XAVG_HC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_HC
648 XAVG_LEC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LEC
649 XAVG_LEIC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LEIC
650 XAVG_GFLUXC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_GFLUXC
651 XAVG_SWDC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SWDC
652 XAVG_SWUC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_SWUC
653 XAVG_LWDC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LWDC
654 XAVG_LWUC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_LWUC
655 XAVG_FMUC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_FMUC
656 XAVG_FMVC=>DIAG_SURF_ATM_MODEL(KTO)%XAVG_FMVC
657 !
658 XRW_RAIN=>DIAG_SURF_ATM_MODEL(KTO)%XRW_RAIN
659 XRW_SNOW=>DIAG_SURF_ATM_MODEL(KTO)%XRW_SNOW
660 IF (LHOOK) CALL DR_HOOK('MODD_DIAG_SURF_ATM_N:DIAG_SURF_ATM_GOTO_MODEL',1,ZHOOK_HANDLE)
661 !
662 END SUBROUTINE DIAG_SURF_ATM_GOTO_MODEL
663
664 SUBROUTINE DIAG_SURF_ATM_ALLOC(KMODEL)
665 INTEGER, INTENT(IN) :: KMODEL
666 INTEGER :: J
667 REAL(KIND=JPRB) :: ZHOOK_HANDLE
668 IF (LHOOK) CALL DR_HOOK("MODD_DIAG_SURF_ATM_N:DIAG_SURF_ATM_ALLOC",0,ZHOOK_HANDLE)
669 ALLOCATE(DIAG_SURF_ATM_MODEL(KMODEL))
670 DO J=1,KMODEL
671   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XRI_TILE)
672   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XCD_TILE)
673   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XCH_TILE)
674   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XCE_TILE)
675   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XRN_TILE)
676   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XH_TILE)
677   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLE_TILE)
678   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLEI_TILE)
679   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XGFLUX_TILE)
680   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XTS_TILE)
681   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XT2M_TILE)
682   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XT2M_MIN_TILE)
683   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XT2M_MAX_TILE)
684   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XQ2M_TILE)
685   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XHU2M_TILE)
686   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XHU2M_MIN_TILE)
687   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XHU2M_MAX_TILE)
688   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XZON10M_TILE)
689   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XMER10M_TILE)
690   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XWIND10M_TILE)
691   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XWIND10M_MAX_TILE)
692   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XQS_TILE)
693   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XZ0_TILE)
694   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XZ0H_TILE)
695   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSWD_TILE)
696   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSWU_TILE)
697   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLWD_TILE)
698   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLWU_TILE)
699   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSWBD_TILE)
700   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSWBU_TILE)
701   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XFMU_TILE)
702   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XFMV_TILE)
703   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XRNC_TILE)
704   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XHC_TILE)
705   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLEC_TILE)
706   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLEIC_TILE)
707   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XGFLUXC_TILE)
708   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSWDC_TILE)
709   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSWUC_TILE)
710   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLWDC_TILE)
711   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XLWUC_TILE)
712   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XFMUC_TILE)
713   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XFMVC_TILE)
714   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_RI)
715   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_CD)
716   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_CH)
717   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_CE)
718   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_RN)
719   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_H)
720   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LE)
721   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LEI)
722   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_GFLUX)
723   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_TS)
724   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_T2M)
725   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_Q2M)
726   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_HU2M)
727   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_ZON10M)
728   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_MER10M)
729   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SFCO2)
730   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_T2M_MIN_ZS)
731   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_Q2M_MIN_ZS)
732   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_HU2M_MIN_ZS)
733   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XPS)
734   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XRHOA)
735   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_QS)
736   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_Z0)
737   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_Z0H)
738   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SWD)
739   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SWU)
740   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LWD)
741   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LWU)
742   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SWBD)
743   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SWBU)
744   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_FMU)
745   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_FMV)
746   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSSO_FMU)
747   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XSSO_FMV)
748   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XDIAG_UREF)
749   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XDIAG_ZREF)
750   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XDIAG_TRAD)
751   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XDIAG_EMIS)
752   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_T2M_MIN)
753   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_T2M_MAX)
754   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_HU2M_MIN)
755   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_HU2M_MAX)
756   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_WIND10M)
757   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_WIND10M_MAX)
758   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_RNC)
759   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_HC)
760   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LEC)
761   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LEIC)
762   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_GFLUXC)
763   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SWDC)
764   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_SWUC)
765   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LWDC)
766   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_LWUC)
767   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_FMUC)
768   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XAVG_FMVC)
769   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XRW_RAIN)
770   NULLIFY(DIAG_SURF_ATM_MODEL(J)%XRW_SNOW)
771   NULLIFY(DIAG_SURF_ATM_MODEL(J)%CSELECT)
772 ENDDO
773 DIAG_SURF_ATM_MODEL(:)%XDIAG_TSTEP=0.
774 DIAG_SURF_ATM_MODEL(:)%N2M=0
775 DIAG_SURF_ATM_MODEL(:)%L2M_MIN_ZS=.FALSE.
776 DIAG_SURF_ATM_MODEL(:)%LSURF_BUDGET=.FALSE.
777 DIAG_SURF_ATM_MODEL(:)%LRAD_BUDGET=.FALSE.
778 DIAG_SURF_ATM_MODEL(:)%LCOEF=.FALSE.
779 DIAG_SURF_ATM_MODEL(:)%LSURF_VARS=.FALSE.
780 DIAG_SURF_ATM_MODEL(:)%LFRAC=.FALSE.
781 DIAG_SURF_ATM_MODEL(:)%LDIAG_GRID=.FALSE.
782 DIAG_SURF_ATM_MODEL(:)%LSURF_BUDGETC=.FALSE.
783 DIAG_SURF_ATM_MODEL(:)%LRESET_BUDGETC=.FALSE.
784 DIAG_SURF_ATM_MODEL(:)%LREAD_BUDGETC=.FALSE.
785 DIAG_SURF_ATM_MODEL(:)%LPROVAR_TO_DIAG=.FALSE.
786 DIAG_SURF_ATM_MODEL(:)%LSELECT=.FALSE.
787 IF (LHOOK) CALL DR_HOOK("MODD_DIAG_SURF_ATM_N:DIAG_SURF_ATM_ALLOC",1,ZHOOK_HANDLE)
788 END SUBROUTINE DIAG_SURF_ATM_ALLOC
789
790 SUBROUTINE DIAG_SURF_ATM_DEALLO
791 REAL(KIND=JPRB) :: ZHOOK_HANDLE
792 IF (LHOOK) CALL DR_HOOK("MODD_DIAG_SURF_ATM_N:DIAG_SURF_ATM_DEALLO",0,ZHOOK_HANDLE)
793 IF (ALLOCATED(DIAG_SURF_ATM_MODEL)) DEALLOCATE(DIAG_SURF_ATM_MODEL)
794 IF (LHOOK) CALL DR_HOOK("MODD_DIAG_SURF_ATM_N:DIAG_SURF_ATM_DEALLO",1,ZHOOK_HANDLE)
795 END SUBROUTINE DIAG_SURF_ATM_DEALLO
796
797 END MODULE MODD_DIAG_SURF_ATM_n