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