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