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