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