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-2014 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: sum_up_3d_data.f90 1683 2015-10-07 23:57:51Z raasch $ |
---|
26 | ! |
---|
27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
28 | ! Code annotations made doxygen readable |
---|
29 | ! |
---|
30 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
31 | ! Adapted for RRTMG |
---|
32 | ! |
---|
33 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
34 | ! Added output of r_a and r_s |
---|
35 | ! |
---|
36 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
37 | ! Added support for land surface model and radiation model data. |
---|
38 | ! |
---|
39 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
40 | ! New particle structure integrated. |
---|
41 | ! |
---|
42 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
43 | ! REAL constants provided with KIND-attribute |
---|
44 | ! |
---|
45 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
46 | ! ONLY-attribute added to USE-statements, |
---|
47 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
48 | ! kinds are defined in new module kinds, |
---|
49 | ! old module precision_kind is removed, |
---|
50 | ! revision history before 2012 removed, |
---|
51 | ! comment fields (!:) to be used for variable explanations added to |
---|
52 | ! all variable declaration statements |
---|
53 | ! |
---|
54 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
55 | ! barrier argument removed from cpu_log, |
---|
56 | ! module interfaces removed |
---|
57 | ! |
---|
58 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
59 | ! ql is calculated by calc_liquid_water_content |
---|
60 | ! |
---|
61 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
62 | ! +nr, prr, qr |
---|
63 | ! |
---|
64 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
65 | ! code put under GPL (PALM 3.9) |
---|
66 | ! |
---|
67 | ! 1007 2012-09-19 14:30:36Z franke |
---|
68 | ! Bugfix in calculation of ql_vp |
---|
69 | ! |
---|
70 | ! 978 2012-08-09 08:28:32Z fricke |
---|
71 | ! +z0h* |
---|
72 | ! |
---|
73 | ! Revision 1.1 2006/02/23 12:55:23 raasch |
---|
74 | ! Initial revision |
---|
75 | ! |
---|
76 | ! |
---|
77 | ! Description: |
---|
78 | ! ------------ |
---|
79 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine |
---|
80 | !> average_3d_data. |
---|
81 | !------------------------------------------------------------------------------! |
---|
82 | SUBROUTINE sum_up_3d_data |
---|
83 | |
---|
84 | |
---|
85 | USE arrays_3d, & |
---|
86 | ONLY: dzw, e, nr, p, pt, q, qc, ql, ql_c, ql_v, qr, qsws, rho, sa, & |
---|
87 | shf, ts, u, us, v, vpt, w, z0, z0h |
---|
88 | |
---|
89 | USE averaging, & |
---|
90 | ONLY: e_av, lpt_av, lwp_av, nr_av, p_av, pc_av, pr_av, prr_av, & |
---|
91 | precipitation_rate_av, pt_av, q_av, qc_av, ql_av, ql_c_av, & |
---|
92 | ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, rho_av, s_av, sa_av, & |
---|
93 | shf_av, ts_av, u_av, us_av, v_av, vpt_av, w_av, z0_av, z0h_av |
---|
94 | |
---|
95 | USE cloud_parameters, & |
---|
96 | ONLY: l_d_cp, precipitation_rate, pt_d_t |
---|
97 | |
---|
98 | USE control_parameters, & |
---|
99 | ONLY: average_count_3d, cloud_physics, doav, doav_n |
---|
100 | |
---|
101 | USE cpulog, & |
---|
102 | ONLY: cpu_log, log_point |
---|
103 | |
---|
104 | USE indices, & |
---|
105 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
106 | |
---|
107 | USE kinds |
---|
108 | |
---|
109 | USE land_surface_model_mod, & |
---|
110 | ONLY: c_liq, c_liq_av, c_soil_av, c_veg, c_veg_av, ghf_eb, & |
---|
111 | ghf_eb_av, lai, lai_av, m_liq_eb, m_liq_eb_av, m_soil, & |
---|
112 | m_soil_av, nzb_soil, nzt_soil, qsws_eb, qsws_eb_av, & |
---|
113 | qsws_liq_eb, qsws_liq_eb_av, qsws_soil_eb, qsws_soil_eb_av, & |
---|
114 | qsws_veg_eb, qsws_veg_eb_av, shf_eb, shf_eb_av, r_a, r_a_av, & |
---|
115 | r_s, r_s_av, t_soil, t_soil_av |
---|
116 | |
---|
117 | USE particle_attributes, & |
---|
118 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
119 | |
---|
120 | USE radiation_model_mod, & |
---|
121 | ONLY: rad_net, rad_net_av, rad_sw_in, rad_sw_in_av, rad_sw_out, & |
---|
122 | rad_sw_out_av, rad_lw_in, rad_lw_in_av, rad_lw_out, & |
---|
123 | rad_lw_out_av |
---|
124 | |
---|
125 | IMPLICIT NONE |
---|
126 | |
---|
127 | INTEGER(iwp) :: i !< |
---|
128 | INTEGER(iwp) :: ii !< |
---|
129 | INTEGER(iwp) :: j !< |
---|
130 | INTEGER(iwp) :: k !< |
---|
131 | INTEGER(iwp) :: n !< |
---|
132 | INTEGER(iwp) :: psi !< |
---|
133 | |
---|
134 | REAL(wp) :: mean_r !< |
---|
135 | REAL(wp) :: s_r2 !< |
---|
136 | REAL(wp) :: s_r3 !< |
---|
137 | |
---|
138 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
139 | |
---|
140 | ! |
---|
141 | !-- Allocate and initialize the summation arrays if called for the very first |
---|
142 | !-- time or the first time after average_3d_data has been called |
---|
143 | !-- (some or all of the arrays may have been already allocated |
---|
144 | !-- in read_3d_binary) |
---|
145 | IF ( average_count_3d == 0 ) THEN |
---|
146 | |
---|
147 | DO ii = 1, doav_n |
---|
148 | |
---|
149 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
150 | |
---|
151 | CASE ( 'c_liq*' ) |
---|
152 | IF ( .NOT. ALLOCATED( c_liq_av ) ) THEN |
---|
153 | ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) ) |
---|
154 | ENDIF |
---|
155 | c_liq_av = 0.0_wp |
---|
156 | |
---|
157 | CASE ( 'c_soil*' ) |
---|
158 | IF ( .NOT. ALLOCATED( c_soil_av ) ) THEN |
---|
159 | ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) ) |
---|
160 | ENDIF |
---|
161 | c_soil_av = 0.0_wp |
---|
162 | |
---|
163 | CASE ( 'c_veg*' ) |
---|
164 | IF ( .NOT. ALLOCATED( c_veg_av ) ) THEN |
---|
165 | ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) ) |
---|
166 | ENDIF |
---|
167 | c_veg_av = 0.0_wp |
---|
168 | |
---|
169 | CASE ( 'e' ) |
---|
170 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
171 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
172 | ENDIF |
---|
173 | e_av = 0.0_wp |
---|
174 | |
---|
175 | CASE ( 'ghf_eb*' ) |
---|
176 | IF ( .NOT. ALLOCATED( ghf_eb_av ) ) THEN |
---|
177 | ALLOCATE( ghf_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
178 | ENDIF |
---|
179 | ghf_eb_av = 0.0_wp |
---|
180 | |
---|
181 | CASE ( 'lai*' ) |
---|
182 | IF ( .NOT. ALLOCATED( lai_av ) ) THEN |
---|
183 | ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) ) |
---|
184 | ENDIF |
---|
185 | lai_av = 0.0_wp |
---|
186 | |
---|
187 | CASE ( 'lpt' ) |
---|
188 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
189 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
190 | ENDIF |
---|
191 | lpt_av = 0.0_wp |
---|
192 | |
---|
193 | CASE ( 'lwp*' ) |
---|
194 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
195 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
196 | ENDIF |
---|
197 | lwp_av = 0.0_wp |
---|
198 | |
---|
199 | CASE ( 'm_liq_eb*' ) |
---|
200 | IF ( .NOT. ALLOCATED( m_liq_eb_av ) ) THEN |
---|
201 | ALLOCATE( m_liq_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
202 | ENDIF |
---|
203 | m_liq_eb_av = 0.0_wp |
---|
204 | |
---|
205 | CASE ( 'm_soil' ) |
---|
206 | IF ( .NOT. ALLOCATED( m_soil_av ) ) THEN |
---|
207 | ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) ) |
---|
208 | ENDIF |
---|
209 | m_soil_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 ( 'p' ) |
---|
218 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
219 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
220 | ENDIF |
---|
221 | p_av = 0.0_wp |
---|
222 | |
---|
223 | CASE ( 'pc' ) |
---|
224 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
225 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
226 | ENDIF |
---|
227 | pc_av = 0.0_wp |
---|
228 | |
---|
229 | CASE ( 'pr' ) |
---|
230 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
231 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
232 | ENDIF |
---|
233 | pr_av = 0.0_wp |
---|
234 | |
---|
235 | CASE ( 'prr' ) |
---|
236 | IF ( .NOT. ALLOCATED( prr_av ) ) THEN |
---|
237 | ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
238 | ENDIF |
---|
239 | prr_av = 0.0_wp |
---|
240 | |
---|
241 | CASE ( 'prr*' ) |
---|
242 | IF ( .NOT. ALLOCATED( precipitation_rate_av ) ) THEN |
---|
243 | ALLOCATE( precipitation_rate_av(nysg:nyng,nxlg:nxrg) ) |
---|
244 | ENDIF |
---|
245 | precipitation_rate_av = 0.0_wp |
---|
246 | |
---|
247 | CASE ( 'pt' ) |
---|
248 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
249 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
250 | ENDIF |
---|
251 | pt_av = 0.0_wp |
---|
252 | |
---|
253 | CASE ( 'q' ) |
---|
254 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
255 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
256 | ENDIF |
---|
257 | q_av = 0.0_wp |
---|
258 | |
---|
259 | CASE ( 'qc' ) |
---|
260 | IF ( .NOT. ALLOCATED( qc_av ) ) THEN |
---|
261 | ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
262 | ENDIF |
---|
263 | qc_av = 0.0_wp |
---|
264 | |
---|
265 | CASE ( 'ql' ) |
---|
266 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
267 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
268 | ENDIF |
---|
269 | ql_av = 0.0_wp |
---|
270 | |
---|
271 | CASE ( 'ql_c' ) |
---|
272 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
273 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
274 | ENDIF |
---|
275 | ql_c_av = 0.0_wp |
---|
276 | |
---|
277 | CASE ( 'ql_v' ) |
---|
278 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
279 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
280 | ENDIF |
---|
281 | ql_v_av = 0.0_wp |
---|
282 | |
---|
283 | CASE ( 'ql_vp' ) |
---|
284 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
285 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
286 | ENDIF |
---|
287 | ql_vp_av = 0.0_wp |
---|
288 | |
---|
289 | CASE ( 'qr' ) |
---|
290 | IF ( .NOT. ALLOCATED( qr_av ) ) THEN |
---|
291 | ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
292 | ENDIF |
---|
293 | qr_av = 0.0_wp |
---|
294 | |
---|
295 | CASE ( 'qsws*' ) |
---|
296 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
297 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
298 | ENDIF |
---|
299 | qsws_av = 0.0_wp |
---|
300 | |
---|
301 | CASE ( 'qsws_eb*' ) |
---|
302 | IF ( .NOT. ALLOCATED( qsws_eb_av ) ) THEN |
---|
303 | ALLOCATE( qsws_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
304 | ENDIF |
---|
305 | qsws_eb_av = 0.0_wp |
---|
306 | |
---|
307 | CASE ( 'qsws_liq_eb*' ) |
---|
308 | IF ( .NOT. ALLOCATED( qsws_liq_eb_av ) ) THEN |
---|
309 | ALLOCATE( qsws_liq_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
310 | ENDIF |
---|
311 | qsws_liq_eb_av = 0.0_wp |
---|
312 | |
---|
313 | CASE ( 'qsws_soil_eb*' ) |
---|
314 | IF ( .NOT. ALLOCATED( qsws_soil_eb_av ) ) THEN |
---|
315 | ALLOCATE( qsws_soil_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
316 | ENDIF |
---|
317 | qsws_soil_eb_av = 0.0_wp |
---|
318 | |
---|
319 | CASE ( 'qsws_veg_eb*' ) |
---|
320 | IF ( .NOT. ALLOCATED( qsws_veg_eb_av ) ) THEN |
---|
321 | ALLOCATE( qsws_veg_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
322 | ENDIF |
---|
323 | qsws_veg_eb_av = 0.0_wp |
---|
324 | |
---|
325 | CASE ( 'qv' ) |
---|
326 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
327 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
328 | ENDIF |
---|
329 | qv_av = 0.0_wp |
---|
330 | |
---|
331 | CASE ( 'rad_net*' ) |
---|
332 | IF ( .NOT. ALLOCATED( rad_net_av ) ) THEN |
---|
333 | ALLOCATE( rad_net_av(nysg:nyng,nxlg:nxrg) ) |
---|
334 | ENDIF |
---|
335 | rad_net_av = 0.0_wp |
---|
336 | |
---|
337 | CASE ( 'rad_lw_in' ) |
---|
338 | IF ( .NOT. ALLOCATED( rad_lw_in_av ) ) THEN |
---|
339 | ALLOCATE( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
340 | ENDIF |
---|
341 | rad_lw_in_av = 0.0_wp |
---|
342 | |
---|
343 | CASE ( 'rad_lw_out' ) |
---|
344 | IF ( .NOT. ALLOCATED( rad_lw_out_av ) ) THEN |
---|
345 | ALLOCATE( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
346 | ENDIF |
---|
347 | rad_lw_out_av = 0.0_wp |
---|
348 | |
---|
349 | CASE ( 'rad_sw_in' ) |
---|
350 | IF ( .NOT. ALLOCATED( rad_sw_in_av ) ) THEN |
---|
351 | ALLOCATE( rad_sw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
352 | ENDIF |
---|
353 | rad_sw_in_av = 0.0_wp |
---|
354 | |
---|
355 | CASE ( 'rad_sw_out' ) |
---|
356 | IF ( .NOT. ALLOCATED( rad_sw_out_av ) ) THEN |
---|
357 | ALLOCATE( rad_sw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
358 | ENDIF |
---|
359 | rad_sw_out_av = 0.0_wp |
---|
360 | |
---|
361 | CASE ( 'rho' ) |
---|
362 | IF ( .NOT. ALLOCATED( rho_av ) ) THEN |
---|
363 | ALLOCATE( rho_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
364 | ENDIF |
---|
365 | rho_av = 0.0_wp |
---|
366 | |
---|
367 | CASE ( 'r_a*' ) |
---|
368 | IF ( .NOT. ALLOCATED( r_a_av ) ) THEN |
---|
369 | ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) ) |
---|
370 | ENDIF |
---|
371 | r_a_av = 0.0_wp |
---|
372 | |
---|
373 | CASE ( 'r_s*' ) |
---|
374 | IF ( .NOT. ALLOCATED( r_s_av ) ) THEN |
---|
375 | ALLOCATE( r_s_av(nysg:nyng,nxlg:nxrg) ) |
---|
376 | ENDIF |
---|
377 | r_s_av = 0.0_wp |
---|
378 | |
---|
379 | CASE ( 's' ) |
---|
380 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
381 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
382 | ENDIF |
---|
383 | s_av = 0.0_wp |
---|
384 | |
---|
385 | CASE ( 'sa' ) |
---|
386 | IF ( .NOT. ALLOCATED( sa_av ) ) THEN |
---|
387 | ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
388 | ENDIF |
---|
389 | sa_av = 0.0_wp |
---|
390 | |
---|
391 | CASE ( 'shf*' ) |
---|
392 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
393 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
394 | ENDIF |
---|
395 | shf_av = 0.0_wp |
---|
396 | |
---|
397 | CASE ( 'shf_eb*' ) |
---|
398 | IF ( .NOT. ALLOCATED( shf_eb_av ) ) THEN |
---|
399 | ALLOCATE( shf_eb_av(nysg:nyng,nxlg:nxrg) ) |
---|
400 | ENDIF |
---|
401 | shf_eb_av = 0.0_wp |
---|
402 | |
---|
403 | CASE ( 't_soil' ) |
---|
404 | IF ( .NOT. ALLOCATED( t_soil_av ) ) THEN |
---|
405 | ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) ) |
---|
406 | ENDIF |
---|
407 | t_soil_av = 0.0_wp |
---|
408 | |
---|
409 | CASE ( 't*' ) |
---|
410 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
411 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
412 | ENDIF |
---|
413 | ts_av = 0.0_wp |
---|
414 | |
---|
415 | CASE ( 'u' ) |
---|
416 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
417 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
418 | ENDIF |
---|
419 | u_av = 0.0_wp |
---|
420 | |
---|
421 | CASE ( 'u*' ) |
---|
422 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
423 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
424 | ENDIF |
---|
425 | us_av = 0.0_wp |
---|
426 | |
---|
427 | CASE ( 'v' ) |
---|
428 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
429 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
430 | ENDIF |
---|
431 | v_av = 0.0_wp |
---|
432 | |
---|
433 | CASE ( 'vpt' ) |
---|
434 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
435 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
436 | ENDIF |
---|
437 | vpt_av = 0.0_wp |
---|
438 | |
---|
439 | CASE ( 'w' ) |
---|
440 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
441 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
442 | ENDIF |
---|
443 | w_av = 0.0_wp |
---|
444 | |
---|
445 | CASE ( 'z0*' ) |
---|
446 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
447 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
448 | ENDIF |
---|
449 | z0_av = 0.0_wp |
---|
450 | |
---|
451 | CASE ( 'z0h*' ) |
---|
452 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
453 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
454 | ENDIF |
---|
455 | z0h_av = 0.0_wp |
---|
456 | |
---|
457 | CASE DEFAULT |
---|
458 | ! |
---|
459 | !-- User-defined quantity |
---|
460 | CALL user_3d_data_averaging( 'allocate', doav(ii) ) |
---|
461 | |
---|
462 | END SELECT |
---|
463 | |
---|
464 | ENDDO |
---|
465 | |
---|
466 | ENDIF |
---|
467 | |
---|
468 | ! |
---|
469 | !-- Loop of all variables to be averaged. |
---|
470 | DO ii = 1, doav_n |
---|
471 | |
---|
472 | ! |
---|
473 | !-- Store the array chosen on the temporary array. |
---|
474 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
475 | |
---|
476 | CASE ( 'c_liq*' ) |
---|
477 | DO i = nxlg, nxrg |
---|
478 | DO j = nysg, nyng |
---|
479 | c_liq_av(j,i) = c_liq_av(j,i) |
---|
480 | ENDDO |
---|
481 | ENDDO |
---|
482 | |
---|
483 | CASE ( 'c_soil*' ) |
---|
484 | DO i = nxlg, nxrg |
---|
485 | DO j = nysg, nyng |
---|
486 | c_soil_av(j,i) = c_soil_av(j,i) + (1.0_wp - c_veg(j,i)) |
---|
487 | ENDDO |
---|
488 | ENDDO |
---|
489 | |
---|
490 | CASE ( 'c_veg*' ) |
---|
491 | DO i = nxlg, nxrg |
---|
492 | DO j = nysg, nyng |
---|
493 | c_veg_av(j,i) = c_veg_av(j,i) |
---|
494 | ENDDO |
---|
495 | ENDDO |
---|
496 | |
---|
497 | CASE ( 'e' ) |
---|
498 | DO i = nxlg, nxrg |
---|
499 | DO j = nysg, nyng |
---|
500 | DO k = nzb, nzt+1 |
---|
501 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
502 | ENDDO |
---|
503 | ENDDO |
---|
504 | ENDDO |
---|
505 | |
---|
506 | CASE ( 'ghf_eb*' ) |
---|
507 | DO i = nxlg, nxrg |
---|
508 | DO j = nysg, nyng |
---|
509 | ghf_eb_av(j,i) = ghf_eb_av(j,i) + ghf_eb(j,i) |
---|
510 | ENDDO |
---|
511 | ENDDO |
---|
512 | |
---|
513 | CASE ( 'lai*' ) |
---|
514 | DO i = nxlg, nxrg |
---|
515 | DO j = nysg, nyng |
---|
516 | lai_av(j,i) = lai_av(j,i) |
---|
517 | ENDDO |
---|
518 | ENDDO |
---|
519 | |
---|
520 | CASE ( 'lpt' ) |
---|
521 | DO i = nxlg, nxrg |
---|
522 | DO j = nysg, nyng |
---|
523 | DO k = nzb, nzt+1 |
---|
524 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
525 | ENDDO |
---|
526 | ENDDO |
---|
527 | ENDDO |
---|
528 | |
---|
529 | CASE ( 'lwp*' ) |
---|
530 | DO i = nxlg, nxrg |
---|
531 | DO j = nysg, nyng |
---|
532 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) * & |
---|
533 | dzw(1:nzt+1) ) |
---|
534 | ENDDO |
---|
535 | ENDDO |
---|
536 | |
---|
537 | CASE ( 'm_liq_eb*' ) |
---|
538 | DO i = nxlg, nxrg |
---|
539 | DO j = nysg, nyng |
---|
540 | m_liq_eb_av(j,i) = m_liq_eb_av(j,i) + m_liq_eb(j,i) |
---|
541 | ENDDO |
---|
542 | ENDDO |
---|
543 | |
---|
544 | CASE ( 'm_soil' ) |
---|
545 | DO i = nxlg, nxrg |
---|
546 | DO j = nysg, nyng |
---|
547 | DO k = nzb_soil, nzt_soil |
---|
548 | m_soil_av(k,j,i) = m_soil_av(k,j,i) + m_soil(k,j,i) |
---|
549 | ENDDO |
---|
550 | ENDDO |
---|
551 | ENDDO |
---|
552 | |
---|
553 | CASE ( 'nr' ) |
---|
554 | DO i = nxlg, nxrg |
---|
555 | DO j = nysg, nyng |
---|
556 | DO k = nzb, nzt+1 |
---|
557 | nr_av(k,j,i) = nr_av(k,j,i) + nr(k,j,i) |
---|
558 | ENDDO |
---|
559 | ENDDO |
---|
560 | ENDDO |
---|
561 | |
---|
562 | CASE ( 'p' ) |
---|
563 | DO i = nxlg, nxrg |
---|
564 | DO j = nysg, nyng |
---|
565 | DO k = nzb, nzt+1 |
---|
566 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
567 | ENDDO |
---|
568 | ENDDO |
---|
569 | ENDDO |
---|
570 | |
---|
571 | CASE ( 'pc' ) |
---|
572 | DO i = nxl, nxr |
---|
573 | DO j = nys, nyn |
---|
574 | DO k = nzb, nzt+1 |
---|
575 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
576 | ENDDO |
---|
577 | ENDDO |
---|
578 | ENDDO |
---|
579 | |
---|
580 | CASE ( 'pr' ) |
---|
581 | DO i = nxl, nxr |
---|
582 | DO j = nys, nyn |
---|
583 | DO k = nzb, nzt+1 |
---|
584 | number_of_particles = prt_count(k,j,i) |
---|
585 | IF ( number_of_particles <= 0 ) CYCLE |
---|
586 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
587 | s_r2 = 0.0_wp |
---|
588 | s_r3 = 0.0_wp |
---|
589 | |
---|
590 | DO n = 1, number_of_particles |
---|
591 | IF ( particles(n)%particle_mask ) THEN |
---|
592 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
593 | particles(n)%weight_factor |
---|
594 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
595 | particles(n)%weight_factor |
---|
596 | ENDIF |
---|
597 | ENDDO |
---|
598 | |
---|
599 | IF ( s_r2 > 0.0_wp ) THEN |
---|
600 | mean_r = s_r3 / s_r2 |
---|
601 | ELSE |
---|
602 | mean_r = 0.0_wp |
---|
603 | ENDIF |
---|
604 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
605 | ENDDO |
---|
606 | ENDDO |
---|
607 | ENDDO |
---|
608 | |
---|
609 | |
---|
610 | CASE ( 'pr*' ) |
---|
611 | DO i = nxlg, nxrg |
---|
612 | DO j = nysg, nyng |
---|
613 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) + & |
---|
614 | precipitation_rate(j,i) |
---|
615 | ENDDO |
---|
616 | ENDDO |
---|
617 | |
---|
618 | CASE ( 'pt' ) |
---|
619 | IF ( .NOT. cloud_physics ) THEN |
---|
620 | DO i = nxlg, nxrg |
---|
621 | DO j = nysg, nyng |
---|
622 | DO k = nzb, nzt+1 |
---|
623 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
624 | ENDDO |
---|
625 | ENDDO |
---|
626 | ENDDO |
---|
627 | ELSE |
---|
628 | DO i = nxlg, nxrg |
---|
629 | DO j = nysg, nyng |
---|
630 | DO k = nzb, nzt+1 |
---|
631 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + l_d_cp * & |
---|
632 | pt_d_t(k) * ql(k,j,i) |
---|
633 | ENDDO |
---|
634 | ENDDO |
---|
635 | ENDDO |
---|
636 | ENDIF |
---|
637 | |
---|
638 | CASE ( 'q' ) |
---|
639 | DO i = nxlg, nxrg |
---|
640 | DO j = nysg, nyng |
---|
641 | DO k = nzb, nzt+1 |
---|
642 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
643 | ENDDO |
---|
644 | ENDDO |
---|
645 | ENDDO |
---|
646 | |
---|
647 | CASE ( 'qc' ) |
---|
648 | DO i = nxlg, nxrg |
---|
649 | DO j = nysg, nyng |
---|
650 | DO k = nzb, nzt+1 |
---|
651 | qc_av(k,j,i) = qc_av(k,j,i) + qc(k,j,i) |
---|
652 | ENDDO |
---|
653 | ENDDO |
---|
654 | ENDDO |
---|
655 | |
---|
656 | CASE ( 'ql' ) |
---|
657 | DO i = nxlg, nxrg |
---|
658 | DO j = nysg, nyng |
---|
659 | DO k = nzb, nzt+1 |
---|
660 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
661 | ENDDO |
---|
662 | ENDDO |
---|
663 | ENDDO |
---|
664 | |
---|
665 | CASE ( 'ql_c' ) |
---|
666 | DO i = nxlg, nxrg |
---|
667 | DO j = nysg, nyng |
---|
668 | DO k = nzb, nzt+1 |
---|
669 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
670 | ENDDO |
---|
671 | ENDDO |
---|
672 | ENDDO |
---|
673 | |
---|
674 | CASE ( 'ql_v' ) |
---|
675 | DO i = nxlg, nxrg |
---|
676 | DO j = nysg, nyng |
---|
677 | DO k = nzb, nzt+1 |
---|
678 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
679 | ENDDO |
---|
680 | ENDDO |
---|
681 | ENDDO |
---|
682 | |
---|
683 | CASE ( 'ql_vp' ) |
---|
684 | DO i = nxl, nxr |
---|
685 | DO j = nys, nyn |
---|
686 | DO k = nzb, nzt+1 |
---|
687 | number_of_particles = prt_count(k,j,i) |
---|
688 | IF ( number_of_particles <= 0 ) CYCLE |
---|
689 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
690 | DO n = 1, number_of_particles |
---|
691 | IF ( particles(n)%particle_mask ) THEN |
---|
692 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
693 | particles(n)%weight_factor / & |
---|
694 | number_of_particles |
---|
695 | ENDIF |
---|
696 | ENDDO |
---|
697 | ENDDO |
---|
698 | ENDDO |
---|
699 | ENDDO |
---|
700 | |
---|
701 | CASE ( 'qr' ) |
---|
702 | DO i = nxlg, nxrg |
---|
703 | DO j = nysg, nyng |
---|
704 | DO k = nzb, nzt+1 |
---|
705 | qr_av(k,j,i) = qr_av(k,j,i) + qr(k,j,i) |
---|
706 | ENDDO |
---|
707 | ENDDO |
---|
708 | ENDDO |
---|
709 | |
---|
710 | CASE ( 'qsws*' ) |
---|
711 | DO i = nxlg, nxrg |
---|
712 | DO j = nysg, nyng |
---|
713 | qsws_av(j,i) = qsws_av(j,i) + qsws(j,i) |
---|
714 | ENDDO |
---|
715 | ENDDO |
---|
716 | |
---|
717 | CASE ( 'qsws_eb*' ) |
---|
718 | DO i = nxlg, nxrg |
---|
719 | DO j = nysg, nyng |
---|
720 | qsws_eb_av(j,i) = qsws_eb_av(j,i) + qsws_eb(j,i) |
---|
721 | ENDDO |
---|
722 | ENDDO |
---|
723 | |
---|
724 | CASE ( 'qsws_liq_eb*' ) |
---|
725 | DO i = nxlg, nxrg |
---|
726 | DO j = nysg, nyng |
---|
727 | qsws_liq_eb_av(j,i) = qsws_liq_eb_av(j,i) + qsws_liq_eb(j,i) |
---|
728 | ENDDO |
---|
729 | ENDDO |
---|
730 | |
---|
731 | CASE ( 'qsws_soil_eb*' ) |
---|
732 | DO i = nxlg, nxrg |
---|
733 | DO j = nysg, nyng |
---|
734 | qsws_soil_eb_av(j,i) = qsws_soil_eb_av(j,i) + qsws_soil_eb(j,i) |
---|
735 | ENDDO |
---|
736 | ENDDO |
---|
737 | |
---|
738 | CASE ( 'qsws_veg_eb*' ) |
---|
739 | DO i = nxlg, nxrg |
---|
740 | DO j = nysg, nyng |
---|
741 | qsws_veg_eb_av(j,i) = qsws_veg_eb_av(j,i) + qsws_veg_eb(j,i) |
---|
742 | ENDDO |
---|
743 | ENDDO |
---|
744 | |
---|
745 | CASE ( 'qv' ) |
---|
746 | DO i = nxlg, nxrg |
---|
747 | DO j = nysg, nyng |
---|
748 | DO k = nzb, nzt+1 |
---|
749 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
750 | ENDDO |
---|
751 | ENDDO |
---|
752 | ENDDO |
---|
753 | |
---|
754 | CASE ( 'rad_net*' ) |
---|
755 | DO i = nxlg, nxrg |
---|
756 | DO j = nysg, nyng |
---|
757 | rad_net_av(j,i) = rad_net_av(j,i) + rad_net(j,i) |
---|
758 | ENDDO |
---|
759 | ENDDO |
---|
760 | |
---|
761 | CASE ( 'rad_lw_in' ) |
---|
762 | DO i = nxlg, nxrg |
---|
763 | DO j = nysg, nyng |
---|
764 | DO k = nzb, nzt+1 |
---|
765 | rad_lw_in_av(k,j,i) = rad_lw_in_av(k,j,i) + rad_lw_in(k,j,i) |
---|
766 | ENDDO |
---|
767 | ENDDO |
---|
768 | ENDDO |
---|
769 | |
---|
770 | CASE ( 'rad_lw_out' ) |
---|
771 | DO i = nxlg, nxrg |
---|
772 | DO j = nysg, nyng |
---|
773 | DO k = nzb, nzt+1 |
---|
774 | rad_lw_out_av(k,j,i) = rad_lw_out_av(k,j,i) + rad_lw_out(k,j,i) |
---|
775 | ENDDO |
---|
776 | ENDDO |
---|
777 | ENDDO |
---|
778 | |
---|
779 | |
---|
780 | CASE ( 'rad_sw_in' ) |
---|
781 | DO i = nxlg, nxrg |
---|
782 | DO j = nysg, nyng |
---|
783 | DO k = nzb, nzt+1 |
---|
784 | rad_sw_in_av(k,j,i) = rad_sw_in_av(k,j,i) + rad_sw_in(k,j,i) |
---|
785 | ENDDO |
---|
786 | ENDDO |
---|
787 | ENDDO |
---|
788 | |
---|
789 | CASE ( 'rad_sw_out' ) |
---|
790 | DO i = nxlg, nxrg |
---|
791 | DO j = nysg, nyng |
---|
792 | DO k = nzb, nzt+1 |
---|
793 | rad_sw_out_av(k,j,i) = rad_sw_out_av(k,j,i) + rad_sw_out(k,j,i) |
---|
794 | ENDDO |
---|
795 | ENDDO |
---|
796 | ENDDO |
---|
797 | |
---|
798 | CASE ( 'r_a*' ) |
---|
799 | DO i = nxlg, nxrg |
---|
800 | DO j = nysg, nyng |
---|
801 | r_a_av(j,i) = r_a_av(j,i) + r_a(j,i) |
---|
802 | ENDDO |
---|
803 | ENDDO |
---|
804 | |
---|
805 | CASE ( 'r_s*' ) |
---|
806 | DO i = nxlg, nxrg |
---|
807 | DO j = nysg, nyng |
---|
808 | r_s_av(j,i) = r_s_av(j,i) + r_s(j,i) |
---|
809 | ENDDO |
---|
810 | ENDDO |
---|
811 | |
---|
812 | CASE ( 'rho' ) |
---|
813 | DO i = nxlg, nxrg |
---|
814 | DO j = nysg, nyng |
---|
815 | DO k = nzb, nzt+1 |
---|
816 | rho_av(k,j,i) = rho_av(k,j,i) + rho(k,j,i) |
---|
817 | ENDDO |
---|
818 | ENDDO |
---|
819 | ENDDO |
---|
820 | |
---|
821 | CASE ( 's' ) |
---|
822 | DO i = nxlg, nxrg |
---|
823 | DO j = nysg, nyng |
---|
824 | DO k = nzb, nzt+1 |
---|
825 | s_av(k,j,i) = s_av(k,j,i) + q(k,j,i) |
---|
826 | ENDDO |
---|
827 | ENDDO |
---|
828 | ENDDO |
---|
829 | |
---|
830 | CASE ( 'sa' ) |
---|
831 | DO i = nxlg, nxrg |
---|
832 | DO j = nysg, nyng |
---|
833 | DO k = nzb, nzt+1 |
---|
834 | sa_av(k,j,i) = sa_av(k,j,i) + sa(k,j,i) |
---|
835 | ENDDO |
---|
836 | ENDDO |
---|
837 | ENDDO |
---|
838 | |
---|
839 | CASE ( 'shf*' ) |
---|
840 | DO i = nxlg, nxrg |
---|
841 | DO j = nysg, nyng |
---|
842 | shf_av(j,i) = shf_av(j,i) + shf(j,i) |
---|
843 | ENDDO |
---|
844 | ENDDO |
---|
845 | |
---|
846 | CASE ( 'shf_eb*' ) |
---|
847 | DO i = nxlg, nxrg |
---|
848 | DO j = nysg, nyng |
---|
849 | shf_eb_av(j,i) = shf_eb_av(j,i) + shf_eb(j,i) |
---|
850 | ENDDO |
---|
851 | ENDDO |
---|
852 | |
---|
853 | CASE ( 't*' ) |
---|
854 | DO i = nxlg, nxrg |
---|
855 | DO j = nysg, nyng |
---|
856 | ts_av(j,i) = ts_av(j,i) + ts(j,i) |
---|
857 | ENDDO |
---|
858 | ENDDO |
---|
859 | |
---|
860 | CASE ( 't_soil' ) |
---|
861 | DO i = nxlg, nxrg |
---|
862 | DO j = nysg, nyng |
---|
863 | DO k = nzb_soil, nzt_soil |
---|
864 | t_soil_av(k,j,i) = t_soil_av(k,j,i) + t_soil(k,j,i) |
---|
865 | ENDDO |
---|
866 | ENDDO |
---|
867 | ENDDO |
---|
868 | |
---|
869 | CASE ( 'u' ) |
---|
870 | DO i = nxlg, nxrg |
---|
871 | DO j = nysg, nyng |
---|
872 | DO k = nzb, nzt+1 |
---|
873 | u_av(k,j,i) = u_av(k,j,i) + u(k,j,i) |
---|
874 | ENDDO |
---|
875 | ENDDO |
---|
876 | ENDDO |
---|
877 | |
---|
878 | CASE ( 'u*' ) |
---|
879 | DO i = nxlg, nxrg |
---|
880 | DO j = nysg, nyng |
---|
881 | us_av(j,i) = us_av(j,i) + us(j,i) |
---|
882 | ENDDO |
---|
883 | ENDDO |
---|
884 | |
---|
885 | CASE ( 'v' ) |
---|
886 | DO i = nxlg, nxrg |
---|
887 | DO j = nysg, nyng |
---|
888 | DO k = nzb, nzt+1 |
---|
889 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
890 | ENDDO |
---|
891 | ENDDO |
---|
892 | ENDDO |
---|
893 | |
---|
894 | CASE ( 'vpt' ) |
---|
895 | DO i = nxlg, nxrg |
---|
896 | DO j = nysg, nyng |
---|
897 | DO k = nzb, nzt+1 |
---|
898 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
899 | ENDDO |
---|
900 | ENDDO |
---|
901 | ENDDO |
---|
902 | |
---|
903 | CASE ( 'w' ) |
---|
904 | DO i = nxlg, nxrg |
---|
905 | DO j = nysg, nyng |
---|
906 | DO k = nzb, nzt+1 |
---|
907 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
908 | ENDDO |
---|
909 | ENDDO |
---|
910 | ENDDO |
---|
911 | |
---|
912 | CASE ( 'z0*' ) |
---|
913 | DO i = nxlg, nxrg |
---|
914 | DO j = nysg, nyng |
---|
915 | z0_av(j,i) = z0_av(j,i) + z0(j,i) |
---|
916 | ENDDO |
---|
917 | ENDDO |
---|
918 | |
---|
919 | CASE ( 'z0h*' ) |
---|
920 | DO i = nxlg, nxrg |
---|
921 | DO j = nysg, nyng |
---|
922 | z0h_av(j,i) = z0h_av(j,i) + z0h(j,i) |
---|
923 | ENDDO |
---|
924 | ENDDO |
---|
925 | |
---|
926 | CASE DEFAULT |
---|
927 | ! |
---|
928 | !-- User-defined quantity |
---|
929 | CALL user_3d_data_averaging( 'sum', doav(ii) ) |
---|
930 | |
---|
931 | END SELECT |
---|
932 | |
---|
933 | ENDDO |
---|
934 | |
---|
935 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
936 | |
---|
937 | |
---|
938 | END SUBROUTINE sum_up_3d_data |
---|