1 | !> @file sum_up_3d_data.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
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-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: sum_up_3d_data.f90 2101 2017-01-05 16:42:31Z kanani $ |
---|
27 | ! |
---|
28 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
29 | ! renamed variable rho to rho_ocean and rho_av to rho_ocean_av |
---|
30 | ! |
---|
31 | ! 2024 2016-10-12 16:42:37Z kanani |
---|
32 | ! Added missing CASE for ssws* |
---|
33 | ! |
---|
34 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
35 | ! Flag urban_surface is now defined in module control_parameters, |
---|
36 | ! changed prefix for urban surface model output to "usm_", |
---|
37 | ! introduced control parameter varnamelength for LEN of trimvar. |
---|
38 | ! |
---|
39 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
40 | ! Added support for new urban surface model (temporary modifications of |
---|
41 | ! SELECT CASE ( ) necessary, see variable trimvar), |
---|
42 | ! added comments in variable declaration section |
---|
43 | ! |
---|
44 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
45 | ! Forced header and separation lines into 80 columns |
---|
46 | ! |
---|
47 | ! 1992 2016-08-12 15:14:59Z suehring |
---|
48 | ! Bugfix in summation of passive scalar |
---|
49 | ! |
---|
50 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
51 | ! Radiation actions are now done directly in the respective module |
---|
52 | ! |
---|
53 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
54 | ! Land surface actions are now done directly in the respective module |
---|
55 | ! |
---|
56 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
57 | ! Scalar surface flux added |
---|
58 | ! |
---|
59 | ! 1949 2016-06-17 07:19:16Z maronga |
---|
60 | ! Bugfix: calculation of lai_av, c_veg_av and c_liq_av. |
---|
61 | ! |
---|
62 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
63 | ! precipitation_rate moved to arrays_3d |
---|
64 | ! |
---|
65 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
66 | ! Added z0q and z0q_av |
---|
67 | ! |
---|
68 | ! 1693 2015-10-27 08:35:45Z maronga |
---|
69 | ! Last revision text corrected |
---|
70 | ! |
---|
71 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
72 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
73 | ! Corrected output of liquid water path. |
---|
74 | ! |
---|
75 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
76 | ! Code annotations made doxygen readable |
---|
77 | ! |
---|
78 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
79 | ! Adapted for RRTMG |
---|
80 | ! |
---|
81 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
82 | ! Added output of r_a and r_s |
---|
83 | ! |
---|
84 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
85 | ! Added support for land surface model and radiation model data. |
---|
86 | ! |
---|
87 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
88 | ! New particle structure integrated. |
---|
89 | ! |
---|
90 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
91 | ! REAL constants provided with KIND-attribute |
---|
92 | ! |
---|
93 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
94 | ! ONLY-attribute added to USE-statements, |
---|
95 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
96 | ! kinds are defined in new module kinds, |
---|
97 | ! old module precision_kind is removed, |
---|
98 | ! revision history before 2012 removed, |
---|
99 | ! comment fields (!:) to be used for variable explanations added to |
---|
100 | ! all variable declaration statements |
---|
101 | ! |
---|
102 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
103 | ! barrier argument removed from cpu_log, |
---|
104 | ! module interfaces removed |
---|
105 | ! |
---|
106 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
107 | ! ql is calculated by calc_liquid_water_content |
---|
108 | ! |
---|
109 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
110 | ! +nr, prr, qr |
---|
111 | ! |
---|
112 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
113 | ! code put under GPL (PALM 3.9) |
---|
114 | ! |
---|
115 | ! 1007 2012-09-19 14:30:36Z franke |
---|
116 | ! Bugfix in calculation of ql_vp |
---|
117 | ! |
---|
118 | ! 978 2012-08-09 08:28:32Z fricke |
---|
119 | ! +z0h* |
---|
120 | ! |
---|
121 | ! Revision 1.1 2006/02/23 12:55:23 raasch |
---|
122 | ! Initial revision |
---|
123 | ! |
---|
124 | ! |
---|
125 | ! Description: |
---|
126 | ! ------------ |
---|
127 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine |
---|
128 | !> average_3d_data. |
---|
129 | !------------------------------------------------------------------------------! |
---|
130 | SUBROUTINE sum_up_3d_data |
---|
131 | |
---|
132 | |
---|
133 | USE arrays_3d, & |
---|
134 | ONLY: dzw, e, nr, ol, p, pt, precipitation_rate, q, qc, ql, ql_c, & |
---|
135 | ql_v, qr, qsws, rho_ocean, s, sa, shf, ssws, ts, u, us, v, vpt, w, z0,& |
---|
136 | z0h, z0q |
---|
137 | |
---|
138 | USE averaging, & |
---|
139 | ONLY: e_av, lpt_av, lwp_av, nr_av, ol_av, p_av, pc_av, pr_av, prr_av, & |
---|
140 | precipitation_rate_av, pt_av, q_av, qc_av, ql_av, ql_c_av, & |
---|
141 | ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, rho_ocean_av, s_av, sa_av, & |
---|
142 | shf_av, ssws_av, ts_av, u_av, us_av, v_av, vpt_av, w_av, z0_av, & |
---|
143 | z0h_av, z0q_av |
---|
144 | |
---|
145 | USE cloud_parameters, & |
---|
146 | ONLY: l_d_cp, pt_d_t |
---|
147 | |
---|
148 | USE control_parameters, & |
---|
149 | ONLY: average_count_3d, cloud_physics, doav, doav_n, rho_surface, & |
---|
150 | urban_surface, varnamelength |
---|
151 | |
---|
152 | USE cpulog, & |
---|
153 | ONLY: cpu_log, log_point |
---|
154 | |
---|
155 | USE indices, & |
---|
156 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
157 | |
---|
158 | USE kinds |
---|
159 | |
---|
160 | USE land_surface_model_mod, & |
---|
161 | ONLY: land_surface, lsm_3d_data_averaging |
---|
162 | |
---|
163 | USE particle_attributes, & |
---|
164 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
165 | |
---|
166 | USE radiation_model_mod, & |
---|
167 | ONLY: radiation, radiation_3d_data_averaging |
---|
168 | |
---|
169 | USE urban_surface_mod, & |
---|
170 | ONLY: usm_average_3d_data |
---|
171 | |
---|
172 | |
---|
173 | IMPLICIT NONE |
---|
174 | |
---|
175 | INTEGER(iwp) :: i !< running index |
---|
176 | INTEGER(iwp) :: ii !< running index |
---|
177 | INTEGER(iwp) :: j !< running index |
---|
178 | INTEGER(iwp) :: k !< running index |
---|
179 | INTEGER(iwp) :: n !< |
---|
180 | |
---|
181 | REAL(wp) :: mean_r !< |
---|
182 | REAL(wp) :: s_r2 !< |
---|
183 | REAL(wp) :: s_r3 !< |
---|
184 | |
---|
185 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
186 | |
---|
187 | |
---|
188 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
189 | |
---|
190 | ! |
---|
191 | !-- Allocate and initialize the summation arrays if called for the very first |
---|
192 | !-- time or the first time after average_3d_data has been called |
---|
193 | !-- (some or all of the arrays may have been already allocated |
---|
194 | !-- in read_3d_binary) |
---|
195 | IF ( average_count_3d == 0 ) THEN |
---|
196 | |
---|
197 | DO ii = 1, doav_n |
---|
198 | ! |
---|
199 | !-- Temporary solution to account for data output within the new urban |
---|
200 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
201 | trimvar = TRIM( doav(ii) ) |
---|
202 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
203 | trimvar = 'usm_output' |
---|
204 | ENDIF |
---|
205 | |
---|
206 | SELECT CASE ( trimvar ) |
---|
207 | |
---|
208 | CASE ( 'e' ) |
---|
209 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
210 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
211 | ENDIF |
---|
212 | e_av = 0.0_wp |
---|
213 | |
---|
214 | CASE ( 'lpt' ) |
---|
215 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
216 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
217 | ENDIF |
---|
218 | lpt_av = 0.0_wp |
---|
219 | |
---|
220 | CASE ( 'lwp*' ) |
---|
221 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
222 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
223 | ENDIF |
---|
224 | lwp_av = 0.0_wp |
---|
225 | |
---|
226 | CASE ( 'nr' ) |
---|
227 | IF ( .NOT. ALLOCATED( nr_av ) ) THEN |
---|
228 | ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
229 | ENDIF |
---|
230 | nr_av = 0.0_wp |
---|
231 | |
---|
232 | CASE ( 'ol*' ) |
---|
233 | IF ( .NOT. ALLOCATED( ol_av ) ) THEN |
---|
234 | ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) ) |
---|
235 | ENDIF |
---|
236 | ol_av = 0.0_wp |
---|
237 | |
---|
238 | CASE ( 'p' ) |
---|
239 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
240 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
241 | ENDIF |
---|
242 | p_av = 0.0_wp |
---|
243 | |
---|
244 | CASE ( 'pc' ) |
---|
245 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
246 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
247 | ENDIF |
---|
248 | pc_av = 0.0_wp |
---|
249 | |
---|
250 | CASE ( 'pr' ) |
---|
251 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
252 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
253 | ENDIF |
---|
254 | pr_av = 0.0_wp |
---|
255 | |
---|
256 | CASE ( 'prr' ) |
---|
257 | IF ( .NOT. ALLOCATED( prr_av ) ) THEN |
---|
258 | ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
259 | ENDIF |
---|
260 | prr_av = 0.0_wp |
---|
261 | |
---|
262 | CASE ( 'prr*' ) |
---|
263 | IF ( .NOT. ALLOCATED( precipitation_rate_av ) ) THEN |
---|
264 | ALLOCATE( precipitation_rate_av(nysg:nyng,nxlg:nxrg) ) |
---|
265 | ENDIF |
---|
266 | precipitation_rate_av = 0.0_wp |
---|
267 | |
---|
268 | CASE ( 'pt' ) |
---|
269 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
270 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
271 | ENDIF |
---|
272 | pt_av = 0.0_wp |
---|
273 | |
---|
274 | CASE ( 'q' ) |
---|
275 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
276 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
277 | ENDIF |
---|
278 | q_av = 0.0_wp |
---|
279 | |
---|
280 | CASE ( 'qc' ) |
---|
281 | IF ( .NOT. ALLOCATED( qc_av ) ) THEN |
---|
282 | ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
283 | ENDIF |
---|
284 | qc_av = 0.0_wp |
---|
285 | |
---|
286 | CASE ( 'ql' ) |
---|
287 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
288 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
289 | ENDIF |
---|
290 | ql_av = 0.0_wp |
---|
291 | |
---|
292 | CASE ( 'ql_c' ) |
---|
293 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
294 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
295 | ENDIF |
---|
296 | ql_c_av = 0.0_wp |
---|
297 | |
---|
298 | CASE ( 'ql_v' ) |
---|
299 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
300 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
301 | ENDIF |
---|
302 | ql_v_av = 0.0_wp |
---|
303 | |
---|
304 | CASE ( 'ql_vp' ) |
---|
305 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
306 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
307 | ENDIF |
---|
308 | ql_vp_av = 0.0_wp |
---|
309 | |
---|
310 | CASE ( 'qr' ) |
---|
311 | IF ( .NOT. ALLOCATED( qr_av ) ) THEN |
---|
312 | ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
313 | ENDIF |
---|
314 | qr_av = 0.0_wp |
---|
315 | |
---|
316 | CASE ( 'qsws*' ) |
---|
317 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
318 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
319 | ENDIF |
---|
320 | qsws_av = 0.0_wp |
---|
321 | |
---|
322 | CASE ( 'qv' ) |
---|
323 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
324 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
325 | ENDIF |
---|
326 | qv_av = 0.0_wp |
---|
327 | |
---|
328 | CASE ( 'rho_ocean' ) |
---|
329 | IF ( .NOT. ALLOCATED( rho_ocean_av ) ) THEN |
---|
330 | ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
331 | ENDIF |
---|
332 | rho_ocean_av = 0.0_wp |
---|
333 | |
---|
334 | CASE ( 's' ) |
---|
335 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
336 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
337 | ENDIF |
---|
338 | s_av = 0.0_wp |
---|
339 | |
---|
340 | CASE ( 'sa' ) |
---|
341 | IF ( .NOT. ALLOCATED( sa_av ) ) THEN |
---|
342 | ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
343 | ENDIF |
---|
344 | sa_av = 0.0_wp |
---|
345 | |
---|
346 | CASE ( 'shf*' ) |
---|
347 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
348 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
349 | ENDIF |
---|
350 | shf_av = 0.0_wp |
---|
351 | |
---|
352 | CASE ( 'ssws*' ) |
---|
353 | IF ( .NOT. ALLOCATED( ssws_av ) ) THEN |
---|
354 | ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) ) |
---|
355 | ENDIF |
---|
356 | ssws_av = 0.0_wp |
---|
357 | |
---|
358 | CASE ( 't*' ) |
---|
359 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
360 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
361 | ENDIF |
---|
362 | ts_av = 0.0_wp |
---|
363 | |
---|
364 | CASE ( 'u' ) |
---|
365 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
366 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
367 | ENDIF |
---|
368 | u_av = 0.0_wp |
---|
369 | |
---|
370 | CASE ( 'u*' ) |
---|
371 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
372 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
373 | ENDIF |
---|
374 | us_av = 0.0_wp |
---|
375 | |
---|
376 | CASE ( 'v' ) |
---|
377 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
378 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
379 | ENDIF |
---|
380 | v_av = 0.0_wp |
---|
381 | |
---|
382 | CASE ( 'vpt' ) |
---|
383 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
384 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
385 | ENDIF |
---|
386 | vpt_av = 0.0_wp |
---|
387 | |
---|
388 | CASE ( 'w' ) |
---|
389 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
390 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
391 | ENDIF |
---|
392 | w_av = 0.0_wp |
---|
393 | |
---|
394 | CASE ( 'z0*' ) |
---|
395 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
396 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
397 | ENDIF |
---|
398 | z0_av = 0.0_wp |
---|
399 | |
---|
400 | CASE ( 'z0h*' ) |
---|
401 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
402 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
403 | ENDIF |
---|
404 | z0h_av = 0.0_wp |
---|
405 | |
---|
406 | CASE ( 'z0q*' ) |
---|
407 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
408 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
409 | ENDIF |
---|
410 | z0q_av = 0.0_wp |
---|
411 | ! |
---|
412 | !-- Block of urban surface model outputs |
---|
413 | CASE ( 'usm_output' ) |
---|
414 | |
---|
415 | CALL usm_average_3d_data( 'allocate', doav(ii) ) |
---|
416 | |
---|
417 | |
---|
418 | CASE DEFAULT |
---|
419 | |
---|
420 | ! |
---|
421 | !-- Land surface quantity |
---|
422 | IF ( land_surface ) THEN |
---|
423 | CALL lsm_3d_data_averaging( 'allocate', doav(ii) ) |
---|
424 | ENDIF |
---|
425 | |
---|
426 | ! |
---|
427 | !-- Radiation quantity |
---|
428 | IF ( radiation ) THEN |
---|
429 | CALL radiation_3d_data_averaging( 'allocate', doav(ii) ) |
---|
430 | ENDIF |
---|
431 | |
---|
432 | ! |
---|
433 | !-- User-defined quantity |
---|
434 | CALL user_3d_data_averaging( 'allocate', doav(ii) ) |
---|
435 | |
---|
436 | END SELECT |
---|
437 | |
---|
438 | ENDDO |
---|
439 | |
---|
440 | ENDIF |
---|
441 | |
---|
442 | ! |
---|
443 | !-- Loop of all variables to be averaged. |
---|
444 | DO ii = 1, doav_n |
---|
445 | ! |
---|
446 | !-- Temporary solution to account for data output within the new urban |
---|
447 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
448 | trimvar = TRIM( doav(ii) ) |
---|
449 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
450 | trimvar = 'usm_output' |
---|
451 | ENDIF |
---|
452 | ! |
---|
453 | !-- Store the array chosen on the temporary array. |
---|
454 | SELECT CASE ( trimvar ) |
---|
455 | |
---|
456 | CASE ( 'e' ) |
---|
457 | DO i = nxlg, nxrg |
---|
458 | DO j = nysg, nyng |
---|
459 | DO k = nzb, nzt+1 |
---|
460 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
461 | ENDDO |
---|
462 | ENDDO |
---|
463 | ENDDO |
---|
464 | |
---|
465 | CASE ( 'lpt' ) |
---|
466 | DO i = nxlg, nxrg |
---|
467 | DO j = nysg, nyng |
---|
468 | DO k = nzb, nzt+1 |
---|
469 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
470 | ENDDO |
---|
471 | ENDDO |
---|
472 | ENDDO |
---|
473 | |
---|
474 | CASE ( 'lwp*' ) |
---|
475 | DO i = nxlg, nxrg |
---|
476 | DO j = nysg, nyng |
---|
477 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) & |
---|
478 | * dzw(1:nzt+1) ) * rho_surface |
---|
479 | ENDDO |
---|
480 | ENDDO |
---|
481 | |
---|
482 | CASE ( 'nr' ) |
---|
483 | DO i = nxlg, nxrg |
---|
484 | DO j = nysg, nyng |
---|
485 | DO k = nzb, nzt+1 |
---|
486 | nr_av(k,j,i) = nr_av(k,j,i) + nr(k,j,i) |
---|
487 | ENDDO |
---|
488 | ENDDO |
---|
489 | ENDDO |
---|
490 | |
---|
491 | CASE ( 'ol*' ) |
---|
492 | DO i = nxlg, nxrg |
---|
493 | DO j = nysg, nyng |
---|
494 | ol_av(j,i) = ol_av(j,i) + ol(j,i) |
---|
495 | ENDDO |
---|
496 | ENDDO |
---|
497 | |
---|
498 | CASE ( 'p' ) |
---|
499 | DO i = nxlg, nxrg |
---|
500 | DO j = nysg, nyng |
---|
501 | DO k = nzb, nzt+1 |
---|
502 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
503 | ENDDO |
---|
504 | ENDDO |
---|
505 | ENDDO |
---|
506 | |
---|
507 | CASE ( 'pc' ) |
---|
508 | DO i = nxl, nxr |
---|
509 | DO j = nys, nyn |
---|
510 | DO k = nzb, nzt+1 |
---|
511 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
512 | ENDDO |
---|
513 | ENDDO |
---|
514 | ENDDO |
---|
515 | |
---|
516 | CASE ( 'pr' ) |
---|
517 | DO i = nxl, nxr |
---|
518 | DO j = nys, nyn |
---|
519 | DO k = nzb, nzt+1 |
---|
520 | number_of_particles = prt_count(k,j,i) |
---|
521 | IF ( number_of_particles <= 0 ) CYCLE |
---|
522 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
523 | s_r2 = 0.0_wp |
---|
524 | s_r3 = 0.0_wp |
---|
525 | |
---|
526 | DO n = 1, number_of_particles |
---|
527 | IF ( particles(n)%particle_mask ) THEN |
---|
528 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
529 | particles(n)%weight_factor |
---|
530 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
531 | particles(n)%weight_factor |
---|
532 | ENDIF |
---|
533 | ENDDO |
---|
534 | |
---|
535 | IF ( s_r2 > 0.0_wp ) THEN |
---|
536 | mean_r = s_r3 / s_r2 |
---|
537 | ELSE |
---|
538 | mean_r = 0.0_wp |
---|
539 | ENDIF |
---|
540 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
541 | ENDDO |
---|
542 | ENDDO |
---|
543 | ENDDO |
---|
544 | |
---|
545 | |
---|
546 | CASE ( 'pr*' ) |
---|
547 | DO i = nxlg, nxrg |
---|
548 | DO j = nysg, nyng |
---|
549 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) + & |
---|
550 | precipitation_rate(j,i) |
---|
551 | ENDDO |
---|
552 | ENDDO |
---|
553 | |
---|
554 | CASE ( 'pt' ) |
---|
555 | IF ( .NOT. cloud_physics ) THEN |
---|
556 | DO i = nxlg, nxrg |
---|
557 | DO j = nysg, nyng |
---|
558 | DO k = nzb, nzt+1 |
---|
559 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
560 | ENDDO |
---|
561 | ENDDO |
---|
562 | ENDDO |
---|
563 | ELSE |
---|
564 | DO i = nxlg, nxrg |
---|
565 | DO j = nysg, nyng |
---|
566 | DO k = nzb, nzt+1 |
---|
567 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + l_d_cp * & |
---|
568 | pt_d_t(k) * ql(k,j,i) |
---|
569 | ENDDO |
---|
570 | ENDDO |
---|
571 | ENDDO |
---|
572 | ENDIF |
---|
573 | |
---|
574 | CASE ( 'q' ) |
---|
575 | DO i = nxlg, nxrg |
---|
576 | DO j = nysg, nyng |
---|
577 | DO k = nzb, nzt+1 |
---|
578 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
579 | ENDDO |
---|
580 | ENDDO |
---|
581 | ENDDO |
---|
582 | |
---|
583 | CASE ( 'qc' ) |
---|
584 | DO i = nxlg, nxrg |
---|
585 | DO j = nysg, nyng |
---|
586 | DO k = nzb, nzt+1 |
---|
587 | qc_av(k,j,i) = qc_av(k,j,i) + qc(k,j,i) |
---|
588 | ENDDO |
---|
589 | ENDDO |
---|
590 | ENDDO |
---|
591 | |
---|
592 | CASE ( 'ql' ) |
---|
593 | DO i = nxlg, nxrg |
---|
594 | DO j = nysg, nyng |
---|
595 | DO k = nzb, nzt+1 |
---|
596 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
597 | ENDDO |
---|
598 | ENDDO |
---|
599 | ENDDO |
---|
600 | |
---|
601 | CASE ( 'ql_c' ) |
---|
602 | DO i = nxlg, nxrg |
---|
603 | DO j = nysg, nyng |
---|
604 | DO k = nzb, nzt+1 |
---|
605 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
606 | ENDDO |
---|
607 | ENDDO |
---|
608 | ENDDO |
---|
609 | |
---|
610 | CASE ( 'ql_v' ) |
---|
611 | DO i = nxlg, nxrg |
---|
612 | DO j = nysg, nyng |
---|
613 | DO k = nzb, nzt+1 |
---|
614 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
615 | ENDDO |
---|
616 | ENDDO |
---|
617 | ENDDO |
---|
618 | |
---|
619 | CASE ( 'ql_vp' ) |
---|
620 | DO i = nxl, nxr |
---|
621 | DO j = nys, nyn |
---|
622 | DO k = nzb, nzt+1 |
---|
623 | number_of_particles = prt_count(k,j,i) |
---|
624 | IF ( number_of_particles <= 0 ) CYCLE |
---|
625 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
626 | DO n = 1, number_of_particles |
---|
627 | IF ( particles(n)%particle_mask ) THEN |
---|
628 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
629 | particles(n)%weight_factor / & |
---|
630 | number_of_particles |
---|
631 | ENDIF |
---|
632 | ENDDO |
---|
633 | ENDDO |
---|
634 | ENDDO |
---|
635 | ENDDO |
---|
636 | |
---|
637 | CASE ( 'qr' ) |
---|
638 | DO i = nxlg, nxrg |
---|
639 | DO j = nysg, nyng |
---|
640 | DO k = nzb, nzt+1 |
---|
641 | qr_av(k,j,i) = qr_av(k,j,i) + qr(k,j,i) |
---|
642 | ENDDO |
---|
643 | ENDDO |
---|
644 | ENDDO |
---|
645 | |
---|
646 | CASE ( 'qsws*' ) |
---|
647 | DO i = nxlg, nxrg |
---|
648 | DO j = nysg, nyng |
---|
649 | qsws_av(j,i) = qsws_av(j,i) + qsws(j,i) |
---|
650 | ENDDO |
---|
651 | ENDDO |
---|
652 | |
---|
653 | CASE ( 'qv' ) |
---|
654 | DO i = nxlg, nxrg |
---|
655 | DO j = nysg, nyng |
---|
656 | DO k = nzb, nzt+1 |
---|
657 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
658 | ENDDO |
---|
659 | ENDDO |
---|
660 | ENDDO |
---|
661 | |
---|
662 | CASE ( 'rho_ocean' ) |
---|
663 | DO i = nxlg, nxrg |
---|
664 | DO j = nysg, nyng |
---|
665 | DO k = nzb, nzt+1 |
---|
666 | rho_ocean_av(k,j,i) = rho_ocean_av(k,j,i) + rho_ocean(k,j,i) |
---|
667 | ENDDO |
---|
668 | ENDDO |
---|
669 | ENDDO |
---|
670 | |
---|
671 | CASE ( 's' ) |
---|
672 | DO i = nxlg, nxrg |
---|
673 | DO j = nysg, nyng |
---|
674 | DO k = nzb, nzt+1 |
---|
675 | s_av(k,j,i) = s_av(k,j,i) + s(k,j,i) |
---|
676 | ENDDO |
---|
677 | ENDDO |
---|
678 | ENDDO |
---|
679 | |
---|
680 | CASE ( 'sa' ) |
---|
681 | DO i = nxlg, nxrg |
---|
682 | DO j = nysg, nyng |
---|
683 | DO k = nzb, nzt+1 |
---|
684 | sa_av(k,j,i) = sa_av(k,j,i) + sa(k,j,i) |
---|
685 | ENDDO |
---|
686 | ENDDO |
---|
687 | ENDDO |
---|
688 | |
---|
689 | CASE ( 'shf*' ) |
---|
690 | DO i = nxlg, nxrg |
---|
691 | DO j = nysg, nyng |
---|
692 | shf_av(j,i) = shf_av(j,i) + shf(j,i) |
---|
693 | ENDDO |
---|
694 | ENDDO |
---|
695 | |
---|
696 | CASE ( 'ssws*' ) |
---|
697 | DO i = nxlg, nxrg |
---|
698 | DO j = nysg, nyng |
---|
699 | ssws_av(j,i) = ssws_av(j,i) + ssws(j,i) |
---|
700 | ENDDO |
---|
701 | ENDDO |
---|
702 | |
---|
703 | CASE ( 't*' ) |
---|
704 | DO i = nxlg, nxrg |
---|
705 | DO j = nysg, nyng |
---|
706 | ts_av(j,i) = ts_av(j,i) + ts(j,i) |
---|
707 | ENDDO |
---|
708 | ENDDO |
---|
709 | |
---|
710 | CASE ( 'u' ) |
---|
711 | DO i = nxlg, nxrg |
---|
712 | DO j = nysg, nyng |
---|
713 | DO k = nzb, nzt+1 |
---|
714 | u_av(k,j,i) = u_av(k,j,i) + u(k,j,i) |
---|
715 | ENDDO |
---|
716 | ENDDO |
---|
717 | ENDDO |
---|
718 | |
---|
719 | CASE ( 'u*' ) |
---|
720 | DO i = nxlg, nxrg |
---|
721 | DO j = nysg, nyng |
---|
722 | us_av(j,i) = us_av(j,i) + us(j,i) |
---|
723 | ENDDO |
---|
724 | ENDDO |
---|
725 | |
---|
726 | CASE ( 'v' ) |
---|
727 | DO i = nxlg, nxrg |
---|
728 | DO j = nysg, nyng |
---|
729 | DO k = nzb, nzt+1 |
---|
730 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
731 | ENDDO |
---|
732 | ENDDO |
---|
733 | ENDDO |
---|
734 | |
---|
735 | CASE ( 'vpt' ) |
---|
736 | DO i = nxlg, nxrg |
---|
737 | DO j = nysg, nyng |
---|
738 | DO k = nzb, nzt+1 |
---|
739 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
740 | ENDDO |
---|
741 | ENDDO |
---|
742 | ENDDO |
---|
743 | |
---|
744 | CASE ( 'w' ) |
---|
745 | DO i = nxlg, nxrg |
---|
746 | DO j = nysg, nyng |
---|
747 | DO k = nzb, nzt+1 |
---|
748 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
749 | ENDDO |
---|
750 | ENDDO |
---|
751 | ENDDO |
---|
752 | |
---|
753 | CASE ( 'z0*' ) |
---|
754 | DO i = nxlg, nxrg |
---|
755 | DO j = nysg, nyng |
---|
756 | z0_av(j,i) = z0_av(j,i) + z0(j,i) |
---|
757 | ENDDO |
---|
758 | ENDDO |
---|
759 | |
---|
760 | CASE ( 'z0h*' ) |
---|
761 | DO i = nxlg, nxrg |
---|
762 | DO j = nysg, nyng |
---|
763 | z0h_av(j,i) = z0h_av(j,i) + z0h(j,i) |
---|
764 | ENDDO |
---|
765 | ENDDO |
---|
766 | |
---|
767 | CASE ( 'z0q*' ) |
---|
768 | DO i = nxlg, nxrg |
---|
769 | DO j = nysg, nyng |
---|
770 | z0q_av(j,i) = z0q_av(j,i) + z0q(j,i) |
---|
771 | ENDDO |
---|
772 | ENDDO |
---|
773 | ! |
---|
774 | !-- Block of urban surface model outputs |
---|
775 | CASE ( 'usm_output' ) |
---|
776 | CALL usm_average_3d_data( 'sum', doav(ii) ) |
---|
777 | |
---|
778 | CASE DEFAULT |
---|
779 | ! |
---|
780 | !-- Land surface quantity |
---|
781 | IF ( land_surface ) THEN |
---|
782 | CALL lsm_3d_data_averaging( 'sum', doav(ii) ) |
---|
783 | ENDIF |
---|
784 | |
---|
785 | ! |
---|
786 | !-- Radiation quantity |
---|
787 | IF ( radiation ) THEN |
---|
788 | CALL radiation_3d_data_averaging( 'sum', doav(ii) ) |
---|
789 | ENDIF |
---|
790 | |
---|
791 | ! |
---|
792 | !-- User-defined quantity |
---|
793 | CALL user_3d_data_averaging( 'sum', doav(ii) ) |
---|
794 | |
---|
795 | END SELECT |
---|
796 | |
---|
797 | ENDDO |
---|
798 | |
---|
799 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
800 | |
---|
801 | |
---|
802 | END SUBROUTINE sum_up_3d_data |
---|