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