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