1 | !> @file sum_up_3d_data.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
6 | ! terms of the GNU General Public License as published by the Free Software |
---|
7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
8 | ! version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: sum_up_3d_data.f90 3151 2018-07-19 08:45:38Z witha $ |
---|
27 | ! Remaining preprocessor directive __chem removed |
---|
28 | ! |
---|
29 | ! 3004 2018-04-27 12:33:25Z Giersch |
---|
30 | ! prr field added to ONLY-list, prr* case/pr* case/precipitation_rate_av |
---|
31 | ! removed, further allocation checks implemented |
---|
32 | ! |
---|
33 | ! 2963 2018-04-12 14:47:44Z suehring |
---|
34 | ! Introduce index for vegetation/wall, pavement/green-wall and water/window |
---|
35 | ! surfaces, for clearer access of surface fraction, albedo, emissivity, etc. . |
---|
36 | ! |
---|
37 | ! 2894 2018-03-15 09:17:58Z Giersch |
---|
38 | ! Changed comment |
---|
39 | ! |
---|
40 | ! 2817 2018-02-19 16:32:21Z suehring |
---|
41 | ! Preliminary gust module interface implemented |
---|
42 | ! |
---|
43 | ! 2798 2018-02-09 17:16:39Z suehring |
---|
44 | ! Consider also default-type surfaces for surface temperature output. |
---|
45 | ! |
---|
46 | ! 2797 2018-02-08 13:24:35Z suehring |
---|
47 | ! Enable output of ground-heat flux also at urban surfaces. |
---|
48 | ! |
---|
49 | ! 2790 2018-02-06 11:57:19Z suehring |
---|
50 | ! Bugfix in summation of surface sensible and latent heat flux |
---|
51 | ! |
---|
52 | ! 2766 2018-01-22 17:17:47Z kanani |
---|
53 | ! Removed preprocessor directive __chem |
---|
54 | ! |
---|
55 | ! 2743 2018-01-12 16:03:39Z suehring |
---|
56 | ! In case of natural- and urban-type surfaces output surfaces fluxes in W/m2. |
---|
57 | ! |
---|
58 | ! 2742 2018-01-12 14:59:47Z suehring |
---|
59 | ! Enable output of surface temperature |
---|
60 | ! |
---|
61 | ! 2735 2018-01-11 12:01:27Z suehring |
---|
62 | ! output of r_a moved from land-surface to consider also urban-type surfaces |
---|
63 | ! |
---|
64 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
65 | ! Corrected "Former revisions" section |
---|
66 | ! |
---|
67 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
68 | ! - Change in file header (GPL part) |
---|
69 | ! - Implementation of uv exposure model (FK) |
---|
70 | ! - output of diss_av, kh_av, km_av (turbulence_closure_mod) (TG) |
---|
71 | ! - Implementation of chemistry module (FK) |
---|
72 | ! - Workaround for sum-up usm arrays in case of restart runs, to avoid program |
---|
73 | ! crash (MS) |
---|
74 | ! |
---|
75 | ! 2292 2017-06-20 09:51:42Z schwenkel |
---|
76 | ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' |
---|
77 | ! includes two more prognostic equations for cloud drop concentration (nc) |
---|
78 | ! and cloud water content (qc). |
---|
79 | ! |
---|
80 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
81 | ! |
---|
82 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
83 | ! Adjustments to new surface concept |
---|
84 | ! |
---|
85 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
86 | ! renamed variable rho to rho_ocean and rho_av to rho_ocean_av |
---|
87 | ! |
---|
88 | ! 2024 2016-10-12 16:42:37Z kanani |
---|
89 | ! Added missing CASE for ssws* |
---|
90 | ! |
---|
91 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
92 | ! Flag urban_surface is now defined in module control_parameters, |
---|
93 | ! changed prefix for urban surface model output to "usm_", |
---|
94 | ! introduced control parameter varnamelength for LEN of trimvar. |
---|
95 | ! |
---|
96 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
97 | ! Added support for new urban surface model (temporary modifications of |
---|
98 | ! SELECT CASE ( ) necessary, see variable trimvar), |
---|
99 | ! added comments in variable declaration section |
---|
100 | ! |
---|
101 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
102 | ! Forced header and separation lines into 80 columns |
---|
103 | ! |
---|
104 | ! 1992 2016-08-12 15:14:59Z suehring |
---|
105 | ! Bugfix in summation of passive scalar |
---|
106 | ! |
---|
107 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
108 | ! Radiation actions are now done directly in the respective module |
---|
109 | ! |
---|
110 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
111 | ! Land surface actions are now done directly in the respective module |
---|
112 | ! |
---|
113 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
114 | ! Scalar surface flux added |
---|
115 | ! |
---|
116 | ! 1949 2016-06-17 07:19:16Z maronga |
---|
117 | ! Bugfix: calculation of lai_av, c_veg_av and c_liq_av. |
---|
118 | ! |
---|
119 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
120 | ! precipitation_rate moved to arrays_3d |
---|
121 | ! |
---|
122 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
123 | ! Added z0q and z0q_av |
---|
124 | ! |
---|
125 | ! 1693 2015-10-27 08:35:45Z maronga |
---|
126 | ! Last revision text corrected |
---|
127 | ! |
---|
128 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
129 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
130 | ! Corrected output of liquid water path. |
---|
131 | ! |
---|
132 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
133 | ! Code annotations made doxygen readable |
---|
134 | ! |
---|
135 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
136 | ! Adapted for RRTMG |
---|
137 | ! |
---|
138 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
139 | ! Added output of r_a and r_s |
---|
140 | ! |
---|
141 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
142 | ! Added support for land surface model and radiation model data. |
---|
143 | ! |
---|
144 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
145 | ! New particle structure integrated. |
---|
146 | ! |
---|
147 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
148 | ! REAL constants provided with KIND-attribute |
---|
149 | ! |
---|
150 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
151 | ! ONLY-attribute added to USE-statements, |
---|
152 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
153 | ! kinds are defined in new module kinds, |
---|
154 | ! old module precision_kind is removed, |
---|
155 | ! revision history before 2012 removed, |
---|
156 | ! comment fields (!:) to be used for variable explanations added to |
---|
157 | ! all variable declaration statements |
---|
158 | ! |
---|
159 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
160 | ! barrier argument removed from cpu_log, |
---|
161 | ! module interfaces removed |
---|
162 | ! |
---|
163 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
164 | ! ql is calculated by calc_liquid_water_content |
---|
165 | ! |
---|
166 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
167 | ! +nr, prr, qr |
---|
168 | ! |
---|
169 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
170 | ! code put under GPL (PALM 3.9) |
---|
171 | ! |
---|
172 | ! 1007 2012-09-19 14:30:36Z franke |
---|
173 | ! Bugfix in calculation of ql_vp |
---|
174 | ! |
---|
175 | ! 978 2012-08-09 08:28:32Z fricke |
---|
176 | ! +z0h* |
---|
177 | ! |
---|
178 | ! Revision 1.1 2006/02/23 12:55:23 raasch |
---|
179 | ! Initial revision |
---|
180 | ! |
---|
181 | ! |
---|
182 | ! Description: |
---|
183 | ! ------------ |
---|
184 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine |
---|
185 | !> average_3d_data. |
---|
186 | !------------------------------------------------------------------------------! |
---|
187 | SUBROUTINE sum_up_3d_data |
---|
188 | |
---|
189 | |
---|
190 | USE arrays_3d, & |
---|
191 | ONLY: dzw, e, heatflux_output_conversion, nc, nr, p, prr, pt, & |
---|
192 | q, qc, ql, ql_c, ql_v, qr, rho_ocean, s, sa, u, v, vpt, w, & |
---|
193 | waterflux_output_conversion |
---|
194 | |
---|
195 | USE averaging, & |
---|
196 | ONLY: diss_av, e_av, ghf_av, kh_av, km_av, lpt_av, lwp_av, nc_av, & |
---|
197 | nr_av, & |
---|
198 | ol_av, p_av, pc_av, pr_av, prr_av, pt_av, q_av, qc_av, ql_av, & |
---|
199 | ql_c_av, ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, r_a_av, & |
---|
200 | rho_ocean_av, s_av, sa_av, shf_av, ssws_av, ts_av, tsurf_av, & |
---|
201 | u_av, us_av, v_av, vpt_av, w_av, z0_av, z0h_av, z0q_av |
---|
202 | USE chemistry_model_mod, & |
---|
203 | ONLY: chem_3d_data_averaging, chem_integrate, chem_species, nspec |
---|
204 | |
---|
205 | USE cloud_parameters, & |
---|
206 | ONLY: cp, l_d_cp, l_v, pt_d_t |
---|
207 | |
---|
208 | USE control_parameters, & |
---|
209 | ONLY: air_chemistry, average_count_3d, cloud_physics, doav, doav_n, & |
---|
210 | land_surface, rho_surface, urban_surface, uv_exposure, & |
---|
211 | varnamelength |
---|
212 | |
---|
213 | USE cpulog, & |
---|
214 | ONLY: cpu_log, log_point |
---|
215 | |
---|
216 | USE gust_mod, & |
---|
217 | ONLY: gust_3d_data_averaging, gust_module_enabled |
---|
218 | |
---|
219 | USE indices, & |
---|
220 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
221 | |
---|
222 | USE kinds |
---|
223 | |
---|
224 | USE land_surface_model_mod, & |
---|
225 | ONLY: lsm_3d_data_averaging |
---|
226 | |
---|
227 | USE particle_attributes, & |
---|
228 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
229 | |
---|
230 | USE radiation_model_mod, & |
---|
231 | ONLY: radiation, radiation_3d_data_averaging |
---|
232 | |
---|
233 | USE surface_mod, & |
---|
234 | ONLY: ind_pav_green, ind_veg_wall, ind_wat_win, & |
---|
235 | surf_def_h, surf_lsm_h, surf_usm_h |
---|
236 | |
---|
237 | USE turbulence_closure_mod, & |
---|
238 | ONLY: tcm_3d_data_averaging |
---|
239 | |
---|
240 | USE urban_surface_mod, & |
---|
241 | ONLY: usm_average_3d_data |
---|
242 | |
---|
243 | USE uv_exposure_model_mod, & |
---|
244 | ONLY: uvem_3d_data_averaging |
---|
245 | |
---|
246 | |
---|
247 | IMPLICIT NONE |
---|
248 | |
---|
249 | INTEGER(iwp) :: i !< grid index x direction |
---|
250 | INTEGER(iwp) :: ii !< running index |
---|
251 | INTEGER(iwp) :: j !< grid index y direction |
---|
252 | INTEGER(iwp) :: k !< grid index x direction |
---|
253 | INTEGER(iwp) :: m !< running index surface type |
---|
254 | INTEGER(iwp) :: n !< |
---|
255 | |
---|
256 | REAL(wp) :: mean_r !< |
---|
257 | REAL(wp) :: s_r2 !< |
---|
258 | REAL(wp) :: s_r3 !< |
---|
259 | |
---|
260 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
261 | |
---|
262 | |
---|
263 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
264 | |
---|
265 | ! |
---|
266 | !-- Allocate and initialize the summation arrays if called for the very first |
---|
267 | !-- time or the first time after average_3d_data has been called |
---|
268 | !-- (some or all of the arrays may have been already allocated |
---|
269 | !-- in rrd_local) |
---|
270 | IF ( average_count_3d == 0 ) THEN |
---|
271 | |
---|
272 | DO ii = 1, doav_n |
---|
273 | ! |
---|
274 | !-- Temporary solution to account for data output within the new urban |
---|
275 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
276 | trimvar = TRIM( doav(ii) ) |
---|
277 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
278 | trimvar = 'usm_output' |
---|
279 | ENDIF |
---|
280 | |
---|
281 | SELECT CASE ( trimvar ) |
---|
282 | |
---|
283 | CASE ( 'ghf*' ) |
---|
284 | IF ( .NOT. ALLOCATED( ghf_av ) ) THEN |
---|
285 | ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) ) |
---|
286 | ENDIF |
---|
287 | ghf_av = 0.0_wp |
---|
288 | |
---|
289 | CASE ( 'e' ) |
---|
290 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
291 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
292 | ENDIF |
---|
293 | e_av = 0.0_wp |
---|
294 | |
---|
295 | CASE ( 'lpt' ) |
---|
296 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
297 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
298 | ENDIF |
---|
299 | lpt_av = 0.0_wp |
---|
300 | |
---|
301 | CASE ( 'lwp*' ) |
---|
302 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
303 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
304 | ENDIF |
---|
305 | lwp_av = 0.0_wp |
---|
306 | |
---|
307 | CASE ( 'nc' ) |
---|
308 | IF ( .NOT. ALLOCATED( nc_av ) ) THEN |
---|
309 | ALLOCATE( nc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
310 | ENDIF |
---|
311 | nc_av = 0.0_wp |
---|
312 | |
---|
313 | CASE ( 'nr' ) |
---|
314 | IF ( .NOT. ALLOCATED( nr_av ) ) THEN |
---|
315 | ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
316 | ENDIF |
---|
317 | nr_av = 0.0_wp |
---|
318 | |
---|
319 | CASE ( 'ol*' ) |
---|
320 | IF ( .NOT. ALLOCATED( ol_av ) ) THEN |
---|
321 | ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) ) |
---|
322 | ENDIF |
---|
323 | ol_av = 0.0_wp |
---|
324 | |
---|
325 | CASE ( 'p' ) |
---|
326 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
327 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
328 | ENDIF |
---|
329 | p_av = 0.0_wp |
---|
330 | |
---|
331 | CASE ( 'pc' ) |
---|
332 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
333 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
334 | ENDIF |
---|
335 | pc_av = 0.0_wp |
---|
336 | |
---|
337 | CASE ( 'pr' ) |
---|
338 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
339 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
340 | ENDIF |
---|
341 | pr_av = 0.0_wp |
---|
342 | |
---|
343 | CASE ( 'prr' ) |
---|
344 | IF ( .NOT. ALLOCATED( prr_av ) ) THEN |
---|
345 | ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
346 | ENDIF |
---|
347 | prr_av = 0.0_wp |
---|
348 | |
---|
349 | CASE ( 'pt' ) |
---|
350 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
351 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
352 | ENDIF |
---|
353 | pt_av = 0.0_wp |
---|
354 | |
---|
355 | CASE ( 'q' ) |
---|
356 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
357 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
358 | ENDIF |
---|
359 | q_av = 0.0_wp |
---|
360 | |
---|
361 | CASE ( 'qc' ) |
---|
362 | IF ( .NOT. ALLOCATED( qc_av ) ) THEN |
---|
363 | ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
364 | ENDIF |
---|
365 | qc_av = 0.0_wp |
---|
366 | |
---|
367 | CASE ( 'ql' ) |
---|
368 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
369 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
370 | ENDIF |
---|
371 | ql_av = 0.0_wp |
---|
372 | |
---|
373 | CASE ( 'ql_c' ) |
---|
374 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
375 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
376 | ENDIF |
---|
377 | ql_c_av = 0.0_wp |
---|
378 | |
---|
379 | CASE ( 'ql_v' ) |
---|
380 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
381 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
382 | ENDIF |
---|
383 | ql_v_av = 0.0_wp |
---|
384 | |
---|
385 | CASE ( 'ql_vp' ) |
---|
386 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
387 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
388 | ENDIF |
---|
389 | ql_vp_av = 0.0_wp |
---|
390 | |
---|
391 | CASE ( 'qr' ) |
---|
392 | IF ( .NOT. ALLOCATED( qr_av ) ) THEN |
---|
393 | ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
394 | ENDIF |
---|
395 | qr_av = 0.0_wp |
---|
396 | |
---|
397 | CASE ( 'qsws*' ) |
---|
398 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
399 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
400 | ENDIF |
---|
401 | qsws_av = 0.0_wp |
---|
402 | |
---|
403 | CASE ( 'qv' ) |
---|
404 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
405 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
406 | ENDIF |
---|
407 | qv_av = 0.0_wp |
---|
408 | |
---|
409 | CASE ( 'r_a*' ) |
---|
410 | IF ( .NOT. ALLOCATED( r_a_av ) ) THEN |
---|
411 | ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) ) |
---|
412 | ENDIF |
---|
413 | r_a_av = 0.0_wp |
---|
414 | |
---|
415 | CASE ( 'rho_ocean' ) |
---|
416 | IF ( .NOT. ALLOCATED( rho_ocean_av ) ) THEN |
---|
417 | ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
418 | ENDIF |
---|
419 | rho_ocean_av = 0.0_wp |
---|
420 | |
---|
421 | CASE ( 's' ) |
---|
422 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
423 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
424 | ENDIF |
---|
425 | s_av = 0.0_wp |
---|
426 | |
---|
427 | CASE ( 'sa' ) |
---|
428 | IF ( .NOT. ALLOCATED( sa_av ) ) THEN |
---|
429 | ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
430 | ENDIF |
---|
431 | sa_av = 0.0_wp |
---|
432 | |
---|
433 | CASE ( 'shf*' ) |
---|
434 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
435 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
436 | ENDIF |
---|
437 | shf_av = 0.0_wp |
---|
438 | |
---|
439 | CASE ( 'ssws*' ) |
---|
440 | IF ( .NOT. ALLOCATED( ssws_av ) ) THEN |
---|
441 | ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) ) |
---|
442 | ENDIF |
---|
443 | ssws_av = 0.0_wp |
---|
444 | |
---|
445 | CASE ( 't*' ) |
---|
446 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
447 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
448 | ENDIF |
---|
449 | ts_av = 0.0_wp |
---|
450 | |
---|
451 | CASE ( 'tsurf*' ) |
---|
452 | IF ( .NOT. ALLOCATED( tsurf_av ) ) THEN |
---|
453 | ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) ) |
---|
454 | ENDIF |
---|
455 | tsurf_av = 0.0_wp |
---|
456 | |
---|
457 | CASE ( 'u' ) |
---|
458 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
459 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
460 | ENDIF |
---|
461 | u_av = 0.0_wp |
---|
462 | |
---|
463 | CASE ( 'u*' ) |
---|
464 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
465 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
466 | ENDIF |
---|
467 | us_av = 0.0_wp |
---|
468 | |
---|
469 | CASE ( 'v' ) |
---|
470 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
471 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
472 | ENDIF |
---|
473 | v_av = 0.0_wp |
---|
474 | |
---|
475 | CASE ( 'vpt' ) |
---|
476 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
477 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
478 | ENDIF |
---|
479 | vpt_av = 0.0_wp |
---|
480 | |
---|
481 | CASE ( 'w' ) |
---|
482 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
483 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
484 | ENDIF |
---|
485 | w_av = 0.0_wp |
---|
486 | |
---|
487 | CASE ( 'z0*' ) |
---|
488 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
489 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
490 | ENDIF |
---|
491 | z0_av = 0.0_wp |
---|
492 | |
---|
493 | CASE ( 'z0h*' ) |
---|
494 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
495 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
496 | ENDIF |
---|
497 | z0h_av = 0.0_wp |
---|
498 | |
---|
499 | CASE ( 'z0q*' ) |
---|
500 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
501 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
502 | ENDIF |
---|
503 | z0q_av = 0.0_wp |
---|
504 | ! |
---|
505 | !-- Block of urban surface model outputs |
---|
506 | CASE ( 'usm_output' ) |
---|
507 | |
---|
508 | CALL usm_average_3d_data( 'allocate', doav(ii) ) |
---|
509 | |
---|
510 | |
---|
511 | CASE DEFAULT |
---|
512 | |
---|
513 | ! |
---|
514 | !-- Turbulence closure module |
---|
515 | CALL tcm_3d_data_averaging( 'allocate', doav(ii) ) |
---|
516 | |
---|
517 | ! |
---|
518 | !-- Land surface quantity |
---|
519 | IF ( land_surface ) THEN |
---|
520 | CALL lsm_3d_data_averaging( 'allocate', doav(ii) ) |
---|
521 | ENDIF |
---|
522 | |
---|
523 | ! |
---|
524 | !-- Radiation quantity |
---|
525 | IF ( radiation ) THEN |
---|
526 | CALL radiation_3d_data_averaging( 'allocate', doav(ii) ) |
---|
527 | ENDIF |
---|
528 | |
---|
529 | ! |
---|
530 | !-- Gust module quantities |
---|
531 | IF ( gust_module_enabled ) THEN |
---|
532 | CALL gust_3d_data_averaging( 'allocate', doav(ii) ) |
---|
533 | ENDIF |
---|
534 | |
---|
535 | ! |
---|
536 | !-- Chemical quantity |
---|
537 | IF ( air_chemistry .AND. trimvar(1:3) == 'kc_') THEN |
---|
538 | CALL chem_3d_data_averaging( 'allocate', doav(ii) ) |
---|
539 | ENDIF |
---|
540 | |
---|
541 | ! |
---|
542 | !-- UV exposure quantity |
---|
543 | IF ( uv_exposure .AND. trimvar(1:5) == 'uvem_') THEN |
---|
544 | CALL uvem_3d_data_averaging( 'allocate', doav(ii) ) |
---|
545 | ENDIF |
---|
546 | |
---|
547 | ! |
---|
548 | !-- User-defined quantity |
---|
549 | CALL user_3d_data_averaging( 'allocate', doav(ii) ) |
---|
550 | |
---|
551 | END SELECT |
---|
552 | |
---|
553 | ENDDO |
---|
554 | |
---|
555 | ENDIF |
---|
556 | |
---|
557 | ! |
---|
558 | !-- Loop of all variables to be averaged. |
---|
559 | DO ii = 1, doav_n |
---|
560 | ! |
---|
561 | !-- Temporary solution to account for data output within the new urban |
---|
562 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
563 | trimvar = TRIM( doav(ii) ) |
---|
564 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
565 | trimvar = 'usm_output' |
---|
566 | ENDIF |
---|
567 | ! |
---|
568 | !-- Store the array chosen on the temporary array. |
---|
569 | SELECT CASE ( trimvar ) |
---|
570 | |
---|
571 | CASE ( 'ghf*' ) |
---|
572 | IF ( ALLOCATED( ghf_av ) ) THEN |
---|
573 | DO m = 1, surf_lsm_h%ns |
---|
574 | i = surf_lsm_h%i(m) |
---|
575 | j = surf_lsm_h%j(m) |
---|
576 | ghf_av(j,i) = ghf_av(j,i) + surf_lsm_h%ghf(m) |
---|
577 | ENDDO |
---|
578 | |
---|
579 | DO m = 1, surf_usm_h%ns |
---|
580 | i = surf_usm_h%i(m) |
---|
581 | j = surf_usm_h%j(m) |
---|
582 | ghf_av(j,i) = ghf_av(j,i) + surf_usm_h%frac(ind_veg_wall,m) * & |
---|
583 | surf_usm_h%wghf_eb(m) + & |
---|
584 | surf_usm_h%frac(ind_pav_green,m) * & |
---|
585 | surf_usm_h%wghf_eb_green(m) + & |
---|
586 | surf_usm_h%frac(ind_wat_win,m) * & |
---|
587 | surf_usm_h%wghf_eb_window(m) |
---|
588 | ENDDO |
---|
589 | ENDIF |
---|
590 | |
---|
591 | CASE ( 'e' ) |
---|
592 | IF ( ALLOCATED( e_av ) ) THEN |
---|
593 | DO i = nxlg, nxrg |
---|
594 | DO j = nysg, nyng |
---|
595 | DO k = nzb, nzt+1 |
---|
596 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
597 | ENDDO |
---|
598 | ENDDO |
---|
599 | ENDDO |
---|
600 | ENDIF |
---|
601 | |
---|
602 | CASE ( 'lpt' ) |
---|
603 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
604 | DO i = nxlg, nxrg |
---|
605 | DO j = nysg, nyng |
---|
606 | DO k = nzb, nzt+1 |
---|
607 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
608 | ENDDO |
---|
609 | ENDDO |
---|
610 | ENDDO |
---|
611 | ENDIF |
---|
612 | |
---|
613 | CASE ( 'lwp*' ) |
---|
614 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
615 | DO i = nxlg, nxrg |
---|
616 | DO j = nysg, nyng |
---|
617 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) & |
---|
618 | * dzw(1:nzt+1) ) * rho_surface |
---|
619 | ENDDO |
---|
620 | ENDDO |
---|
621 | ENDIF |
---|
622 | |
---|
623 | CASE ( 'nc' ) |
---|
624 | IF ( ALLOCATED( nc_av ) ) THEN |
---|
625 | DO i = nxlg, nxrg |
---|
626 | DO j = nysg, nyng |
---|
627 | DO k = nzb, nzt+1 |
---|
628 | nc_av(k,j,i) = nc_av(k,j,i) + nc(k,j,i) |
---|
629 | ENDDO |
---|
630 | ENDDO |
---|
631 | ENDDO |
---|
632 | ENDIF |
---|
633 | |
---|
634 | CASE ( 'nr' ) |
---|
635 | IF ( ALLOCATED( nr_av ) ) THEN |
---|
636 | DO i = nxlg, nxrg |
---|
637 | DO j = nysg, nyng |
---|
638 | DO k = nzb, nzt+1 |
---|
639 | nr_av(k,j,i) = nr_av(k,j,i) + nr(k,j,i) |
---|
640 | ENDDO |
---|
641 | ENDDO |
---|
642 | ENDDO |
---|
643 | ENDIF |
---|
644 | |
---|
645 | CASE ( 'ol*' ) |
---|
646 | IF ( ALLOCATED( ol_av ) ) THEN |
---|
647 | DO m = 1, surf_def_h(0)%ns |
---|
648 | i = surf_def_h(0)%i(m) |
---|
649 | j = surf_def_h(0)%j(m) |
---|
650 | ol_av(j,i) = ol_av(j,i) + surf_def_h(0)%ol(m) |
---|
651 | ENDDO |
---|
652 | DO m = 1, surf_lsm_h%ns |
---|
653 | i = surf_lsm_h%i(m) |
---|
654 | j = surf_lsm_h%j(m) |
---|
655 | ol_av(j,i) = ol_av(j,i) + surf_lsm_h%ol(m) |
---|
656 | ENDDO |
---|
657 | DO m = 1, surf_usm_h%ns |
---|
658 | i = surf_usm_h%i(m) |
---|
659 | j = surf_usm_h%j(m) |
---|
660 | ol_av(j,i) = ol_av(j,i) + surf_usm_h%ol(m) |
---|
661 | ENDDO |
---|
662 | ENDIF |
---|
663 | |
---|
664 | CASE ( 'p' ) |
---|
665 | IF ( ALLOCATED( p_av ) ) THEN |
---|
666 | DO i = nxlg, nxrg |
---|
667 | DO j = nysg, nyng |
---|
668 | DO k = nzb, nzt+1 |
---|
669 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
670 | ENDDO |
---|
671 | ENDDO |
---|
672 | ENDDO |
---|
673 | ENDIF |
---|
674 | |
---|
675 | CASE ( 'pc' ) |
---|
676 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
677 | DO i = nxl, nxr |
---|
678 | DO j = nys, nyn |
---|
679 | DO k = nzb, nzt+1 |
---|
680 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
681 | ENDDO |
---|
682 | ENDDO |
---|
683 | ENDDO |
---|
684 | ENDIF |
---|
685 | |
---|
686 | CASE ( 'pr' ) |
---|
687 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
688 | DO i = nxl, nxr |
---|
689 | DO j = nys, nyn |
---|
690 | DO k = nzb, nzt+1 |
---|
691 | number_of_particles = prt_count(k,j,i) |
---|
692 | IF ( number_of_particles <= 0 ) CYCLE |
---|
693 | particles => & |
---|
694 | grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
695 | s_r2 = 0.0_wp |
---|
696 | s_r3 = 0.0_wp |
---|
697 | |
---|
698 | DO n = 1, number_of_particles |
---|
699 | IF ( particles(n)%particle_mask ) THEN |
---|
700 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
701 | particles(n)%weight_factor |
---|
702 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
703 | particles(n)%weight_factor |
---|
704 | ENDIF |
---|
705 | ENDDO |
---|
706 | |
---|
707 | IF ( s_r2 > 0.0_wp ) THEN |
---|
708 | mean_r = s_r3 / s_r2 |
---|
709 | ELSE |
---|
710 | mean_r = 0.0_wp |
---|
711 | ENDIF |
---|
712 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
713 | ENDDO |
---|
714 | ENDDO |
---|
715 | ENDDO |
---|
716 | ENDIF |
---|
717 | |
---|
718 | CASE ( 'prr' ) |
---|
719 | IF ( ALLOCATED( prr_av ) ) THEN |
---|
720 | DO i = nxlg, nxrg |
---|
721 | DO j = nysg, nyng |
---|
722 | DO k = nzb, nzt+1 |
---|
723 | prr_av(k,j,i) = prr_av(k,j,i) + prr(k,j,i) |
---|
724 | ENDDO |
---|
725 | ENDDO |
---|
726 | ENDDO |
---|
727 | ENDIF |
---|
728 | |
---|
729 | CASE ( 'pt' ) |
---|
730 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
731 | IF ( .NOT. cloud_physics ) THEN |
---|
732 | DO i = nxlg, nxrg |
---|
733 | DO j = nysg, nyng |
---|
734 | DO k = nzb, nzt+1 |
---|
735 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
736 | ENDDO |
---|
737 | ENDDO |
---|
738 | ENDDO |
---|
739 | ELSE |
---|
740 | DO i = nxlg, nxrg |
---|
741 | DO j = nysg, nyng |
---|
742 | DO k = nzb, nzt+1 |
---|
743 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + l_d_cp * & |
---|
744 | pt_d_t(k) * ql(k,j,i) |
---|
745 | ENDDO |
---|
746 | ENDDO |
---|
747 | ENDDO |
---|
748 | ENDIF |
---|
749 | ENDIF |
---|
750 | |
---|
751 | CASE ( 'q' ) |
---|
752 | IF ( ALLOCATED( q_av ) ) THEN |
---|
753 | DO i = nxlg, nxrg |
---|
754 | DO j = nysg, nyng |
---|
755 | DO k = nzb, nzt+1 |
---|
756 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
757 | ENDDO |
---|
758 | ENDDO |
---|
759 | ENDDO |
---|
760 | ENDIF |
---|
761 | |
---|
762 | CASE ( 'qc' ) |
---|
763 | IF ( ALLOCATED( qc_av ) ) THEN |
---|
764 | DO i = nxlg, nxrg |
---|
765 | DO j = nysg, nyng |
---|
766 | DO k = nzb, nzt+1 |
---|
767 | qc_av(k,j,i) = qc_av(k,j,i) + qc(k,j,i) |
---|
768 | ENDDO |
---|
769 | ENDDO |
---|
770 | ENDDO |
---|
771 | ENDIF |
---|
772 | |
---|
773 | CASE ( 'ql' ) |
---|
774 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
775 | DO i = nxlg, nxrg |
---|
776 | DO j = nysg, nyng |
---|
777 | DO k = nzb, nzt+1 |
---|
778 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
779 | ENDDO |
---|
780 | ENDDO |
---|
781 | ENDDO |
---|
782 | ENDIF |
---|
783 | |
---|
784 | CASE ( 'ql_c' ) |
---|
785 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
786 | DO i = nxlg, nxrg |
---|
787 | DO j = nysg, nyng |
---|
788 | DO k = nzb, nzt+1 |
---|
789 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
790 | ENDDO |
---|
791 | ENDDO |
---|
792 | ENDDO |
---|
793 | ENDIF |
---|
794 | |
---|
795 | CASE ( 'ql_v' ) |
---|
796 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
797 | DO i = nxlg, nxrg |
---|
798 | DO j = nysg, nyng |
---|
799 | DO k = nzb, nzt+1 |
---|
800 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
801 | ENDDO |
---|
802 | ENDDO |
---|
803 | ENDDO |
---|
804 | ENDIF |
---|
805 | |
---|
806 | CASE ( 'ql_vp' ) |
---|
807 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
808 | DO i = nxl, nxr |
---|
809 | DO j = nys, nyn |
---|
810 | DO k = nzb, nzt+1 |
---|
811 | number_of_particles = prt_count(k,j,i) |
---|
812 | IF ( number_of_particles <= 0 ) CYCLE |
---|
813 | particles => & |
---|
814 | grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
815 | DO n = 1, number_of_particles |
---|
816 | IF ( particles(n)%particle_mask ) THEN |
---|
817 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
818 | particles(n)%weight_factor / & |
---|
819 | number_of_particles |
---|
820 | ENDIF |
---|
821 | ENDDO |
---|
822 | ENDDO |
---|
823 | ENDDO |
---|
824 | ENDDO |
---|
825 | ENDIF |
---|
826 | |
---|
827 | CASE ( 'qr' ) |
---|
828 | IF ( ALLOCATED( qr_av ) ) THEN |
---|
829 | DO i = nxlg, nxrg |
---|
830 | DO j = nysg, nyng |
---|
831 | DO k = nzb, nzt+1 |
---|
832 | qr_av(k,j,i) = qr_av(k,j,i) + qr(k,j,i) |
---|
833 | ENDDO |
---|
834 | ENDDO |
---|
835 | ENDDO |
---|
836 | ENDIF |
---|
837 | |
---|
838 | CASE ( 'qsws*' ) |
---|
839 | ! |
---|
840 | !-- In case of default surfaces, clean-up flux by density. |
---|
841 | !-- In case of land- and urban-surfaces, convert fluxes into |
---|
842 | !-- dynamic units. |
---|
843 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
844 | DO m = 1, surf_def_h(0)%ns |
---|
845 | i = surf_def_h(0)%i(m) |
---|
846 | j = surf_def_h(0)%j(m) |
---|
847 | k = surf_def_h(0)%k(m) |
---|
848 | qsws_av(j,i) = qsws_av(j,i) + surf_def_h(0)%qsws(m) * & |
---|
849 | waterflux_output_conversion(k) |
---|
850 | ENDDO |
---|
851 | DO m = 1, surf_lsm_h%ns |
---|
852 | i = surf_lsm_h%i(m) |
---|
853 | j = surf_lsm_h%j(m) |
---|
854 | qsws_av(j,i) = qsws_av(j,i) + surf_lsm_h%qsws(m) * l_v |
---|
855 | ENDDO |
---|
856 | DO m = 1, surf_usm_h%ns |
---|
857 | i = surf_usm_h%i(m) |
---|
858 | j = surf_usm_h%j(m) |
---|
859 | qsws_av(j,i) = qsws_av(j,i) + surf_usm_h%qsws(m) * l_v |
---|
860 | ENDDO |
---|
861 | ENDIF |
---|
862 | |
---|
863 | CASE ( 'qv' ) |
---|
864 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
865 | DO i = nxlg, nxrg |
---|
866 | DO j = nysg, nyng |
---|
867 | DO k = nzb, nzt+1 |
---|
868 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
869 | ENDDO |
---|
870 | ENDDO |
---|
871 | ENDDO |
---|
872 | ENDIF |
---|
873 | |
---|
874 | CASE ( 'r_a*' ) |
---|
875 | IF ( ALLOCATED( r_a_av ) ) THEN |
---|
876 | DO m = 1, surf_lsm_h%ns |
---|
877 | i = surf_lsm_h%i(m) |
---|
878 | j = surf_lsm_h%j(m) |
---|
879 | r_a_av(j,i) = r_a_av(j,i) + surf_lsm_h%r_a(m) |
---|
880 | ENDDO |
---|
881 | ! |
---|
882 | !-- Please note, resistance is also applied at urban-type surfaces, |
---|
883 | !-- and is output only as a single variable. Here, tile approach is |
---|
884 | !-- already implemented, so for each surface fraction resistance |
---|
885 | !-- need to be summed-up. |
---|
886 | DO m = 1, surf_usm_h%ns |
---|
887 | i = surf_usm_h%i(m) |
---|
888 | j = surf_usm_h%j(m) |
---|
889 | r_a_av(j,i) = r_a_av(j,i) + & |
---|
890 | ( surf_usm_h%frac(ind_veg_wall,m) * & |
---|
891 | surf_usm_h%r_a(m) + & |
---|
892 | surf_usm_h%frac(ind_pav_green,m) * & |
---|
893 | surf_usm_h%r_a_green(m) + & |
---|
894 | surf_usm_h%frac(ind_wat_win,m) * & |
---|
895 | surf_usm_h%r_a_window(m) ) |
---|
896 | ENDDO |
---|
897 | ENDIF |
---|
898 | |
---|
899 | CASE ( 'rho_ocean' ) |
---|
900 | IF ( ALLOCATED( rho_ocean_av ) ) THEN |
---|
901 | DO i = nxlg, nxrg |
---|
902 | DO j = nysg, nyng |
---|
903 | DO k = nzb, nzt+1 |
---|
904 | rho_ocean_av(k,j,i) = rho_ocean_av(k,j,i) + rho_ocean(k,j,i) |
---|
905 | ENDDO |
---|
906 | ENDDO |
---|
907 | ENDDO |
---|
908 | ENDIF |
---|
909 | |
---|
910 | CASE ( 's' ) |
---|
911 | IF ( ALLOCATED( s_av ) ) THEN |
---|
912 | DO i = nxlg, nxrg |
---|
913 | DO j = nysg, nyng |
---|
914 | DO k = nzb, nzt+1 |
---|
915 | s_av(k,j,i) = s_av(k,j,i) + s(k,j,i) |
---|
916 | ENDDO |
---|
917 | ENDDO |
---|
918 | ENDDO |
---|
919 | ENDIF |
---|
920 | |
---|
921 | CASE ( 'sa' ) |
---|
922 | IF ( ALLOCATED( sa_av ) ) THEN |
---|
923 | DO i = nxlg, nxrg |
---|
924 | DO j = nysg, nyng |
---|
925 | DO k = nzb, nzt+1 |
---|
926 | sa_av(k,j,i) = sa_av(k,j,i) + sa(k,j,i) |
---|
927 | ENDDO |
---|
928 | ENDDO |
---|
929 | ENDDO |
---|
930 | ENDIF |
---|
931 | |
---|
932 | CASE ( 'shf*' ) |
---|
933 | ! |
---|
934 | !-- In case of default surfaces, clean-up flux by density. |
---|
935 | !-- In case of land- and urban-surfaces, convert fluxes into |
---|
936 | !-- dynamic units. |
---|
937 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
938 | DO m = 1, surf_def_h(0)%ns |
---|
939 | i = surf_def_h(0)%i(m) |
---|
940 | j = surf_def_h(0)%j(m) |
---|
941 | k = surf_def_h(0)%k(m) |
---|
942 | shf_av(j,i) = shf_av(j,i) + surf_def_h(0)%shf(m) * & |
---|
943 | heatflux_output_conversion(k) |
---|
944 | ENDDO |
---|
945 | DO m = 1, surf_lsm_h%ns |
---|
946 | i = surf_lsm_h%i(m) |
---|
947 | j = surf_lsm_h%j(m) |
---|
948 | shf_av(j,i) = shf_av(j,i) + surf_lsm_h%shf(m) * cp |
---|
949 | ENDDO |
---|
950 | DO m = 1, surf_usm_h%ns |
---|
951 | i = surf_usm_h%i(m) |
---|
952 | j = surf_usm_h%j(m) |
---|
953 | shf_av(j,i) = shf_av(j,i) + surf_usm_h%shf(m) * cp |
---|
954 | ENDDO |
---|
955 | ENDIF |
---|
956 | |
---|
957 | CASE ( 'ssws*' ) |
---|
958 | IF ( ALLOCATED( ssws_av ) ) THEN |
---|
959 | DO m = 1, surf_def_h(0)%ns |
---|
960 | i = surf_def_h(0)%i(m) |
---|
961 | j = surf_def_h(0)%j(m) |
---|
962 | ssws_av(j,i) = ssws_av(j,i) + surf_def_h(0)%ssws(m) |
---|
963 | ENDDO |
---|
964 | DO m = 1, surf_lsm_h%ns |
---|
965 | i = surf_lsm_h%i(m) |
---|
966 | j = surf_lsm_h%j(m) |
---|
967 | ssws_av(j,i) = ssws_av(j,i) + surf_lsm_h%ssws(m) |
---|
968 | ENDDO |
---|
969 | DO m = 1, surf_usm_h%ns |
---|
970 | i = surf_usm_h%i(m) |
---|
971 | j = surf_usm_h%j(m) |
---|
972 | ssws_av(j,i) = ssws_av(j,i) + surf_usm_h%ssws(m) |
---|
973 | ENDDO |
---|
974 | ENDIF |
---|
975 | |
---|
976 | CASE ( 't*' ) |
---|
977 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
978 | DO m = 1, surf_def_h(0)%ns |
---|
979 | i = surf_def_h(0)%i(m) |
---|
980 | j = surf_def_h(0)%j(m) |
---|
981 | ts_av(j,i) = ts_av(j,i) + surf_def_h(0)%ts(m) |
---|
982 | ENDDO |
---|
983 | DO m = 1, surf_lsm_h%ns |
---|
984 | i = surf_lsm_h%i(m) |
---|
985 | j = surf_lsm_h%j(m) |
---|
986 | ts_av(j,i) = ts_av(j,i) + surf_lsm_h%ts(m) |
---|
987 | ENDDO |
---|
988 | DO m = 1, surf_usm_h%ns |
---|
989 | i = surf_usm_h%i(m) |
---|
990 | j = surf_usm_h%j(m) |
---|
991 | ts_av(j,i) = ts_av(j,i) + surf_usm_h%ts(m) |
---|
992 | ENDDO |
---|
993 | ENDIF |
---|
994 | |
---|
995 | CASE ( 'tsurf*' ) |
---|
996 | IF ( ALLOCATED( tsurf_av ) ) THEN |
---|
997 | DO m = 1, surf_def_h(0)%ns |
---|
998 | i = surf_def_h(0)%i(m) |
---|
999 | j = surf_def_h(0)%j(m) |
---|
1000 | tsurf_av(j,i) = tsurf_av(j,i) + surf_def_h(0)%pt_surface(m) |
---|
1001 | ENDDO |
---|
1002 | |
---|
1003 | DO m = 1, surf_lsm_h%ns |
---|
1004 | i = surf_lsm_h%i(m) |
---|
1005 | j = surf_lsm_h%j(m) |
---|
1006 | tsurf_av(j,i) = tsurf_av(j,i) + surf_lsm_h%pt_surface(m) |
---|
1007 | ENDDO |
---|
1008 | |
---|
1009 | DO m = 1, surf_usm_h%ns |
---|
1010 | i = surf_usm_h%i(m) |
---|
1011 | j = surf_usm_h%j(m) |
---|
1012 | tsurf_av(j,i) = tsurf_av(j,i) + surf_usm_h%pt_surface(m) |
---|
1013 | ENDDO |
---|
1014 | ENDIF |
---|
1015 | |
---|
1016 | CASE ( 'u' ) |
---|
1017 | IF ( ALLOCATED( u_av ) ) THEN |
---|
1018 | DO i = nxlg, nxrg |
---|
1019 | DO j = nysg, nyng |
---|
1020 | DO k = nzb, nzt+1 |
---|
1021 | u_av(k,j,i) = u_av(k,j,i) + u(k,j,i) |
---|
1022 | ENDDO |
---|
1023 | ENDDO |
---|
1024 | ENDDO |
---|
1025 | ENDIF |
---|
1026 | |
---|
1027 | CASE ( 'u*' ) |
---|
1028 | IF ( ALLOCATED( us_av ) ) THEN |
---|
1029 | DO m = 1, surf_def_h(0)%ns |
---|
1030 | i = surf_def_h(0)%i(m) |
---|
1031 | j = surf_def_h(0)%j(m) |
---|
1032 | us_av(j,i) = us_av(j,i) + surf_def_h(0)%us(m) |
---|
1033 | ENDDO |
---|
1034 | DO m = 1, surf_lsm_h%ns |
---|
1035 | i = surf_lsm_h%i(m) |
---|
1036 | j = surf_lsm_h%j(m) |
---|
1037 | us_av(j,i) = us_av(j,i) + surf_lsm_h%us(m) |
---|
1038 | ENDDO |
---|
1039 | DO m = 1, surf_usm_h%ns |
---|
1040 | i = surf_usm_h%i(m) |
---|
1041 | j = surf_usm_h%j(m) |
---|
1042 | us_av(j,i) = us_av(j,i) + surf_usm_h%us(m) |
---|
1043 | ENDDO |
---|
1044 | ENDIF |
---|
1045 | |
---|
1046 | CASE ( 'v' ) |
---|
1047 | IF ( ALLOCATED( v_av ) ) THEN |
---|
1048 | DO i = nxlg, nxrg |
---|
1049 | DO j = nysg, nyng |
---|
1050 | DO k = nzb, nzt+1 |
---|
1051 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
1052 | ENDDO |
---|
1053 | ENDDO |
---|
1054 | ENDDO |
---|
1055 | ENDIF |
---|
1056 | |
---|
1057 | CASE ( 'vpt' ) |
---|
1058 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
1059 | DO i = nxlg, nxrg |
---|
1060 | DO j = nysg, nyng |
---|
1061 | DO k = nzb, nzt+1 |
---|
1062 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
1063 | ENDDO |
---|
1064 | ENDDO |
---|
1065 | ENDDO |
---|
1066 | ENDIF |
---|
1067 | |
---|
1068 | CASE ( 'w' ) |
---|
1069 | IF ( ALLOCATED( w_av ) ) THEN |
---|
1070 | DO i = nxlg, nxrg |
---|
1071 | DO j = nysg, nyng |
---|
1072 | DO k = nzb, nzt+1 |
---|
1073 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
1074 | ENDDO |
---|
1075 | ENDDO |
---|
1076 | ENDDO |
---|
1077 | ENDIF |
---|
1078 | |
---|
1079 | CASE ( 'z0*' ) |
---|
1080 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
1081 | DO m = 1, surf_def_h(0)%ns |
---|
1082 | i = surf_def_h(0)%i(m) |
---|
1083 | j = surf_def_h(0)%j(m) |
---|
1084 | z0_av(j,i) = z0_av(j,i) + surf_def_h(0)%z0(m) |
---|
1085 | ENDDO |
---|
1086 | DO m = 1, surf_lsm_h%ns |
---|
1087 | i = surf_lsm_h%i(m) |
---|
1088 | j = surf_lsm_h%j(m) |
---|
1089 | z0_av(j,i) = z0_av(j,i) + surf_lsm_h%z0(m) |
---|
1090 | ENDDO |
---|
1091 | DO m = 1, surf_usm_h%ns |
---|
1092 | i = surf_usm_h%i(m) |
---|
1093 | j = surf_usm_h%j(m) |
---|
1094 | z0_av(j,i) = z0_av(j,i) + surf_usm_h%z0(m) |
---|
1095 | ENDDO |
---|
1096 | ENDIF |
---|
1097 | |
---|
1098 | CASE ( 'z0h*' ) |
---|
1099 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
1100 | DO m = 1, surf_def_h(0)%ns |
---|
1101 | i = surf_def_h(0)%i(m) |
---|
1102 | j = surf_def_h(0)%j(m) |
---|
1103 | z0h_av(j,i) = z0h_av(j,i) + surf_def_h(0)%z0h(m) |
---|
1104 | ENDDO |
---|
1105 | DO m = 1, surf_lsm_h%ns |
---|
1106 | i = surf_lsm_h%i(m) |
---|
1107 | j = surf_lsm_h%j(m) |
---|
1108 | z0h_av(j,i) = z0h_av(j,i) + surf_lsm_h%z0h(m) |
---|
1109 | ENDDO |
---|
1110 | DO m = 1, surf_usm_h%ns |
---|
1111 | i = surf_usm_h%i(m) |
---|
1112 | j = surf_usm_h%j(m) |
---|
1113 | z0h_av(j,i) = z0h_av(j,i) + surf_usm_h%z0h(m) |
---|
1114 | ENDDO |
---|
1115 | ENDIF |
---|
1116 | |
---|
1117 | CASE ( 'z0q*' ) |
---|
1118 | IF ( ALLOCATED( z0q_av ) ) THEN |
---|
1119 | DO m = 1, surf_def_h(0)%ns |
---|
1120 | i = surf_def_h(0)%i(m) |
---|
1121 | j = surf_def_h(0)%j(m) |
---|
1122 | z0q_av(j,i) = z0q_av(j,i) + surf_def_h(0)%z0q(m) |
---|
1123 | ENDDO |
---|
1124 | DO m = 1, surf_lsm_h%ns |
---|
1125 | i = surf_lsm_h%i(m) |
---|
1126 | j = surf_lsm_h%j(m) |
---|
1127 | z0q_av(j,i) = z0q_av(j,i) + surf_lsm_h%z0q(m) |
---|
1128 | ENDDO |
---|
1129 | DO m = 1, surf_usm_h%ns |
---|
1130 | i = surf_usm_h%i(m) |
---|
1131 | j = surf_usm_h%j(m) |
---|
1132 | z0q_av(j,i) = z0q_av(j,i) + surf_usm_h%z0q(m) |
---|
1133 | ENDDO |
---|
1134 | ENDIF |
---|
1135 | ! |
---|
1136 | !-- Block of urban surface model outputs. |
---|
1137 | !-- In case of urban surface variables it should be always checked |
---|
1138 | !-- if respective arrays are allocated, at least in case of a restart |
---|
1139 | !-- run, as averaged usm arrays are not read from file at the moment. |
---|
1140 | CASE ( 'usm_output' ) |
---|
1141 | CALL usm_average_3d_data( 'allocate', doav(ii) ) |
---|
1142 | CALL usm_average_3d_data( 'sum', doav(ii) ) |
---|
1143 | |
---|
1144 | CASE DEFAULT |
---|
1145 | ! |
---|
1146 | !-- Turbulence closure module |
---|
1147 | CALL tcm_3d_data_averaging( 'sum', doav(ii) ) |
---|
1148 | |
---|
1149 | ! |
---|
1150 | !-- Land surface quantity |
---|
1151 | IF ( land_surface ) THEN |
---|
1152 | CALL lsm_3d_data_averaging( 'sum', doav(ii) ) |
---|
1153 | ENDIF |
---|
1154 | |
---|
1155 | ! |
---|
1156 | !-- Radiation quantity |
---|
1157 | IF ( radiation ) THEN |
---|
1158 | CALL radiation_3d_data_averaging( 'sum', doav(ii) ) |
---|
1159 | ENDIF |
---|
1160 | |
---|
1161 | ! |
---|
1162 | !-- Gust module quantities |
---|
1163 | IF ( gust_module_enabled ) THEN |
---|
1164 | CALL gust_3d_data_averaging( 'sum', doav(ii) ) |
---|
1165 | ENDIF |
---|
1166 | |
---|
1167 | ! |
---|
1168 | !-- Chemical quantity |
---|
1169 | IF ( air_chemistry .AND. trimvar(1:3) == 'kc_') THEN |
---|
1170 | CALL chem_3d_data_averaging( 'sum',doav(ii) ) |
---|
1171 | ENDIF |
---|
1172 | |
---|
1173 | ! |
---|
1174 | !-- UV exposure quantity |
---|
1175 | IF ( uv_exposure ) THEN |
---|
1176 | CALL uvem_3d_data_averaging( 'sum', doav(ii) ) |
---|
1177 | ENDIF |
---|
1178 | |
---|
1179 | ! |
---|
1180 | !-- User-defined quantity |
---|
1181 | CALL user_3d_data_averaging( 'sum', doav(ii) ) |
---|
1182 | |
---|
1183 | END SELECT |
---|
1184 | |
---|
1185 | ENDDO |
---|
1186 | |
---|
1187 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
1188 | |
---|
1189 | |
---|
1190 | END SUBROUTINE sum_up_3d_data |
---|