1 | !> @file average_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 terms of the GNU General |
---|
6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
7 | ! (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | ! Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
14 | ! <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: average_3d_data.f90 4514 2020-04-30 16:29:59Z oliver.maas $ |
---|
26 | ! Enable output of qsurf and ssurf |
---|
27 | ! |
---|
28 | ! 4509 2020-04-26 15:57:55Z raasch |
---|
29 | ! file re-formatted to follow the PALM coding standard |
---|
30 | ! |
---|
31 | ! 4457 2020-03-11 14:20:43Z raasch |
---|
32 | ! use statement for exchange horiz added, |
---|
33 | ! bugfix for call of exchange horiz 2d |
---|
34 | ! |
---|
35 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
36 | ! Move 2-m potential temperature output to diagnostic_output_quantities |
---|
37 | ! |
---|
38 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
39 | ! Corrected "Former revisions" section |
---|
40 | ! |
---|
41 | ! 4048 2019-06-21 21:00:21Z knoop |
---|
42 | ! Moved tcm_3d_data_averaging to module_interface |
---|
43 | ! |
---|
44 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
45 | ! Modularize diagnostic output |
---|
46 | ! |
---|
47 | ! 3994 2019-05-22 18:08:09Z suehring |
---|
48 | ! output of turbulence intensity added |
---|
49 | ! |
---|
50 | ! 3933 2019-04-25 12:33:20Z kanani |
---|
51 | ! Bugfix in CASE theta_2m*, removal of redundant code |
---|
52 | ! |
---|
53 | ! 3773 2019-03-01 08:56:57Z maronga |
---|
54 | ! Added output of theta_2m*_xy_av |
---|
55 | ! |
---|
56 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
57 | ! Implementation of the PALM module interface |
---|
58 | ! |
---|
59 | ! Revision 1.1 2006/02/23 09:48:58 raasch |
---|
60 | ! Initial revision |
---|
61 | ! |
---|
62 | ! |
---|
63 | ! Description: |
---|
64 | ! ------------ |
---|
65 | !> Time-averaging of 3d-data-arrays. |
---|
66 | !--------------------------------------------------------------------------------------------------! |
---|
67 | SUBROUTINE average_3d_data |
---|
68 | |
---|
69 | |
---|
70 | USE averaging |
---|
71 | |
---|
72 | USE control_parameters, & |
---|
73 | ONLY: average_count_3d, doav, doav_n, varnamelength |
---|
74 | |
---|
75 | USE cpulog, & |
---|
76 | ONLY: cpu_log, log_point |
---|
77 | |
---|
78 | USE exchange_horiz_mod, & |
---|
79 | ONLY: exchange_horiz_2d |
---|
80 | |
---|
81 | USE indices, & |
---|
82 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
83 | |
---|
84 | USE kinds |
---|
85 | |
---|
86 | USE module_interface, & |
---|
87 | ONLY: module_interface_3d_data_averaging |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | IMPLICIT NONE |
---|
93 | |
---|
94 | INTEGER(iwp) :: i !< loop index |
---|
95 | INTEGER(iwp) :: ii !< loop index |
---|
96 | INTEGER(iwp) :: j !< loop index |
---|
97 | INTEGER(iwp) :: k !< loop index |
---|
98 | |
---|
99 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
100 | |
---|
101 | |
---|
102 | CALL cpu_log (log_point(35),'average_3d_data','start') |
---|
103 | |
---|
104 | ! |
---|
105 | !-- Check, if averaging is necessary |
---|
106 | IF ( average_count_3d <= 1 ) RETURN |
---|
107 | |
---|
108 | ! |
---|
109 | !-- Loop of all variables to be averaged. |
---|
110 | DO ii = 1, doav_n |
---|
111 | |
---|
112 | trimvar = TRIM( doav(ii) ) |
---|
113 | |
---|
114 | ! |
---|
115 | !-- Store the array chosen on the temporary array. |
---|
116 | SELECT CASE ( trimvar ) |
---|
117 | |
---|
118 | CASE ( 'e' ) |
---|
119 | IF ( ALLOCATED( e_av ) ) THEN |
---|
120 | DO i = nxlg, nxrg |
---|
121 | DO j = nysg, nyng |
---|
122 | DO k = nzb, nzt+1 |
---|
123 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
124 | ENDDO |
---|
125 | ENDDO |
---|
126 | ENDDO |
---|
127 | ENDIF |
---|
128 | |
---|
129 | CASE ( 'ghf*' ) |
---|
130 | IF ( ALLOCATED( ghf_av ) ) THEN |
---|
131 | DO i = nxl, nxr |
---|
132 | DO j = nys, nyn |
---|
133 | ghf_av(j,i) = ghf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
134 | ENDDO |
---|
135 | ENDDO |
---|
136 | CALL exchange_horiz_2d( ghf_av ) |
---|
137 | ENDIF |
---|
138 | |
---|
139 | CASE ( 'qsws*' ) |
---|
140 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
141 | DO i = nxlg, nxrg |
---|
142 | DO j = nysg, nyng |
---|
143 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
144 | ENDDO |
---|
145 | ENDDO |
---|
146 | CALL exchange_horiz_2d( qsws_av ) |
---|
147 | ENDIF |
---|
148 | |
---|
149 | CASE ( 'thetal' ) |
---|
150 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
151 | DO i = nxlg, nxrg |
---|
152 | DO j = nysg, nyng |
---|
153 | DO k = nzb, nzt+1 |
---|
154 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
155 | ENDDO |
---|
156 | ENDDO |
---|
157 | ENDDO |
---|
158 | ENDIF |
---|
159 | |
---|
160 | CASE ( 'lwp*' ) |
---|
161 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
162 | DO i = nxlg, nxrg |
---|
163 | DO j = nysg, nyng |
---|
164 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
165 | ENDDO |
---|
166 | ENDDO |
---|
167 | ENDIF |
---|
168 | |
---|
169 | CASE ( 'ol*' ) |
---|
170 | IF ( ALLOCATED( ol_av ) ) THEN |
---|
171 | DO i = nxlg, nxrg |
---|
172 | DO j = nysg, nyng |
---|
173 | ol_av(j,i) = ol_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
174 | ENDDO |
---|
175 | ENDDO |
---|
176 | CALL exchange_horiz_2d( ol_av ) |
---|
177 | ENDIF |
---|
178 | |
---|
179 | CASE ( 'p' ) |
---|
180 | IF ( ALLOCATED( p_av ) ) THEN |
---|
181 | DO i = nxlg, nxrg |
---|
182 | DO j = nysg, nyng |
---|
183 | DO k = nzb, nzt+1 |
---|
184 | p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
185 | ENDDO |
---|
186 | ENDDO |
---|
187 | ENDDO |
---|
188 | ENDIF |
---|
189 | |
---|
190 | CASE ( 'pc' ) |
---|
191 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
192 | DO i = nxl, nxr |
---|
193 | DO j = nys, nyn |
---|
194 | DO k = nzb, nzt+1 |
---|
195 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
196 | ENDDO |
---|
197 | ENDDO |
---|
198 | ENDDO |
---|
199 | ENDIF |
---|
200 | |
---|
201 | CASE ( 'pr' ) |
---|
202 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
203 | DO i = nxl, nxr |
---|
204 | DO j = nys, nyn |
---|
205 | DO k = nzb, nzt+1 |
---|
206 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
207 | ENDDO |
---|
208 | ENDDO |
---|
209 | ENDDO |
---|
210 | ENDIF |
---|
211 | |
---|
212 | CASE ( 'theta' ) |
---|
213 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
214 | DO i = nxlg, nxrg |
---|
215 | DO j = nysg, nyng |
---|
216 | DO k = nzb, nzt+1 |
---|
217 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
218 | ENDDO |
---|
219 | ENDDO |
---|
220 | ENDDO |
---|
221 | ENDIF |
---|
222 | |
---|
223 | CASE ( 'q' ) |
---|
224 | IF ( ALLOCATED( q_av ) ) THEN |
---|
225 | DO i = nxlg, nxrg |
---|
226 | DO j = nysg, nyng |
---|
227 | DO k = nzb, nzt+1 |
---|
228 | q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
229 | ENDDO |
---|
230 | ENDDO |
---|
231 | ENDDO |
---|
232 | ENDIF |
---|
233 | |
---|
234 | CASE ( 'ql' ) |
---|
235 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
236 | DO i = nxlg, nxrg |
---|
237 | DO j = nysg, nyng |
---|
238 | DO k = nzb, nzt+1 |
---|
239 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
240 | ENDDO |
---|
241 | ENDDO |
---|
242 | ENDDO |
---|
243 | ENDIF |
---|
244 | |
---|
245 | CASE ( 'ql_c' ) |
---|
246 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
247 | DO i = nxlg, nxrg |
---|
248 | DO j = nysg, nyng |
---|
249 | DO k = nzb, nzt+1 |
---|
250 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
251 | ENDDO |
---|
252 | ENDDO |
---|
253 | ENDDO |
---|
254 | ENDIF |
---|
255 | |
---|
256 | CASE ( 'ql_v' ) |
---|
257 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
258 | DO i = nxlg, nxrg |
---|
259 | DO j = nysg, nyng |
---|
260 | DO k = nzb, nzt+1 |
---|
261 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
262 | ENDDO |
---|
263 | ENDDO |
---|
264 | ENDDO |
---|
265 | ENDIF |
---|
266 | |
---|
267 | CASE ( 'ql_vp' ) |
---|
268 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
269 | DO i = nxlg, nxrg |
---|
270 | DO j = nysg, nyng |
---|
271 | DO k = nzb, nzt+1 |
---|
272 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
273 | ENDDO |
---|
274 | ENDDO |
---|
275 | ENDDO |
---|
276 | ENDIF |
---|
277 | |
---|
278 | CASE ( 'qv' ) |
---|
279 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
280 | DO i = nxlg, nxrg |
---|
281 | DO j = nysg, nyng |
---|
282 | DO k = nzb, nzt+1 |
---|
283 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
284 | ENDDO |
---|
285 | ENDDO |
---|
286 | ENDDO |
---|
287 | ENDIF |
---|
288 | |
---|
289 | CASE ( 'qsurf*' ) |
---|
290 | IF ( ALLOCATED( qsurf_av ) ) THEN |
---|
291 | DO i = nxlg, nxrg |
---|
292 | DO j = nysg, nyng |
---|
293 | qsurf_av(j,i) = qsurf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
294 | ENDDO |
---|
295 | ENDDO |
---|
296 | CALL exchange_horiz_2d( qsurf_av ) |
---|
297 | ENDIF |
---|
298 | |
---|
299 | CASE ( 'r_a*' ) |
---|
300 | IF ( ALLOCATED( r_a_av ) ) THEN |
---|
301 | DO i = nxlg, nxrg |
---|
302 | DO j = nysg, nyng |
---|
303 | r_a_av(j,i) = r_a_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
304 | ENDDO |
---|
305 | ENDDO |
---|
306 | CALL exchange_horiz_2d( r_a_av ) |
---|
307 | ENDIF |
---|
308 | |
---|
309 | CASE ( 's' ) |
---|
310 | IF ( ALLOCATED( s_av ) ) THEN |
---|
311 | DO i = nxlg, nxrg |
---|
312 | DO j = nysg, nyng |
---|
313 | DO k = nzb, nzt+1 |
---|
314 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
315 | ENDDO |
---|
316 | ENDDO |
---|
317 | ENDDO |
---|
318 | ENDIF |
---|
319 | |
---|
320 | CASE ( 'shf*' ) |
---|
321 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
322 | DO i = nxlg, nxrg |
---|
323 | DO j = nysg, nyng |
---|
324 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
325 | ENDDO |
---|
326 | ENDDO |
---|
327 | CALL exchange_horiz_2d( shf_av ) |
---|
328 | ENDIF |
---|
329 | |
---|
330 | CASE ( 'ssurf*' ) |
---|
331 | IF ( ALLOCATED( ssurf_av ) ) THEN |
---|
332 | DO i = nxlg, nxrg |
---|
333 | DO j = nysg, nyng |
---|
334 | ssurf_av(j,i) = ssurf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
335 | ENDDO |
---|
336 | ENDDO |
---|
337 | CALL exchange_horiz_2d( ssurf_av ) |
---|
338 | ENDIF |
---|
339 | |
---|
340 | CASE ( 'ssws*' ) |
---|
341 | IF ( ALLOCATED( ssws_av ) ) THEN |
---|
342 | DO i = nxlg, nxrg |
---|
343 | DO j = nysg, nyng |
---|
344 | ssws_av(j,i) = ssws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
345 | ENDDO |
---|
346 | ENDDO |
---|
347 | CALL exchange_horiz_2d( ssws_av ) |
---|
348 | ENDIF |
---|
349 | |
---|
350 | CASE ( 't*' ) |
---|
351 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
352 | DO i = nxlg, nxrg |
---|
353 | DO j = nysg, nyng |
---|
354 | ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
355 | ENDDO |
---|
356 | ENDDO |
---|
357 | CALL exchange_horiz_2d( ts_av ) |
---|
358 | ENDIF |
---|
359 | |
---|
360 | CASE ( 'tsurf*' ) |
---|
361 | IF ( ALLOCATED( tsurf_av ) ) THEN |
---|
362 | DO i = nxlg, nxrg |
---|
363 | DO j = nysg, nyng |
---|
364 | tsurf_av(j,i) = tsurf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
365 | ENDDO |
---|
366 | ENDDO |
---|
367 | CALL exchange_horiz_2d( tsurf_av ) |
---|
368 | ENDIF |
---|
369 | |
---|
370 | CASE ( 'u' ) |
---|
371 | IF ( ALLOCATED( u_av ) ) THEN |
---|
372 | DO i = nxlg, nxrg |
---|
373 | DO j = nysg, nyng |
---|
374 | DO k = nzb, nzt+1 |
---|
375 | u_av(k,j,i) = u_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
376 | ENDDO |
---|
377 | ENDDO |
---|
378 | ENDDO |
---|
379 | ENDIF |
---|
380 | |
---|
381 | CASE ( 'us*' ) |
---|
382 | IF ( ALLOCATED( us_av ) ) THEN |
---|
383 | DO i = nxlg, nxrg |
---|
384 | DO j = nysg, nyng |
---|
385 | us_av(j,i) = us_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
386 | ENDDO |
---|
387 | ENDDO |
---|
388 | CALL exchange_horiz_2d( us_av ) |
---|
389 | ENDIF |
---|
390 | |
---|
391 | CASE ( 'v' ) |
---|
392 | IF ( ALLOCATED( v_av ) ) THEN |
---|
393 | DO i = nxlg, nxrg |
---|
394 | DO j = nysg, nyng |
---|
395 | DO k = nzb, nzt+1 |
---|
396 | v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
397 | ENDDO |
---|
398 | ENDDO |
---|
399 | ENDDO |
---|
400 | ENDIF |
---|
401 | |
---|
402 | CASE ( 'thetav' ) |
---|
403 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
404 | DO i = nxlg, nxrg |
---|
405 | DO j = nysg, nyng |
---|
406 | DO k = nzb, nzt+1 |
---|
407 | vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
408 | ENDDO |
---|
409 | ENDDO |
---|
410 | ENDDO |
---|
411 | ENDIF |
---|
412 | |
---|
413 | CASE ( 'w' ) |
---|
414 | IF ( ALLOCATED( w_av ) ) THEN |
---|
415 | DO i = nxlg, nxrg |
---|
416 | DO j = nysg, nyng |
---|
417 | DO k = nzb, nzt+1 |
---|
418 | w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
419 | ENDDO |
---|
420 | ENDDO |
---|
421 | ENDDO |
---|
422 | ENDIF |
---|
423 | |
---|
424 | CASE ( 'z0*' ) |
---|
425 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
426 | DO i = nxlg, nxrg |
---|
427 | DO j = nysg, nyng |
---|
428 | z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
429 | ENDDO |
---|
430 | ENDDO |
---|
431 | CALL exchange_horiz_2d( z0_av ) |
---|
432 | ENDIF |
---|
433 | |
---|
434 | CASE ( 'z0h*' ) |
---|
435 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
436 | DO i = nxlg, nxrg |
---|
437 | DO j = nysg, nyng |
---|
438 | z0h_av(j,i) = z0h_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
439 | ENDDO |
---|
440 | ENDDO |
---|
441 | CALL exchange_horiz_2d( z0h_av ) |
---|
442 | ENDIF |
---|
443 | |
---|
444 | CASE ( 'z0q*' ) |
---|
445 | IF ( ALLOCATED( z0q_av ) ) THEN |
---|
446 | DO i = nxlg, nxrg |
---|
447 | DO j = nysg, nyng |
---|
448 | z0q_av(j,i) = z0q_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
449 | ENDDO |
---|
450 | ENDDO |
---|
451 | CALL exchange_horiz_2d( z0q_av ) |
---|
452 | ENDIF |
---|
453 | |
---|
454 | CASE DEFAULT |
---|
455 | ! |
---|
456 | !-- Averaging of data from all other modules |
---|
457 | CALL module_interface_3d_data_averaging( 'average', trimvar ) |
---|
458 | |
---|
459 | END SELECT |
---|
460 | |
---|
461 | ENDDO |
---|
462 | |
---|
463 | ! |
---|
464 | !-- Reset the counter |
---|
465 | average_count_3d = 0.0 |
---|
466 | |
---|
467 | CALL cpu_log( log_point(35), 'average_3d_data', 'stop' ) |
---|
468 | |
---|
469 | |
---|
470 | END SUBROUTINE average_3d_data |
---|