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