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