1 | !> @file average_3d_data.f90 |
---|
2 | !--------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
7 | ! either version 3 of the License, or (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with |
---|
14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: average_3d_data.f90 1976 2016-07-27 13:28:04Z suehring $ |
---|
26 | ! |
---|
27 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
28 | ! Output of land surface quantities is now done directly in the respective module |
---|
29 | ! |
---|
30 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
31 | ! Treat humidity and passive scalar separately |
---|
32 | ! |
---|
33 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
34 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
35 | ! |
---|
36 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
37 | ! Code annotations made doxygen readable |
---|
38 | ! |
---|
39 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
40 | ! Adapted for RRTMG |
---|
41 | ! |
---|
42 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
43 | ! Added output of r_a and r_s |
---|
44 | ! |
---|
45 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
46 | ! Added support for land surface and radiation model parameters. |
---|
47 | ! |
---|
48 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
49 | ! REAL functions provided with KIND-attribute |
---|
50 | ! |
---|
51 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
52 | ! ONLY-attribute added to USE-statements, |
---|
53 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
54 | ! kinds are defined in new module kinds, |
---|
55 | ! revision history before 2012 removed, |
---|
56 | ! comment fields (!:) to be used for variable explanations added to |
---|
57 | ! all variable declaration statements |
---|
58 | ! |
---|
59 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
60 | ! barrier argument removed from cpu_log, |
---|
61 | ! module interfaces removed |
---|
62 | ! |
---|
63 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
64 | ! +qc |
---|
65 | ! |
---|
66 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
67 | ! averaging of nr, qr added |
---|
68 | ! |
---|
69 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
70 | ! code put under GPL (PALM 3.9) |
---|
71 | ! |
---|
72 | ! 978 2012-08-09 08:28:32Z fricke |
---|
73 | ! +z0h_av |
---|
74 | ! |
---|
75 | ! Revision 1.1 2006/02/23 09:48:58 raasch |
---|
76 | ! Initial revision |
---|
77 | ! |
---|
78 | ! |
---|
79 | ! Description: |
---|
80 | ! ------------ |
---|
81 | !> Time-averaging of 3d-data-arrays. |
---|
82 | !------------------------------------------------------------------------------! |
---|
83 | SUBROUTINE average_3d_data |
---|
84 | |
---|
85 | |
---|
86 | USE averaging |
---|
87 | |
---|
88 | USE control_parameters, & |
---|
89 | ONLY: average_count_3d, doav, doav_n |
---|
90 | |
---|
91 | USE cpulog, & |
---|
92 | ONLY: cpu_log, log_point |
---|
93 | |
---|
94 | USE indices, & |
---|
95 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
96 | |
---|
97 | USE kinds |
---|
98 | |
---|
99 | USE land_surface_model_mod, & |
---|
100 | ONLY: land_surface, lsm_3d_data_averaging |
---|
101 | |
---|
102 | USE radiation_model_mod, & |
---|
103 | ONLY: radiation, radiation_3d_data_averaging |
---|
104 | |
---|
105 | |
---|
106 | IMPLICIT NONE |
---|
107 | |
---|
108 | INTEGER(iwp) :: i !< |
---|
109 | INTEGER(iwp) :: ii !< |
---|
110 | INTEGER(iwp) :: j !< |
---|
111 | INTEGER(iwp) :: k !< |
---|
112 | |
---|
113 | |
---|
114 | CALL cpu_log (log_point(35),'average_3d_data','start') |
---|
115 | |
---|
116 | ! |
---|
117 | !-- Check, if averaging is necessary |
---|
118 | IF ( average_count_3d <= 1 ) RETURN |
---|
119 | |
---|
120 | ! |
---|
121 | !-- Loop of all variables to be averaged. |
---|
122 | DO ii = 1, doav_n |
---|
123 | |
---|
124 | ! |
---|
125 | !-- Store the array chosen on the temporary array. |
---|
126 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
127 | |
---|
128 | CASE ( 'e' ) |
---|
129 | DO i = nxlg, nxrg |
---|
130 | DO j = nysg, nyng |
---|
131 | DO k = nzb, nzt+1 |
---|
132 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
133 | ENDDO |
---|
134 | ENDDO |
---|
135 | ENDDO |
---|
136 | |
---|
137 | CASE ( 'qsws*' ) |
---|
138 | DO i = nxlg, nxrg |
---|
139 | DO j = nysg, nyng |
---|
140 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
141 | ENDDO |
---|
142 | ENDDO |
---|
143 | |
---|
144 | CASE ( 'lpt' ) |
---|
145 | DO i = nxlg, nxrg |
---|
146 | DO j = nysg, nyng |
---|
147 | DO k = nzb, nzt+1 |
---|
148 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
149 | ENDDO |
---|
150 | ENDDO |
---|
151 | ENDDO |
---|
152 | |
---|
153 | CASE ( 'lwp*' ) |
---|
154 | DO i = nxlg, nxrg |
---|
155 | DO j = nysg, nyng |
---|
156 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
157 | ENDDO |
---|
158 | ENDDO |
---|
159 | |
---|
160 | CASE ( 'nr' ) |
---|
161 | DO i = nxlg, nxrg |
---|
162 | DO j = nysg, nyng |
---|
163 | DO k = nzb, nzt+1 |
---|
164 | nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
165 | ENDDO |
---|
166 | ENDDO |
---|
167 | ENDDO |
---|
168 | |
---|
169 | CASE ( 'ol*' ) |
---|
170 | DO i = nxlg, nxrg |
---|
171 | DO j = nysg, nyng |
---|
172 | ol_av(j,i) = ol_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
173 | ENDDO |
---|
174 | ENDDO |
---|
175 | |
---|
176 | CASE ( 'p' ) |
---|
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 | |
---|
185 | CASE ( 'pc' ) |
---|
186 | DO i = nxl, nxr |
---|
187 | DO j = nys, nyn |
---|
188 | DO k = nzb, nzt+1 |
---|
189 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
190 | ENDDO |
---|
191 | ENDDO |
---|
192 | ENDDO |
---|
193 | |
---|
194 | CASE ( 'pr' ) |
---|
195 | DO i = nxl, nxr |
---|
196 | DO j = nys, nyn |
---|
197 | DO k = nzb, nzt+1 |
---|
198 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
199 | ENDDO |
---|
200 | ENDDO |
---|
201 | ENDDO |
---|
202 | |
---|
203 | CASE ( 'prr*' ) |
---|
204 | DO i = nxlg, nxrg |
---|
205 | DO j = nysg, nyng |
---|
206 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / & |
---|
207 | REAL( average_count_3d, KIND=wp ) |
---|
208 | ENDDO |
---|
209 | ENDDO |
---|
210 | |
---|
211 | CASE ( 'pt' ) |
---|
212 | DO i = nxlg, nxrg |
---|
213 | DO j = nysg, nyng |
---|
214 | DO k = nzb, nzt+1 |
---|
215 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
216 | ENDDO |
---|
217 | ENDDO |
---|
218 | ENDDO |
---|
219 | |
---|
220 | CASE ( 'q' ) |
---|
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 | |
---|
229 | CASE ( 'qc' ) |
---|
230 | DO i = nxlg, nxrg |
---|
231 | DO j = nysg, nyng |
---|
232 | DO k = nzb, nzt+1 |
---|
233 | qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
234 | ENDDO |
---|
235 | ENDDO |
---|
236 | ENDDO |
---|
237 | |
---|
238 | CASE ( 'ql' ) |
---|
239 | DO i = nxlg, nxrg |
---|
240 | DO j = nysg, nyng |
---|
241 | DO k = nzb, nzt+1 |
---|
242 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
243 | ENDDO |
---|
244 | ENDDO |
---|
245 | ENDDO |
---|
246 | |
---|
247 | CASE ( 'ql_c' ) |
---|
248 | DO i = nxlg, nxrg |
---|
249 | DO j = nysg, nyng |
---|
250 | DO k = nzb, nzt+1 |
---|
251 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
252 | ENDDO |
---|
253 | ENDDO |
---|
254 | ENDDO |
---|
255 | |
---|
256 | CASE ( 'ql_v' ) |
---|
257 | DO i = nxlg, nxrg |
---|
258 | DO j = nysg, nyng |
---|
259 | DO k = nzb, nzt+1 |
---|
260 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
261 | ENDDO |
---|
262 | ENDDO |
---|
263 | ENDDO |
---|
264 | |
---|
265 | CASE ( 'ql_vp' ) |
---|
266 | DO i = nxlg, nxrg |
---|
267 | DO j = nysg, nyng |
---|
268 | DO k = nzb, nzt+1 |
---|
269 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & |
---|
270 | REAL( average_count_3d, KIND=wp ) |
---|
271 | ENDDO |
---|
272 | ENDDO |
---|
273 | ENDDO |
---|
274 | |
---|
275 | CASE ( 'qr' ) |
---|
276 | DO i = nxlg, nxrg |
---|
277 | DO j = nysg, nyng |
---|
278 | DO k = nzb, nzt+1 |
---|
279 | qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
280 | ENDDO |
---|
281 | ENDDO |
---|
282 | ENDDO |
---|
283 | |
---|
284 | CASE ( 'qv' ) |
---|
285 | DO i = nxlg, nxrg |
---|
286 | DO j = nysg, nyng |
---|
287 | DO k = nzb, nzt+1 |
---|
288 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
289 | ENDDO |
---|
290 | ENDDO |
---|
291 | ENDDO |
---|
292 | |
---|
293 | CASE ( 'rho' ) |
---|
294 | DO i = nxlg, nxrg |
---|
295 | DO j = nysg, nyng |
---|
296 | DO k = nzb, nzt+1 |
---|
297 | rho_av(k,j,i) = rho_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
298 | ENDDO |
---|
299 | ENDDO |
---|
300 | ENDDO |
---|
301 | |
---|
302 | CASE ( 's' ) |
---|
303 | DO i = nxlg, nxrg |
---|
304 | DO j = nysg, nyng |
---|
305 | DO k = nzb, nzt+1 |
---|
306 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
307 | ENDDO |
---|
308 | ENDDO |
---|
309 | ENDDO |
---|
310 | |
---|
311 | CASE ( 'sa' ) |
---|
312 | DO i = nxlg, nxrg |
---|
313 | DO j = nysg, nyng |
---|
314 | DO k = nzb, nzt+1 |
---|
315 | sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
316 | ENDDO |
---|
317 | ENDDO |
---|
318 | ENDDO |
---|
319 | |
---|
320 | CASE ( 'shf*' ) |
---|
321 | DO i = nxlg, nxrg |
---|
322 | DO j = nysg, nyng |
---|
323 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
324 | ENDDO |
---|
325 | ENDDO |
---|
326 | |
---|
327 | CASE ( 'ssws*' ) |
---|
328 | DO i = nxlg, nxrg |
---|
329 | DO j = nysg, nyng |
---|
330 | ssws_av(j,i) = ssws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
331 | ENDDO |
---|
332 | ENDDO |
---|
333 | |
---|
334 | CASE ( 't*' ) |
---|
335 | DO i = nxlg, nxrg |
---|
336 | DO j = nysg, nyng |
---|
337 | ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
338 | ENDDO |
---|
339 | ENDDO |
---|
340 | |
---|
341 | CASE ( 'u' ) |
---|
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 | |
---|
350 | CASE ( 'u*' ) |
---|
351 | DO i = nxlg, nxrg |
---|
352 | DO j = nysg, nyng |
---|
353 | us_av(j,i) = us_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
354 | ENDDO |
---|
355 | ENDDO |
---|
356 | |
---|
357 | CASE ( 'v' ) |
---|
358 | DO i = nxlg, nxrg |
---|
359 | DO j = nysg, nyng |
---|
360 | DO k = nzb, nzt+1 |
---|
361 | v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
362 | ENDDO |
---|
363 | ENDDO |
---|
364 | ENDDO |
---|
365 | |
---|
366 | CASE ( 'vpt' ) |
---|
367 | DO i = nxlg, nxrg |
---|
368 | DO j = nysg, nyng |
---|
369 | DO k = nzb, nzt+1 |
---|
370 | vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
371 | ENDDO |
---|
372 | ENDDO |
---|
373 | ENDDO |
---|
374 | |
---|
375 | CASE ( 'w' ) |
---|
376 | DO i = nxlg, nxrg |
---|
377 | DO j = nysg, nyng |
---|
378 | DO k = nzb, nzt+1 |
---|
379 | w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
380 | ENDDO |
---|
381 | ENDDO |
---|
382 | ENDDO |
---|
383 | |
---|
384 | CASE ( 'z0*' ) |
---|
385 | DO i = nxlg, nxrg |
---|
386 | DO j = nysg, nyng |
---|
387 | z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
388 | ENDDO |
---|
389 | ENDDO |
---|
390 | |
---|
391 | CASE ( 'z0h*' ) |
---|
392 | DO i = nxlg, nxrg |
---|
393 | DO j = nysg, nyng |
---|
394 | z0h_av(j,i) = z0h_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
395 | ENDDO |
---|
396 | ENDDO |
---|
397 | |
---|
398 | CASE DEFAULT |
---|
399 | ! |
---|
400 | !-- Land surface quantity |
---|
401 | IF ( land_surface ) THEN |
---|
402 | CALL lsm_3d_data_averaging( 'average', doav(ii) ) |
---|
403 | ENDIF |
---|
404 | |
---|
405 | ! |
---|
406 | !-- Radiation quantity |
---|
407 | IF ( radiation ) THEN |
---|
408 | CALL radiation_3d_data_averaging( 'average', doav(ii) ) |
---|
409 | ENDIF |
---|
410 | |
---|
411 | ! |
---|
412 | !-- User-defined quantity |
---|
413 | CALL user_3d_data_averaging( 'average', doav(ii) ) |
---|
414 | |
---|
415 | END SELECT |
---|
416 | |
---|
417 | ENDDO |
---|
418 | |
---|
419 | ! |
---|
420 | !-- Reset the counter |
---|
421 | average_count_3d = 0.0 |
---|
422 | |
---|
423 | CALL cpu_log( log_point(35), 'average_3d_data', 'stop' ) |
---|
424 | |
---|
425 | |
---|
426 | END SUBROUTINE average_3d_data |
---|