1 | !> @file sum_up_3d_data.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
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-2019 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: sum_up_3d_data.f90 4180 2019-08-21 14:37:54Z scharf $ |
---|
27 | ! Moved tcm_3d_data_averaging to module_interface |
---|
28 | ! |
---|
29 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
30 | ! Modularize diagnostic output |
---|
31 | ! |
---|
32 | ! 3994 2019-05-22 18:08:09Z suehring |
---|
33 | ! output of turbulence intensity added |
---|
34 | ! |
---|
35 | ! 3943 2019-05-02 09:50:41Z maronga |
---|
36 | ! Added output of qsws_av for green roofs. |
---|
37 | ! |
---|
38 | ! 3933 2019-04-25 12:33:20Z kanani |
---|
39 | ! Formatting |
---|
40 | ! |
---|
41 | ! 3773 2019-03-01 08:56:57Z maronga |
---|
42 | ! Added output of theta_2m*_xy_av |
---|
43 | ! |
---|
44 | ! 3761 2019-02-25 15:31:42Z raasch |
---|
45 | ! unused variables removed |
---|
46 | ! |
---|
47 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
48 | ! Implementation of the PALM module interface |
---|
49 | ! |
---|
50 | ! |
---|
51 | ! Description: |
---|
52 | ! ------------ |
---|
53 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine |
---|
54 | !> average_3d_data. |
---|
55 | !------------------------------------------------------------------------------! |
---|
56 | SUBROUTINE sum_up_3d_data |
---|
57 | |
---|
58 | |
---|
59 | USE arrays_3d, & |
---|
60 | ONLY: dzw, d_exner, e, heatflux_output_conversion, p, & |
---|
61 | pt, q, ql, ql_c, ql_v, s, u, v, vpt, w, & |
---|
62 | waterflux_output_conversion |
---|
63 | |
---|
64 | USE averaging, & |
---|
65 | ONLY: e_av, ghf_av, lpt_av, lwp_av, ol_av, p_av, pc_av, pr_av, pt_av, & |
---|
66 | pt_2m_av, q_av, ql_av, ql_c_av, ql_v_av, ql_vp_av, qsws_av, & |
---|
67 | qv_av, r_a_av, s_av, shf_av, ssws_av, ts_av, tsurf_av, u_av, & |
---|
68 | us_av, v_av, vpt_av, w_av, z0_av, z0h_av, z0q_av |
---|
69 | |
---|
70 | USE basic_constants_and_equations_mod, & |
---|
71 | ONLY: c_p, lv_d_cp, l_v |
---|
72 | |
---|
73 | USE bulk_cloud_model_mod, & |
---|
74 | ONLY: bulk_cloud_model |
---|
75 | |
---|
76 | USE control_parameters, & |
---|
77 | ONLY: average_count_3d, doav, doav_n, rho_surface, urban_surface, & |
---|
78 | varnamelength |
---|
79 | |
---|
80 | USE cpulog, & |
---|
81 | ONLY: cpu_log, log_point |
---|
82 | |
---|
83 | USE indices, & |
---|
84 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
85 | |
---|
86 | USE kinds |
---|
87 | |
---|
88 | USE module_interface, & |
---|
89 | ONLY: module_interface_3d_data_averaging |
---|
90 | |
---|
91 | USE particle_attributes, & |
---|
92 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
93 | |
---|
94 | USE surface_mod, & |
---|
95 | ONLY: ind_pav_green, ind_veg_wall, ind_wat_win, & |
---|
96 | surf_def_h, surf_lsm_h, surf_usm_h |
---|
97 | |
---|
98 | USE urban_surface_mod, & |
---|
99 | ONLY: usm_3d_data_averaging |
---|
100 | |
---|
101 | |
---|
102 | IMPLICIT NONE |
---|
103 | |
---|
104 | LOGICAL :: match_def !< flag indicating default-type surface |
---|
105 | LOGICAL :: match_lsm !< flag indicating natural-type surface |
---|
106 | LOGICAL :: match_usm !< flag indicating urban-type surface |
---|
107 | |
---|
108 | INTEGER(iwp) :: i !< grid index x direction |
---|
109 | INTEGER(iwp) :: ii !< running index |
---|
110 | INTEGER(iwp) :: j !< grid index y direction |
---|
111 | INTEGER(iwp) :: k !< grid index x direction |
---|
112 | INTEGER(iwp) :: m !< running index over surfacle elements |
---|
113 | INTEGER(iwp) :: n !< running index over number of particles per grid box |
---|
114 | |
---|
115 | REAL(wp) :: mean_r !< mean-particle radius witin grid box |
---|
116 | REAL(wp) :: s_r2 !< mean-particle radius witin grid box to the power of two |
---|
117 | REAL(wp) :: s_r3 !< mean-particle radius witin grid box to the power of three |
---|
118 | |
---|
119 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
120 | |
---|
121 | |
---|
122 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
123 | |
---|
124 | ! |
---|
125 | !-- Allocate and initialize the summation arrays if called for the very first |
---|
126 | !-- time or the first time after average_3d_data has been called |
---|
127 | !-- (some or all of the arrays may have been already allocated |
---|
128 | !-- in rrd_local) |
---|
129 | IF ( average_count_3d == 0 ) THEN |
---|
130 | |
---|
131 | DO ii = 1, doav_n |
---|
132 | |
---|
133 | trimvar = TRIM( doav(ii) ) |
---|
134 | |
---|
135 | SELECT CASE ( trimvar ) |
---|
136 | |
---|
137 | CASE ( 'ghf*' ) |
---|
138 | IF ( .NOT. ALLOCATED( ghf_av ) ) THEN |
---|
139 | ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) ) |
---|
140 | ENDIF |
---|
141 | ghf_av = 0.0_wp |
---|
142 | |
---|
143 | CASE ( 'e' ) |
---|
144 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
145 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
146 | ENDIF |
---|
147 | e_av = 0.0_wp |
---|
148 | |
---|
149 | CASE ( 'thetal' ) |
---|
150 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
151 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
152 | ENDIF |
---|
153 | lpt_av = 0.0_wp |
---|
154 | |
---|
155 | CASE ( 'lwp*' ) |
---|
156 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
157 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
158 | ENDIF |
---|
159 | lwp_av = 0.0_wp |
---|
160 | |
---|
161 | CASE ( 'ol*' ) |
---|
162 | IF ( .NOT. ALLOCATED( ol_av ) ) THEN |
---|
163 | ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) ) |
---|
164 | ENDIF |
---|
165 | ol_av = 0.0_wp |
---|
166 | |
---|
167 | CASE ( 'p' ) |
---|
168 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
169 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
170 | ENDIF |
---|
171 | p_av = 0.0_wp |
---|
172 | |
---|
173 | CASE ( 'pc' ) |
---|
174 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
175 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
176 | ENDIF |
---|
177 | pc_av = 0.0_wp |
---|
178 | |
---|
179 | CASE ( 'pr' ) |
---|
180 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
181 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
182 | ENDIF |
---|
183 | pr_av = 0.0_wp |
---|
184 | |
---|
185 | CASE ( 'theta' ) |
---|
186 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
187 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
188 | ENDIF |
---|
189 | pt_av = 0.0_wp |
---|
190 | |
---|
191 | CASE ( 'q' ) |
---|
192 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
193 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
194 | ENDIF |
---|
195 | q_av = 0.0_wp |
---|
196 | |
---|
197 | CASE ( 'ql' ) |
---|
198 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
199 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
200 | ENDIF |
---|
201 | ql_av = 0.0_wp |
---|
202 | |
---|
203 | CASE ( 'ql_c' ) |
---|
204 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
205 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
206 | ENDIF |
---|
207 | ql_c_av = 0.0_wp |
---|
208 | |
---|
209 | CASE ( 'ql_v' ) |
---|
210 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
211 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
212 | ENDIF |
---|
213 | ql_v_av = 0.0_wp |
---|
214 | |
---|
215 | CASE ( 'ql_vp' ) |
---|
216 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
217 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
218 | ENDIF |
---|
219 | ql_vp_av = 0.0_wp |
---|
220 | |
---|
221 | CASE ( 'qsws*' ) |
---|
222 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
223 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
224 | ENDIF |
---|
225 | qsws_av = 0.0_wp |
---|
226 | |
---|
227 | CASE ( 'qv' ) |
---|
228 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
229 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
230 | ENDIF |
---|
231 | qv_av = 0.0_wp |
---|
232 | |
---|
233 | CASE ( 'r_a*' ) |
---|
234 | IF ( .NOT. ALLOCATED( r_a_av ) ) THEN |
---|
235 | ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) ) |
---|
236 | ENDIF |
---|
237 | r_a_av = 0.0_wp |
---|
238 | |
---|
239 | CASE ( 's' ) |
---|
240 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
241 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
242 | ENDIF |
---|
243 | s_av = 0.0_wp |
---|
244 | |
---|
245 | CASE ( 'shf*' ) |
---|
246 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
247 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
248 | ENDIF |
---|
249 | shf_av = 0.0_wp |
---|
250 | |
---|
251 | CASE ( 'ssws*' ) |
---|
252 | IF ( .NOT. ALLOCATED( ssws_av ) ) THEN |
---|
253 | ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) ) |
---|
254 | ENDIF |
---|
255 | ssws_av = 0.0_wp |
---|
256 | |
---|
257 | CASE ( 't*' ) |
---|
258 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
259 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
260 | ENDIF |
---|
261 | ts_av = 0.0_wp |
---|
262 | |
---|
263 | CASE ( 'tsurf*' ) |
---|
264 | IF ( .NOT. ALLOCATED( tsurf_av ) ) THEN |
---|
265 | ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) ) |
---|
266 | ENDIF |
---|
267 | tsurf_av = 0.0_wp |
---|
268 | |
---|
269 | CASE ( 'u' ) |
---|
270 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
271 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
272 | ENDIF |
---|
273 | u_av = 0.0_wp |
---|
274 | |
---|
275 | CASE ( 'us*' ) |
---|
276 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
277 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
278 | ENDIF |
---|
279 | us_av = 0.0_wp |
---|
280 | |
---|
281 | CASE ( 'v' ) |
---|
282 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
283 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
284 | ENDIF |
---|
285 | v_av = 0.0_wp |
---|
286 | |
---|
287 | CASE ( 'thetav' ) |
---|
288 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
289 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
290 | ENDIF |
---|
291 | vpt_av = 0.0_wp |
---|
292 | |
---|
293 | CASE ( 'theta_2m*' ) |
---|
294 | IF ( .NOT. ALLOCATED( pt_2m_av ) ) THEN |
---|
295 | ALLOCATE( pt_2m_av(nysg:nyng,nxlg:nxrg) ) |
---|
296 | ENDIF |
---|
297 | pt_2m_av = 0.0_wp |
---|
298 | |
---|
299 | CASE ( 'w' ) |
---|
300 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
301 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
302 | ENDIF |
---|
303 | w_av = 0.0_wp |
---|
304 | |
---|
305 | CASE ( 'z0*' ) |
---|
306 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
307 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
308 | ENDIF |
---|
309 | z0_av = 0.0_wp |
---|
310 | |
---|
311 | CASE ( 'z0h*' ) |
---|
312 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
313 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
314 | ENDIF |
---|
315 | z0h_av = 0.0_wp |
---|
316 | |
---|
317 | CASE ( 'z0q*' ) |
---|
318 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
319 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
320 | ENDIF |
---|
321 | z0q_av = 0.0_wp |
---|
322 | |
---|
323 | |
---|
324 | CASE DEFAULT |
---|
325 | |
---|
326 | ! |
---|
327 | !-- Allocating and initializing data arrays for all other modules |
---|
328 | CALL module_interface_3d_data_averaging( 'allocate', trimvar ) |
---|
329 | |
---|
330 | |
---|
331 | END SELECT |
---|
332 | |
---|
333 | ENDDO |
---|
334 | |
---|
335 | ENDIF |
---|
336 | |
---|
337 | ! |
---|
338 | !-- Loop of all variables to be averaged. |
---|
339 | DO ii = 1, doav_n |
---|
340 | |
---|
341 | trimvar = TRIM( doav(ii) ) |
---|
342 | ! |
---|
343 | !-- Store the array chosen on the temporary array. |
---|
344 | SELECT CASE ( trimvar ) |
---|
345 | |
---|
346 | CASE ( 'ghf*' ) |
---|
347 | IF ( ALLOCATED( ghf_av ) ) THEN |
---|
348 | DO i = nxl, nxr |
---|
349 | DO j = nys, nyn |
---|
350 | ! |
---|
351 | !-- Check whether grid point is a natural- or urban-type |
---|
352 | !-- surface. |
---|
353 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
354 | surf_lsm_h%end_index(j,i) |
---|
355 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
356 | surf_usm_h%end_index(j,i) |
---|
357 | ! |
---|
358 | !-- In order to avoid double-counting of surface properties, |
---|
359 | !-- always assume that natural-type surfaces are below urban- |
---|
360 | !-- type surfaces, e.g. in case of bridges. |
---|
361 | !-- Further, take only the last suface element, i.e. the |
---|
362 | !-- uppermost surface which would be visible from above |
---|
363 | IF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
364 | m = surf_lsm_h%end_index(j,i) |
---|
365 | ghf_av(j,i) = ghf_av(j,i) + & |
---|
366 | surf_lsm_h%ghf(m) |
---|
367 | ELSEIF ( match_usm ) THEN |
---|
368 | m = surf_usm_h%end_index(j,i) |
---|
369 | ghf_av(j,i) = ghf_av(j,i) + & |
---|
370 | surf_usm_h%frac(ind_veg_wall,m) * & |
---|
371 | surf_usm_h%wghf_eb(m) + & |
---|
372 | surf_usm_h%frac(ind_pav_green,m) * & |
---|
373 | surf_usm_h%wghf_eb_green(m) + & |
---|
374 | surf_usm_h%frac(ind_wat_win,m) * & |
---|
375 | surf_usm_h%wghf_eb_window(m) |
---|
376 | ENDIF |
---|
377 | ENDDO |
---|
378 | ENDDO |
---|
379 | ENDIF |
---|
380 | |
---|
381 | CASE ( 'e' ) |
---|
382 | IF ( ALLOCATED( e_av ) ) THEN |
---|
383 | DO i = nxlg, nxrg |
---|
384 | DO j = nysg, nyng |
---|
385 | DO k = nzb, nzt+1 |
---|
386 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
387 | ENDDO |
---|
388 | ENDDO |
---|
389 | ENDDO |
---|
390 | ENDIF |
---|
391 | |
---|
392 | CASE ( 'thetal' ) |
---|
393 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
394 | DO i = nxlg, nxrg |
---|
395 | DO j = nysg, nyng |
---|
396 | DO k = nzb, nzt+1 |
---|
397 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
398 | ENDDO |
---|
399 | ENDDO |
---|
400 | ENDDO |
---|
401 | ENDIF |
---|
402 | |
---|
403 | CASE ( 'lwp*' ) |
---|
404 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
405 | DO i = nxlg, nxrg |
---|
406 | DO j = nysg, nyng |
---|
407 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) & |
---|
408 | * dzw(1:nzt+1) ) * rho_surface |
---|
409 | ENDDO |
---|
410 | ENDDO |
---|
411 | ENDIF |
---|
412 | |
---|
413 | CASE ( 'ol*' ) |
---|
414 | IF ( ALLOCATED( ol_av ) ) THEN |
---|
415 | DO i = nxl, nxr |
---|
416 | DO j = nys, nyn |
---|
417 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
418 | surf_def_h(0)%end_index(j,i) |
---|
419 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
420 | surf_lsm_h%end_index(j,i) |
---|
421 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
422 | surf_usm_h%end_index(j,i) |
---|
423 | |
---|
424 | IF ( match_def ) THEN |
---|
425 | m = surf_def_h(0)%end_index(j,i) |
---|
426 | ol_av(j,i) = ol_av(j,i) + & |
---|
427 | surf_def_h(0)%ol(m) |
---|
428 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
429 | m = surf_lsm_h%end_index(j,i) |
---|
430 | ol_av(j,i) = ol_av(j,i) + & |
---|
431 | surf_lsm_h%ol(m) |
---|
432 | ELSEIF ( match_usm ) THEN |
---|
433 | m = surf_usm_h%end_index(j,i) |
---|
434 | ol_av(j,i) = ol_av(j,i) + & |
---|
435 | surf_usm_h%ol(m) |
---|
436 | ENDIF |
---|
437 | ENDDO |
---|
438 | ENDDO |
---|
439 | ENDIF |
---|
440 | |
---|
441 | CASE ( 'p' ) |
---|
442 | IF ( ALLOCATED( p_av ) ) THEN |
---|
443 | DO i = nxlg, nxrg |
---|
444 | DO j = nysg, nyng |
---|
445 | DO k = nzb, nzt+1 |
---|
446 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
447 | ENDDO |
---|
448 | ENDDO |
---|
449 | ENDDO |
---|
450 | ENDIF |
---|
451 | |
---|
452 | CASE ( 'pc' ) |
---|
453 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
454 | DO i = nxl, nxr |
---|
455 | DO j = nys, nyn |
---|
456 | DO k = nzb, nzt+1 |
---|
457 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
458 | ENDDO |
---|
459 | ENDDO |
---|
460 | ENDDO |
---|
461 | ENDIF |
---|
462 | |
---|
463 | CASE ( 'pr' ) |
---|
464 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
465 | DO i = nxl, nxr |
---|
466 | DO j = nys, nyn |
---|
467 | DO k = nzb, nzt+1 |
---|
468 | number_of_particles = prt_count(k,j,i) |
---|
469 | IF ( number_of_particles <= 0 ) CYCLE |
---|
470 | particles => & |
---|
471 | grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
472 | s_r2 = 0.0_wp |
---|
473 | s_r3 = 0.0_wp |
---|
474 | |
---|
475 | DO n = 1, number_of_particles |
---|
476 | IF ( particles(n)%particle_mask ) THEN |
---|
477 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
478 | particles(n)%weight_factor |
---|
479 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
480 | particles(n)%weight_factor |
---|
481 | ENDIF |
---|
482 | ENDDO |
---|
483 | |
---|
484 | IF ( s_r2 > 0.0_wp ) THEN |
---|
485 | mean_r = s_r3 / s_r2 |
---|
486 | ELSE |
---|
487 | mean_r = 0.0_wp |
---|
488 | ENDIF |
---|
489 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
490 | ENDDO |
---|
491 | ENDDO |
---|
492 | ENDDO |
---|
493 | ENDIF |
---|
494 | |
---|
495 | CASE ( 'theta' ) |
---|
496 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
497 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
498 | DO i = nxlg, nxrg |
---|
499 | DO j = nysg, nyng |
---|
500 | DO k = nzb, nzt+1 |
---|
501 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
502 | ENDDO |
---|
503 | ENDDO |
---|
504 | ENDDO |
---|
505 | ELSE |
---|
506 | DO i = nxlg, nxrg |
---|
507 | DO j = nysg, nyng |
---|
508 | DO k = nzb, nzt+1 |
---|
509 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + lv_d_cp * & |
---|
510 | d_exner(k) * ql(k,j,i) |
---|
511 | ENDDO |
---|
512 | ENDDO |
---|
513 | ENDDO |
---|
514 | ENDIF |
---|
515 | ENDIF |
---|
516 | |
---|
517 | CASE ( 'q' ) |
---|
518 | IF ( ALLOCATED( q_av ) ) THEN |
---|
519 | DO i = nxlg, nxrg |
---|
520 | DO j = nysg, nyng |
---|
521 | DO k = nzb, nzt+1 |
---|
522 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
523 | ENDDO |
---|
524 | ENDDO |
---|
525 | ENDDO |
---|
526 | ENDIF |
---|
527 | |
---|
528 | CASE ( 'ql' ) |
---|
529 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
530 | DO i = nxlg, nxrg |
---|
531 | DO j = nysg, nyng |
---|
532 | DO k = nzb, nzt+1 |
---|
533 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
534 | ENDDO |
---|
535 | ENDDO |
---|
536 | ENDDO |
---|
537 | ENDIF |
---|
538 | |
---|
539 | CASE ( 'ql_c' ) |
---|
540 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
541 | DO i = nxlg, nxrg |
---|
542 | DO j = nysg, nyng |
---|
543 | DO k = nzb, nzt+1 |
---|
544 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
545 | ENDDO |
---|
546 | ENDDO |
---|
547 | ENDDO |
---|
548 | ENDIF |
---|
549 | |
---|
550 | CASE ( 'ql_v' ) |
---|
551 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
552 | DO i = nxlg, nxrg |
---|
553 | DO j = nysg, nyng |
---|
554 | DO k = nzb, nzt+1 |
---|
555 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
556 | ENDDO |
---|
557 | ENDDO |
---|
558 | ENDDO |
---|
559 | ENDIF |
---|
560 | |
---|
561 | CASE ( 'ql_vp' ) |
---|
562 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
563 | DO i = nxl, nxr |
---|
564 | DO j = nys, nyn |
---|
565 | DO k = nzb, nzt+1 |
---|
566 | number_of_particles = prt_count(k,j,i) |
---|
567 | IF ( number_of_particles <= 0 ) CYCLE |
---|
568 | particles => & |
---|
569 | grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
570 | DO n = 1, number_of_particles |
---|
571 | IF ( particles(n)%particle_mask ) THEN |
---|
572 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
573 | particles(n)%weight_factor / & |
---|
574 | number_of_particles |
---|
575 | ENDIF |
---|
576 | ENDDO |
---|
577 | ENDDO |
---|
578 | ENDDO |
---|
579 | ENDDO |
---|
580 | ENDIF |
---|
581 | |
---|
582 | CASE ( 'qsws*' ) |
---|
583 | ! |
---|
584 | !-- In case of default surfaces, clean-up flux by density. |
---|
585 | !-- In case of land- and urban-surfaces, convert fluxes into |
---|
586 | !-- dynamic units. |
---|
587 | !-- Question (maronga): are the .NOT. statements really required? |
---|
588 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
589 | DO i = nxl, nxr |
---|
590 | DO j = nys, nyn |
---|
591 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
592 | surf_def_h(0)%end_index(j,i) |
---|
593 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
594 | surf_lsm_h%end_index(j,i) |
---|
595 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
596 | surf_usm_h%end_index(j,i) |
---|
597 | |
---|
598 | IF ( match_def ) THEN |
---|
599 | m = surf_def_h(0)%end_index(j,i) |
---|
600 | qsws_av(j,i) = qsws_av(j,i) + & |
---|
601 | surf_def_h(0)%qsws(m) * & |
---|
602 | waterflux_output_conversion(nzb) |
---|
603 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
604 | m = surf_lsm_h%end_index(j,i) |
---|
605 | qsws_av(j,i) = qsws_av(j,i) + & |
---|
606 | surf_lsm_h%qsws(m) * l_v |
---|
607 | ELSEIF ( match_usm .AND. .NOT. match_lsm ) THEN |
---|
608 | m = surf_usm_h%end_index(j,i) |
---|
609 | qsws_av(j,i) = qsws_av(j,i) + & |
---|
610 | surf_usm_h%qsws(m) * l_v |
---|
611 | ENDIF |
---|
612 | ENDDO |
---|
613 | ENDDO |
---|
614 | ENDIF |
---|
615 | |
---|
616 | CASE ( 'qv' ) |
---|
617 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
618 | DO i = nxlg, nxrg |
---|
619 | DO j = nysg, nyng |
---|
620 | DO k = nzb, nzt+1 |
---|
621 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
622 | ENDDO |
---|
623 | ENDDO |
---|
624 | ENDDO |
---|
625 | ENDIF |
---|
626 | |
---|
627 | CASE ( 'r_a*' ) |
---|
628 | IF ( ALLOCATED( r_a_av ) ) THEN |
---|
629 | DO i = nxl, nxr |
---|
630 | DO j = nys, nyn |
---|
631 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
632 | surf_lsm_h%end_index(j,i) |
---|
633 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
634 | surf_usm_h%end_index(j,i) |
---|
635 | |
---|
636 | IF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
637 | m = surf_lsm_h%end_index(j,i) |
---|
638 | r_a_av(j,i) = r_a_av(j,i) + & |
---|
639 | surf_lsm_h%r_a(m) |
---|
640 | ELSEIF ( match_usm ) THEN |
---|
641 | m = surf_usm_h%end_index(j,i) |
---|
642 | r_a_av(j,i) = r_a_av(j,i) + & |
---|
643 | surf_usm_h%frac(ind_veg_wall,m) * & |
---|
644 | surf_usm_h%r_a(m) + & |
---|
645 | surf_usm_h%frac(ind_pav_green,m) * & |
---|
646 | surf_usm_h%r_a_green(m) + & |
---|
647 | surf_usm_h%frac(ind_wat_win,m) * & |
---|
648 | surf_usm_h%r_a_window(m) |
---|
649 | ENDIF |
---|
650 | ENDDO |
---|
651 | ENDDO |
---|
652 | ENDIF |
---|
653 | |
---|
654 | CASE ( 's' ) |
---|
655 | IF ( ALLOCATED( s_av ) ) THEN |
---|
656 | DO i = nxlg, nxrg |
---|
657 | DO j = nysg, nyng |
---|
658 | DO k = nzb, nzt+1 |
---|
659 | s_av(k,j,i) = s_av(k,j,i) + s(k,j,i) |
---|
660 | ENDDO |
---|
661 | ENDDO |
---|
662 | ENDDO |
---|
663 | ENDIF |
---|
664 | |
---|
665 | CASE ( 'shf*' ) |
---|
666 | ! |
---|
667 | !-- In case of default surfaces, clean-up flux by density. |
---|
668 | !-- In case of land- and urban-surfaces, convert fluxes into |
---|
669 | !-- dynamic units. |
---|
670 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
671 | DO i = nxl, nxr |
---|
672 | DO j = nys, nyn |
---|
673 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
674 | surf_def_h(0)%end_index(j,i) |
---|
675 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
676 | surf_lsm_h%end_index(j,i) |
---|
677 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
678 | surf_usm_h%end_index(j,i) |
---|
679 | |
---|
680 | IF ( match_def ) THEN |
---|
681 | m = surf_def_h(0)%end_index(j,i) |
---|
682 | shf_av(j,i) = shf_av(j,i) + & |
---|
683 | surf_def_h(0)%shf(m) * & |
---|
684 | heatflux_output_conversion(nzb) |
---|
685 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
686 | m = surf_lsm_h%end_index(j,i) |
---|
687 | shf_av(j,i) = shf_av(j,i) + & |
---|
688 | surf_lsm_h%shf(m) * c_p |
---|
689 | ELSEIF ( match_usm ) THEN |
---|
690 | m = surf_usm_h%end_index(j,i) |
---|
691 | shf_av(j,i) = shf_av(j,i) + & |
---|
692 | surf_usm_h%shf(m) * c_p |
---|
693 | ENDIF |
---|
694 | ENDDO |
---|
695 | ENDDO |
---|
696 | ENDIF |
---|
697 | |
---|
698 | CASE ( 'ssws*' ) |
---|
699 | IF ( ALLOCATED( ssws_av ) ) THEN |
---|
700 | DO i = nxl, nxr |
---|
701 | DO j = nys, nyn |
---|
702 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
703 | surf_def_h(0)%end_index(j,i) |
---|
704 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
705 | surf_lsm_h%end_index(j,i) |
---|
706 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
707 | surf_usm_h%end_index(j,i) |
---|
708 | |
---|
709 | IF ( match_def ) THEN |
---|
710 | m = surf_def_h(0)%end_index(j,i) |
---|
711 | ssws_av(j,i) = ssws_av(j,i) + & |
---|
712 | surf_def_h(0)%ssws(m) |
---|
713 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
714 | m = surf_lsm_h%end_index(j,i) |
---|
715 | ssws_av(j,i) = ssws_av(j,i) + & |
---|
716 | surf_lsm_h%ssws(m) |
---|
717 | ELSEIF ( match_usm ) THEN |
---|
718 | m = surf_usm_h%end_index(j,i) |
---|
719 | ssws_av(j,i) = ssws_av(j,i) + & |
---|
720 | surf_usm_h%ssws(m) |
---|
721 | ENDIF |
---|
722 | ENDDO |
---|
723 | ENDDO |
---|
724 | ENDIF |
---|
725 | |
---|
726 | CASE ( 'theta_2m*' ) |
---|
727 | IF ( ALLOCATED( pt_2m_av ) ) THEN |
---|
728 | DO i = nxl, nxr |
---|
729 | DO j = nys, nyn |
---|
730 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
731 | surf_def_h(0)%end_index(j,i) |
---|
732 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
733 | surf_lsm_h%end_index(j,i) |
---|
734 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
735 | surf_usm_h%end_index(j,i) |
---|
736 | |
---|
737 | IF ( match_def ) THEN |
---|
738 | m = surf_def_h(0)%end_index(j,i) |
---|
739 | pt_2m_av(j,i) = pt_2m_av(j,i) + & |
---|
740 | surf_def_h(0)%pt_2m(m) |
---|
741 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
742 | m = surf_lsm_h%end_index(j,i) |
---|
743 | pt_2m_av(j,i) = pt_2m_av(j,i) + & |
---|
744 | surf_lsm_h%pt_2m(m) |
---|
745 | ELSEIF ( match_usm ) THEN |
---|
746 | m = surf_usm_h%end_index(j,i) |
---|
747 | pt_2m_av(j,i) = pt_2m_av(j,i) + & |
---|
748 | surf_usm_h%pt_2m(m) |
---|
749 | ENDIF |
---|
750 | ENDDO |
---|
751 | ENDDO |
---|
752 | ENDIF |
---|
753 | |
---|
754 | |
---|
755 | CASE ( 't*' ) |
---|
756 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
757 | DO i = nxl, nxr |
---|
758 | DO j = nys, nyn |
---|
759 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
760 | surf_def_h(0)%end_index(j,i) |
---|
761 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
762 | surf_lsm_h%end_index(j,i) |
---|
763 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
764 | surf_usm_h%end_index(j,i) |
---|
765 | |
---|
766 | IF ( match_def ) THEN |
---|
767 | m = surf_def_h(0)%end_index(j,i) |
---|
768 | ts_av(j,i) = ts_av(j,i) + & |
---|
769 | surf_def_h(0)%ts(m) |
---|
770 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
771 | m = surf_lsm_h%end_index(j,i) |
---|
772 | ts_av(j,i) = ts_av(j,i) + & |
---|
773 | surf_lsm_h%ts(m) |
---|
774 | ELSEIF ( match_usm ) THEN |
---|
775 | m = surf_usm_h%end_index(j,i) |
---|
776 | ts_av(j,i) = ts_av(j,i) + & |
---|
777 | surf_usm_h%ts(m) |
---|
778 | ENDIF |
---|
779 | ENDDO |
---|
780 | ENDDO |
---|
781 | ENDIF |
---|
782 | |
---|
783 | CASE ( 'tsurf*' ) |
---|
784 | IF ( ALLOCATED( tsurf_av ) ) THEN |
---|
785 | DO i = nxl, nxr |
---|
786 | DO j = nys, nyn |
---|
787 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
788 | surf_def_h(0)%end_index(j,i) |
---|
789 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
790 | surf_lsm_h%end_index(j,i) |
---|
791 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
792 | surf_usm_h%end_index(j,i) |
---|
793 | |
---|
794 | IF ( match_def ) THEN |
---|
795 | m = surf_def_h(0)%end_index(j,i) |
---|
796 | tsurf_av(j,i) = tsurf_av(j,i) + & |
---|
797 | surf_def_h(0)%pt_surface(m) |
---|
798 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
799 | m = surf_lsm_h%end_index(j,i) |
---|
800 | tsurf_av(j,i) = tsurf_av(j,i) + & |
---|
801 | surf_lsm_h%pt_surface(m) |
---|
802 | ELSEIF ( match_usm ) THEN |
---|
803 | m = surf_usm_h%end_index(j,i) |
---|
804 | tsurf_av(j,i) = tsurf_av(j,i) + & |
---|
805 | surf_usm_h%pt_surface(m) |
---|
806 | ENDIF |
---|
807 | ENDDO |
---|
808 | ENDDO |
---|
809 | ENDIF |
---|
810 | |
---|
811 | CASE ( 'u' ) |
---|
812 | IF ( ALLOCATED( u_av ) ) THEN |
---|
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 | ENDIF |
---|
821 | |
---|
822 | CASE ( 'us*' ) |
---|
823 | IF ( ALLOCATED( us_av ) ) THEN |
---|
824 | DO i = nxl, nxr |
---|
825 | DO j = nys, nyn |
---|
826 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
827 | surf_def_h(0)%end_index(j,i) |
---|
828 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
829 | surf_lsm_h%end_index(j,i) |
---|
830 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
831 | surf_usm_h%end_index(j,i) |
---|
832 | |
---|
833 | IF ( match_def ) THEN |
---|
834 | m = surf_def_h(0)%end_index(j,i) |
---|
835 | us_av(j,i) = us_av(j,i) + & |
---|
836 | surf_def_h(0)%us(m) |
---|
837 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
838 | m = surf_lsm_h%end_index(j,i) |
---|
839 | us_av(j,i) = us_av(j,i) + & |
---|
840 | surf_lsm_h%us(m) |
---|
841 | ELSEIF ( match_usm ) THEN |
---|
842 | m = surf_usm_h%end_index(j,i) |
---|
843 | us_av(j,i) = us_av(j,i) + & |
---|
844 | surf_usm_h%us(m) |
---|
845 | ENDIF |
---|
846 | ENDDO |
---|
847 | ENDDO |
---|
848 | ENDIF |
---|
849 | |
---|
850 | CASE ( 'v' ) |
---|
851 | IF ( ALLOCATED( v_av ) ) THEN |
---|
852 | DO i = nxlg, nxrg |
---|
853 | DO j = nysg, nyng |
---|
854 | DO k = nzb, nzt+1 |
---|
855 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
856 | ENDDO |
---|
857 | ENDDO |
---|
858 | ENDDO |
---|
859 | ENDIF |
---|
860 | |
---|
861 | CASE ( 'thetav' ) |
---|
862 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
863 | DO i = nxlg, nxrg |
---|
864 | DO j = nysg, nyng |
---|
865 | DO k = nzb, nzt+1 |
---|
866 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
867 | ENDDO |
---|
868 | ENDDO |
---|
869 | ENDDO |
---|
870 | ENDIF |
---|
871 | |
---|
872 | CASE ( 'w' ) |
---|
873 | IF ( ALLOCATED( w_av ) ) THEN |
---|
874 | DO i = nxlg, nxrg |
---|
875 | DO j = nysg, nyng |
---|
876 | DO k = nzb, nzt+1 |
---|
877 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
878 | ENDDO |
---|
879 | ENDDO |
---|
880 | ENDDO |
---|
881 | ENDIF |
---|
882 | |
---|
883 | CASE ( 'z0*' ) |
---|
884 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
885 | DO i = nxl, nxr |
---|
886 | DO j = nys, nyn |
---|
887 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
888 | surf_def_h(0)%end_index(j,i) |
---|
889 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
890 | surf_lsm_h%end_index(j,i) |
---|
891 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
892 | surf_usm_h%end_index(j,i) |
---|
893 | |
---|
894 | IF ( match_def ) THEN |
---|
895 | m = surf_def_h(0)%end_index(j,i) |
---|
896 | z0_av(j,i) = z0_av(j,i) + & |
---|
897 | surf_def_h(0)%z0(m) |
---|
898 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
899 | m = surf_lsm_h%end_index(j,i) |
---|
900 | z0_av(j,i) = z0_av(j,i) + & |
---|
901 | surf_lsm_h%z0(m) |
---|
902 | ELSEIF ( match_usm ) THEN |
---|
903 | m = surf_usm_h%end_index(j,i) |
---|
904 | z0_av(j,i) = z0_av(j,i) + & |
---|
905 | surf_usm_h%z0(m) |
---|
906 | ENDIF |
---|
907 | ENDDO |
---|
908 | ENDDO |
---|
909 | ENDIF |
---|
910 | |
---|
911 | CASE ( 'z0h*' ) |
---|
912 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
913 | DO i = nxl, nxr |
---|
914 | DO j = nys, nyn |
---|
915 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
916 | surf_def_h(0)%end_index(j,i) |
---|
917 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
918 | surf_lsm_h%end_index(j,i) |
---|
919 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
920 | surf_usm_h%end_index(j,i) |
---|
921 | |
---|
922 | IF ( match_def ) THEN |
---|
923 | m = surf_def_h(0)%end_index(j,i) |
---|
924 | z0h_av(j,i) = z0h_av(j,i) + & |
---|
925 | surf_def_h(0)%z0h(m) |
---|
926 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
927 | m = surf_lsm_h%end_index(j,i) |
---|
928 | z0h_av(j,i) = z0h_av(j,i) + & |
---|
929 | surf_lsm_h%z0h(m) |
---|
930 | ELSEIF ( match_usm ) THEN |
---|
931 | m = surf_usm_h%end_index(j,i) |
---|
932 | z0h_av(j,i) = z0h_av(j,i) + & |
---|
933 | surf_usm_h%z0h(m) |
---|
934 | ENDIF |
---|
935 | ENDDO |
---|
936 | ENDDO |
---|
937 | ENDIF |
---|
938 | |
---|
939 | CASE ( 'z0q*' ) |
---|
940 | IF ( ALLOCATED( z0q_av ) ) THEN |
---|
941 | DO i = nxl, nxr |
---|
942 | DO j = nys, nyn |
---|
943 | match_def = surf_def_h(0)%start_index(j,i) <= & |
---|
944 | surf_def_h(0)%end_index(j,i) |
---|
945 | match_lsm = surf_lsm_h%start_index(j,i) <= & |
---|
946 | surf_lsm_h%end_index(j,i) |
---|
947 | match_usm = surf_usm_h%start_index(j,i) <= & |
---|
948 | surf_usm_h%end_index(j,i) |
---|
949 | |
---|
950 | IF ( match_def ) THEN |
---|
951 | m = surf_def_h(0)%end_index(j,i) |
---|
952 | z0q_av(j,i) = z0q_av(j,i) + & |
---|
953 | surf_def_h(0)%z0q(m) |
---|
954 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
955 | m = surf_lsm_h%end_index(j,i) |
---|
956 | z0q_av(j,i) = z0q_av(j,i) + & |
---|
957 | surf_lsm_h%z0q(m) |
---|
958 | ELSEIF ( match_usm ) THEN |
---|
959 | m = surf_usm_h%end_index(j,i) |
---|
960 | z0q_av(j,i) = z0q_av(j,i) + & |
---|
961 | surf_usm_h%z0q(m) |
---|
962 | ENDIF |
---|
963 | ENDDO |
---|
964 | ENDDO |
---|
965 | ENDIF |
---|
966 | |
---|
967 | CASE DEFAULT |
---|
968 | |
---|
969 | !-- In case of urban surface variables it should be always checked |
---|
970 | !-- if respective arrays are allocated, at least in case of a restart |
---|
971 | !-- run, as averaged usm arrays are not read from file at the moment. |
---|
972 | IF ( urban_surface ) THEN |
---|
973 | CALL usm_3d_data_averaging( 'allocate', trimvar ) |
---|
974 | ENDIF |
---|
975 | |
---|
976 | ! |
---|
977 | !-- Summing up data from all other modules |
---|
978 | CALL module_interface_3d_data_averaging( 'sum', trimvar ) |
---|
979 | |
---|
980 | |
---|
981 | END SELECT |
---|
982 | |
---|
983 | ENDDO |
---|
984 | |
---|
985 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
986 | |
---|
987 | |
---|
988 | END SUBROUTINE sum_up_3d_data |
---|