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