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