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