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