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