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-2019 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: average_3d_data.f90 4182 2019-08-22 15:20:23Z dom_dwd_user $ |
---|
27 | ! Corrected "Former revisions" section |
---|
28 | ! |
---|
29 | ! 4048 2019-06-21 21:00:21Z knoop |
---|
30 | ! Moved tcm_3d_data_averaging to module_interface |
---|
31 | ! |
---|
32 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
33 | ! Modularize diagnostic output |
---|
34 | ! |
---|
35 | ! 3994 2019-05-22 18:08:09Z suehring |
---|
36 | ! output of turbulence intensity added |
---|
37 | ! |
---|
38 | ! 3933 2019-04-25 12:33:20Z kanani |
---|
39 | ! Bugfix in CASE theta_2m*, removal of redundant code |
---|
40 | ! |
---|
41 | ! 3773 2019-03-01 08:56:57Z maronga |
---|
42 | ! Added output of theta_2m*_xy_av |
---|
43 | ! |
---|
44 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
45 | ! Implementation of the PALM module interface |
---|
46 | ! |
---|
47 | ! Revision 1.1 2006/02/23 09:48:58 raasch |
---|
48 | ! Initial revision |
---|
49 | ! |
---|
50 | ! |
---|
51 | ! Description: |
---|
52 | ! ------------ |
---|
53 | !> Time-averaging of 3d-data-arrays. |
---|
54 | !------------------------------------------------------------------------------! |
---|
55 | SUBROUTINE average_3d_data |
---|
56 | |
---|
57 | |
---|
58 | USE averaging |
---|
59 | |
---|
60 | USE control_parameters, & |
---|
61 | ONLY: average_count_3d, doav, doav_n, varnamelength |
---|
62 | |
---|
63 | USE cpulog, & |
---|
64 | ONLY: cpu_log, log_point |
---|
65 | |
---|
66 | USE indices, & |
---|
67 | ONLY: nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
68 | |
---|
69 | USE kinds |
---|
70 | |
---|
71 | USE module_interface, & |
---|
72 | ONLY: module_interface_3d_data_averaging |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | IMPLICIT NONE |
---|
78 | |
---|
79 | INTEGER(iwp) :: i !< loop index |
---|
80 | INTEGER(iwp) :: ii !< loop index |
---|
81 | INTEGER(iwp) :: j !< loop index |
---|
82 | INTEGER(iwp) :: k !< loop index |
---|
83 | |
---|
84 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
85 | |
---|
86 | |
---|
87 | CALL cpu_log (log_point(35),'average_3d_data','start') |
---|
88 | |
---|
89 | ! |
---|
90 | !-- Check, if averaging is necessary |
---|
91 | IF ( average_count_3d <= 1 ) RETURN |
---|
92 | |
---|
93 | ! |
---|
94 | !-- Loop of all variables to be averaged. |
---|
95 | DO ii = 1, doav_n |
---|
96 | |
---|
97 | trimvar = TRIM( doav(ii) ) |
---|
98 | |
---|
99 | ! |
---|
100 | !-- Store the array chosen on the temporary array. |
---|
101 | SELECT CASE ( trimvar ) |
---|
102 | |
---|
103 | CASE ( 'e' ) |
---|
104 | IF ( ALLOCATED( e_av ) ) THEN |
---|
105 | DO i = nxlg, nxrg |
---|
106 | DO j = nysg, nyng |
---|
107 | DO k = nzb, nzt+1 |
---|
108 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
109 | ENDDO |
---|
110 | ENDDO |
---|
111 | ENDDO |
---|
112 | ENDIF |
---|
113 | |
---|
114 | CASE ( 'ghf*' ) |
---|
115 | IF ( ALLOCATED( ghf_av ) ) THEN |
---|
116 | DO i = nxl, nxr |
---|
117 | DO j = nys, nyn |
---|
118 | ghf_av(j,i) = ghf_av(j,i) & |
---|
119 | / REAL( average_count_3d, KIND=wp ) |
---|
120 | ENDDO |
---|
121 | ENDDO |
---|
122 | CALL exchange_horiz_2d( ghf_av, nbgp ) |
---|
123 | ENDIF |
---|
124 | |
---|
125 | CASE ( 'qsws*' ) |
---|
126 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
127 | DO i = nxlg, nxrg |
---|
128 | DO j = nysg, nyng |
---|
129 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
130 | ENDDO |
---|
131 | ENDDO |
---|
132 | CALL exchange_horiz_2d( qsws_av, nbgp ) |
---|
133 | ENDIF |
---|
134 | |
---|
135 | CASE ( 'thetal' ) |
---|
136 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
137 | DO i = nxlg, nxrg |
---|
138 | DO j = nysg, nyng |
---|
139 | DO k = nzb, nzt+1 |
---|
140 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
141 | ENDDO |
---|
142 | ENDDO |
---|
143 | ENDDO |
---|
144 | ENDIF |
---|
145 | |
---|
146 | CASE ( 'lwp*' ) |
---|
147 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
148 | DO i = nxlg, nxrg |
---|
149 | DO j = nysg, nyng |
---|
150 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
151 | ENDDO |
---|
152 | ENDDO |
---|
153 | ENDIF |
---|
154 | |
---|
155 | CASE ( 'ol*' ) |
---|
156 | IF ( ALLOCATED( ol_av ) ) THEN |
---|
157 | DO i = nxlg, nxrg |
---|
158 | DO j = nysg, nyng |
---|
159 | ol_av(j,i) = ol_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
160 | ENDDO |
---|
161 | ENDDO |
---|
162 | CALL exchange_horiz_2d( ol_av, nbgp ) |
---|
163 | ENDIF |
---|
164 | |
---|
165 | CASE ( 'p' ) |
---|
166 | IF ( ALLOCATED( p_av ) ) THEN |
---|
167 | DO i = nxlg, nxrg |
---|
168 | DO j = nysg, nyng |
---|
169 | DO k = nzb, nzt+1 |
---|
170 | p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
171 | ENDDO |
---|
172 | ENDDO |
---|
173 | ENDDO |
---|
174 | ENDIF |
---|
175 | |
---|
176 | CASE ( 'pc' ) |
---|
177 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
178 | DO i = nxl, nxr |
---|
179 | DO j = nys, nyn |
---|
180 | DO k = nzb, nzt+1 |
---|
181 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
182 | ENDDO |
---|
183 | ENDDO |
---|
184 | ENDDO |
---|
185 | ENDIF |
---|
186 | |
---|
187 | CASE ( 'pr' ) |
---|
188 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
189 | DO i = nxl, nxr |
---|
190 | DO j = nys, nyn |
---|
191 | DO k = nzb, nzt+1 |
---|
192 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
193 | ENDDO |
---|
194 | ENDDO |
---|
195 | ENDDO |
---|
196 | ENDIF |
---|
197 | |
---|
198 | CASE ( 'theta' ) |
---|
199 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
200 | DO i = nxlg, nxrg |
---|
201 | DO j = nysg, nyng |
---|
202 | DO k = nzb, nzt+1 |
---|
203 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
204 | ENDDO |
---|
205 | ENDDO |
---|
206 | ENDDO |
---|
207 | ENDIF |
---|
208 | |
---|
209 | CASE ( 'q' ) |
---|
210 | IF ( ALLOCATED( q_av ) ) THEN |
---|
211 | DO i = nxlg, nxrg |
---|
212 | DO j = nysg, nyng |
---|
213 | DO k = nzb, nzt+1 |
---|
214 | q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
215 | ENDDO |
---|
216 | ENDDO |
---|
217 | ENDDO |
---|
218 | ENDIF |
---|
219 | |
---|
220 | CASE ( 'ql' ) |
---|
221 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
222 | DO i = nxlg, nxrg |
---|
223 | DO j = nysg, nyng |
---|
224 | DO k = nzb, nzt+1 |
---|
225 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
226 | ENDDO |
---|
227 | ENDDO |
---|
228 | ENDDO |
---|
229 | ENDIF |
---|
230 | |
---|
231 | CASE ( 'ql_c' ) |
---|
232 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
233 | DO i = nxlg, nxrg |
---|
234 | DO j = nysg, nyng |
---|
235 | DO k = nzb, nzt+1 |
---|
236 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
237 | ENDDO |
---|
238 | ENDDO |
---|
239 | ENDDO |
---|
240 | ENDIF |
---|
241 | |
---|
242 | CASE ( 'ql_v' ) |
---|
243 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
244 | DO i = nxlg, nxrg |
---|
245 | DO j = nysg, nyng |
---|
246 | DO k = nzb, nzt+1 |
---|
247 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
248 | ENDDO |
---|
249 | ENDDO |
---|
250 | ENDDO |
---|
251 | ENDIF |
---|
252 | |
---|
253 | CASE ( 'ql_vp' ) |
---|
254 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
255 | DO i = nxlg, nxrg |
---|
256 | DO j = nysg, nyng |
---|
257 | DO k = nzb, nzt+1 |
---|
258 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & |
---|
259 | REAL( average_count_3d, KIND=wp ) |
---|
260 | ENDDO |
---|
261 | ENDDO |
---|
262 | ENDDO |
---|
263 | ENDIF |
---|
264 | |
---|
265 | CASE ( 'qv' ) |
---|
266 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
267 | DO i = nxlg, nxrg |
---|
268 | DO j = nysg, nyng |
---|
269 | DO k = nzb, nzt+1 |
---|
270 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
271 | ENDDO |
---|
272 | ENDDO |
---|
273 | ENDDO |
---|
274 | ENDIF |
---|
275 | |
---|
276 | CASE ( 'r_a*' ) |
---|
277 | IF ( ALLOCATED( r_a_av ) ) THEN |
---|
278 | DO i = nxlg, nxrg |
---|
279 | DO j = nysg, nyng |
---|
280 | r_a_av(j,i) = r_a_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
281 | ENDDO |
---|
282 | ENDDO |
---|
283 | CALL exchange_horiz_2d( r_a_av, nbgp ) |
---|
284 | ENDIF |
---|
285 | |
---|
286 | CASE ( 's' ) |
---|
287 | IF ( ALLOCATED( s_av ) ) THEN |
---|
288 | DO i = nxlg, nxrg |
---|
289 | DO j = nysg, nyng |
---|
290 | DO k = nzb, nzt+1 |
---|
291 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
292 | ENDDO |
---|
293 | ENDDO |
---|
294 | ENDDO |
---|
295 | ENDIF |
---|
296 | |
---|
297 | CASE ( 'shf*' ) |
---|
298 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
299 | DO i = nxlg, nxrg |
---|
300 | DO j = nysg, nyng |
---|
301 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
302 | ENDDO |
---|
303 | ENDDO |
---|
304 | CALL exchange_horiz_2d( shf_av, nbgp ) |
---|
305 | ENDIF |
---|
306 | |
---|
307 | CASE ( 'ssws*' ) |
---|
308 | IF ( ALLOCATED( ssws_av ) ) THEN |
---|
309 | DO i = nxlg, nxrg |
---|
310 | DO j = nysg, nyng |
---|
311 | ssws_av(j,i) = ssws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
312 | ENDDO |
---|
313 | ENDDO |
---|
314 | CALL exchange_horiz_2d( ssws_av, nbgp ) |
---|
315 | ENDIF |
---|
316 | |
---|
317 | CASE ( 'theta_2m*' ) |
---|
318 | IF ( ALLOCATED( pt_2m_av ) ) THEN |
---|
319 | DO i = nxlg, nxrg |
---|
320 | DO j = nysg, nyng |
---|
321 | pt_2m_av(j,i) = pt_2m_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
322 | ENDDO |
---|
323 | ENDDO |
---|
324 | CALL exchange_horiz_2d( pt_2m_av, nbgp ) |
---|
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, nbgp ) |
---|
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, nbgp ) |
---|
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, nbgp ) |
---|
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, nbgp ) |
---|
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, nbgp ) |
---|
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, nbgp ) |
---|
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 |
---|