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 |
---|
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-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: average_3d_data.f90 2101 2017-01-05 16:42:31Z kanani $ |
---|
27 | ! |
---|
28 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
29 | ! renamed variable rho to rho_ocean and rho_av to rho_ocean_av |
---|
30 | ! |
---|
31 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
32 | ! Flag urban_surface is now defined in module control_parameters, |
---|
33 | ! changed prefix for urban surface model output to "usm_", |
---|
34 | ! introduced control parameter varnamelength for LEN of trimvar. |
---|
35 | ! |
---|
36 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
37 | ! Added support for new urban surface model (temporary modifications of |
---|
38 | ! SELECT CASE ( ) necessary, see variable trimvar), |
---|
39 | ! added comments in variable declaration section |
---|
40 | ! |
---|
41 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
42 | ! Forced header and separation lines into 80 columns |
---|
43 | ! |
---|
44 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
45 | ! Output of land surface quantities is now done directly in the respective module |
---|
46 | ! |
---|
47 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
48 | ! Treat humidity and passive scalar separately |
---|
49 | ! |
---|
50 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
51 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
52 | ! |
---|
53 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
54 | ! Code annotations made doxygen readable |
---|
55 | ! |
---|
56 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
57 | ! Adapted for RRTMG |
---|
58 | ! |
---|
59 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
60 | ! Added output of r_a and r_s |
---|
61 | ! |
---|
62 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
63 | ! Added support for land surface and radiation model parameters. |
---|
64 | ! |
---|
65 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
66 | ! REAL functions provided with KIND-attribute |
---|
67 | ! |
---|
68 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
69 | ! ONLY-attribute added to USE-statements, |
---|
70 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
71 | ! kinds are defined in new module kinds, |
---|
72 | ! revision history before 2012 removed, |
---|
73 | ! comment fields (!:) to be used for variable explanations added to |
---|
74 | ! all variable declaration statements |
---|
75 | ! |
---|
76 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
77 | ! barrier argument removed from cpu_log, |
---|
78 | ! module interfaces removed |
---|
79 | ! |
---|
80 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
81 | ! +qc |
---|
82 | ! |
---|
83 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
84 | ! averaging of nr, qr added |
---|
85 | ! |
---|
86 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
87 | ! code put under GPL (PALM 3.9) |
---|
88 | ! |
---|
89 | ! 978 2012-08-09 08:28:32Z fricke |
---|
90 | ! +z0h_av |
---|
91 | ! |
---|
92 | ! Revision 1.1 2006/02/23 09:48:58 raasch |
---|
93 | ! Initial revision |
---|
94 | ! |
---|
95 | ! |
---|
96 | ! Description: |
---|
97 | ! ------------ |
---|
98 | !> Time-averaging of 3d-data-arrays. |
---|
99 | !------------------------------------------------------------------------------! |
---|
100 | SUBROUTINE average_3d_data |
---|
101 | |
---|
102 | |
---|
103 | USE averaging |
---|
104 | |
---|
105 | USE control_parameters, & |
---|
106 | ONLY: average_count_3d, doav, doav_n, urban_surface, varnamelength |
---|
107 | |
---|
108 | USE cpulog, & |
---|
109 | ONLY: cpu_log, log_point |
---|
110 | |
---|
111 | USE indices, & |
---|
112 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
113 | |
---|
114 | USE kinds |
---|
115 | |
---|
116 | USE land_surface_model_mod, & |
---|
117 | ONLY: land_surface, lsm_3d_data_averaging |
---|
118 | |
---|
119 | USE radiation_model_mod, & |
---|
120 | ONLY: radiation, radiation_3d_data_averaging |
---|
121 | |
---|
122 | USE urban_surface_mod, & |
---|
123 | ONLY: usm_average_3d_data |
---|
124 | |
---|
125 | |
---|
126 | IMPLICIT NONE |
---|
127 | |
---|
128 | INTEGER(iwp) :: i !< running index |
---|
129 | INTEGER(iwp) :: ii !< running index |
---|
130 | INTEGER(iwp) :: j !< running index |
---|
131 | INTEGER(iwp) :: k !< running index |
---|
132 | |
---|
133 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
134 | |
---|
135 | |
---|
136 | CALL cpu_log (log_point(35),'average_3d_data','start') |
---|
137 | |
---|
138 | ! |
---|
139 | !-- Check, if averaging is necessary |
---|
140 | IF ( average_count_3d <= 1 ) RETURN |
---|
141 | |
---|
142 | ! |
---|
143 | !-- Loop of all variables to be averaged. |
---|
144 | DO ii = 1, doav_n |
---|
145 | |
---|
146 | ! |
---|
147 | !-- Temporary solution to account for data output within the new urban |
---|
148 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
149 | trimvar = TRIM( doav(ii) ) |
---|
150 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
151 | trimvar = 'usm_output' |
---|
152 | ENDIF |
---|
153 | |
---|
154 | ! |
---|
155 | !-- Store the array chosen on the temporary array. |
---|
156 | SELECT CASE ( trimvar ) |
---|
157 | |
---|
158 | CASE ( 'e' ) |
---|
159 | DO i = nxlg, nxrg |
---|
160 | DO j = nysg, nyng |
---|
161 | DO k = nzb, nzt+1 |
---|
162 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
163 | ENDDO |
---|
164 | ENDDO |
---|
165 | ENDDO |
---|
166 | |
---|
167 | CASE ( 'qsws*' ) |
---|
168 | DO i = nxlg, nxrg |
---|
169 | DO j = nysg, nyng |
---|
170 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
171 | ENDDO |
---|
172 | ENDDO |
---|
173 | |
---|
174 | CASE ( 'lpt' ) |
---|
175 | DO i = nxlg, nxrg |
---|
176 | DO j = nysg, nyng |
---|
177 | DO k = nzb, nzt+1 |
---|
178 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
179 | ENDDO |
---|
180 | ENDDO |
---|
181 | ENDDO |
---|
182 | |
---|
183 | CASE ( 'lwp*' ) |
---|
184 | DO i = nxlg, nxrg |
---|
185 | DO j = nysg, nyng |
---|
186 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
187 | ENDDO |
---|
188 | ENDDO |
---|
189 | |
---|
190 | CASE ( 'nr' ) |
---|
191 | DO i = nxlg, nxrg |
---|
192 | DO j = nysg, nyng |
---|
193 | DO k = nzb, nzt+1 |
---|
194 | nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
195 | ENDDO |
---|
196 | ENDDO |
---|
197 | ENDDO |
---|
198 | |
---|
199 | CASE ( 'ol*' ) |
---|
200 | DO i = nxlg, nxrg |
---|
201 | DO j = nysg, nyng |
---|
202 | ol_av(j,i) = ol_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
203 | ENDDO |
---|
204 | ENDDO |
---|
205 | |
---|
206 | CASE ( 'p' ) |
---|
207 | DO i = nxlg, nxrg |
---|
208 | DO j = nysg, nyng |
---|
209 | DO k = nzb, nzt+1 |
---|
210 | p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
211 | ENDDO |
---|
212 | ENDDO |
---|
213 | ENDDO |
---|
214 | |
---|
215 | CASE ( 'pc' ) |
---|
216 | DO i = nxl, nxr |
---|
217 | DO j = nys, nyn |
---|
218 | DO k = nzb, nzt+1 |
---|
219 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
220 | ENDDO |
---|
221 | ENDDO |
---|
222 | ENDDO |
---|
223 | |
---|
224 | CASE ( 'pr' ) |
---|
225 | DO i = nxl, nxr |
---|
226 | DO j = nys, nyn |
---|
227 | DO k = nzb, nzt+1 |
---|
228 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
229 | ENDDO |
---|
230 | ENDDO |
---|
231 | ENDDO |
---|
232 | |
---|
233 | CASE ( 'prr*' ) |
---|
234 | DO i = nxlg, nxrg |
---|
235 | DO j = nysg, nyng |
---|
236 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / & |
---|
237 | REAL( average_count_3d, KIND=wp ) |
---|
238 | ENDDO |
---|
239 | ENDDO |
---|
240 | |
---|
241 | CASE ( 'pt' ) |
---|
242 | DO i = nxlg, nxrg |
---|
243 | DO j = nysg, nyng |
---|
244 | DO k = nzb, nzt+1 |
---|
245 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
246 | ENDDO |
---|
247 | ENDDO |
---|
248 | ENDDO |
---|
249 | |
---|
250 | CASE ( 'q' ) |
---|
251 | DO i = nxlg, nxrg |
---|
252 | DO j = nysg, nyng |
---|
253 | DO k = nzb, nzt+1 |
---|
254 | q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
255 | ENDDO |
---|
256 | ENDDO |
---|
257 | ENDDO |
---|
258 | |
---|
259 | CASE ( 'qc' ) |
---|
260 | DO i = nxlg, nxrg |
---|
261 | DO j = nysg, nyng |
---|
262 | DO k = nzb, nzt+1 |
---|
263 | qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
264 | ENDDO |
---|
265 | ENDDO |
---|
266 | ENDDO |
---|
267 | |
---|
268 | CASE ( 'ql' ) |
---|
269 | DO i = nxlg, nxrg |
---|
270 | DO j = nysg, nyng |
---|
271 | DO k = nzb, nzt+1 |
---|
272 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
273 | ENDDO |
---|
274 | ENDDO |
---|
275 | ENDDO |
---|
276 | |
---|
277 | CASE ( 'ql_c' ) |
---|
278 | DO i = nxlg, nxrg |
---|
279 | DO j = nysg, nyng |
---|
280 | DO k = nzb, nzt+1 |
---|
281 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
282 | ENDDO |
---|
283 | ENDDO |
---|
284 | ENDDO |
---|
285 | |
---|
286 | CASE ( 'ql_v' ) |
---|
287 | DO i = nxlg, nxrg |
---|
288 | DO j = nysg, nyng |
---|
289 | DO k = nzb, nzt+1 |
---|
290 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
291 | ENDDO |
---|
292 | ENDDO |
---|
293 | ENDDO |
---|
294 | |
---|
295 | CASE ( 'ql_vp' ) |
---|
296 | DO i = nxlg, nxrg |
---|
297 | DO j = nysg, nyng |
---|
298 | DO k = nzb, nzt+1 |
---|
299 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & |
---|
300 | REAL( average_count_3d, KIND=wp ) |
---|
301 | ENDDO |
---|
302 | ENDDO |
---|
303 | ENDDO |
---|
304 | |
---|
305 | CASE ( 'qr' ) |
---|
306 | DO i = nxlg, nxrg |
---|
307 | DO j = nysg, nyng |
---|
308 | DO k = nzb, nzt+1 |
---|
309 | qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
310 | ENDDO |
---|
311 | ENDDO |
---|
312 | ENDDO |
---|
313 | |
---|
314 | CASE ( 'qv' ) |
---|
315 | DO i = nxlg, nxrg |
---|
316 | DO j = nysg, nyng |
---|
317 | DO k = nzb, nzt+1 |
---|
318 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
319 | ENDDO |
---|
320 | ENDDO |
---|
321 | ENDDO |
---|
322 | |
---|
323 | CASE ( 'rho_ocean' ) |
---|
324 | DO i = nxlg, nxrg |
---|
325 | DO j = nysg, nyng |
---|
326 | DO k = nzb, nzt+1 |
---|
327 | rho_ocean_av(k,j,i) = rho_ocean_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
328 | ENDDO |
---|
329 | ENDDO |
---|
330 | ENDDO |
---|
331 | |
---|
332 | CASE ( 's' ) |
---|
333 | DO i = nxlg, nxrg |
---|
334 | DO j = nysg, nyng |
---|
335 | DO k = nzb, nzt+1 |
---|
336 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
337 | ENDDO |
---|
338 | ENDDO |
---|
339 | ENDDO |
---|
340 | |
---|
341 | CASE ( 'sa' ) |
---|
342 | DO i = nxlg, nxrg |
---|
343 | DO j = nysg, nyng |
---|
344 | DO k = nzb, nzt+1 |
---|
345 | sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
346 | ENDDO |
---|
347 | ENDDO |
---|
348 | ENDDO |
---|
349 | |
---|
350 | CASE ( 'shf*' ) |
---|
351 | DO i = nxlg, nxrg |
---|
352 | DO j = nysg, nyng |
---|
353 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
354 | ENDDO |
---|
355 | ENDDO |
---|
356 | |
---|
357 | CASE ( 'ssws*' ) |
---|
358 | DO i = nxlg, nxrg |
---|
359 | DO j = nysg, nyng |
---|
360 | ssws_av(j,i) = ssws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
361 | ENDDO |
---|
362 | ENDDO |
---|
363 | |
---|
364 | CASE ( 't*' ) |
---|
365 | DO i = nxlg, nxrg |
---|
366 | DO j = nysg, nyng |
---|
367 | ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
368 | ENDDO |
---|
369 | ENDDO |
---|
370 | |
---|
371 | CASE ( 'u' ) |
---|
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 | |
---|
380 | CASE ( 'u*' ) |
---|
381 | DO i = nxlg, nxrg |
---|
382 | DO j = nysg, nyng |
---|
383 | us_av(j,i) = us_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
384 | ENDDO |
---|
385 | ENDDO |
---|
386 | |
---|
387 | CASE ( 'v' ) |
---|
388 | DO i = nxlg, nxrg |
---|
389 | DO j = nysg, nyng |
---|
390 | DO k = nzb, nzt+1 |
---|
391 | v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
392 | ENDDO |
---|
393 | ENDDO |
---|
394 | ENDDO |
---|
395 | |
---|
396 | CASE ( 'vpt' ) |
---|
397 | DO i = nxlg, nxrg |
---|
398 | DO j = nysg, nyng |
---|
399 | DO k = nzb, nzt+1 |
---|
400 | vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
401 | ENDDO |
---|
402 | ENDDO |
---|
403 | ENDDO |
---|
404 | |
---|
405 | CASE ( 'w' ) |
---|
406 | DO i = nxlg, nxrg |
---|
407 | DO j = nysg, nyng |
---|
408 | DO k = nzb, nzt+1 |
---|
409 | w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
410 | ENDDO |
---|
411 | ENDDO |
---|
412 | ENDDO |
---|
413 | |
---|
414 | CASE ( 'z0*' ) |
---|
415 | DO i = nxlg, nxrg |
---|
416 | DO j = nysg, nyng |
---|
417 | z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
418 | ENDDO |
---|
419 | ENDDO |
---|
420 | |
---|
421 | CASE ( 'z0h*' ) |
---|
422 | DO i = nxlg, nxrg |
---|
423 | DO j = nysg, nyng |
---|
424 | z0h_av(j,i) = z0h_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
425 | ENDDO |
---|
426 | ENDDO |
---|
427 | ! |
---|
428 | !-- Block of urban surface model outputs |
---|
429 | CASE ( 'usm_output' ) |
---|
430 | CALL usm_average_3d_data( 'average', doav(ii) ) |
---|
431 | |
---|
432 | CASE DEFAULT |
---|
433 | ! |
---|
434 | !-- Land surface quantity |
---|
435 | IF ( land_surface ) THEN |
---|
436 | CALL lsm_3d_data_averaging( 'average', doav(ii) ) |
---|
437 | ENDIF |
---|
438 | |
---|
439 | ! |
---|
440 | !-- Radiation quantity |
---|
441 | IF ( radiation ) THEN |
---|
442 | CALL radiation_3d_data_averaging( 'average', doav(ii) ) |
---|
443 | ENDIF |
---|
444 | |
---|
445 | ! |
---|
446 | !-- User-defined quantity |
---|
447 | CALL user_3d_data_averaging( 'average', doav(ii) ) |
---|
448 | |
---|
449 | END SELECT |
---|
450 | |
---|
451 | ENDDO |
---|
452 | |
---|
453 | ! |
---|
454 | !-- Reset the counter |
---|
455 | average_count_3d = 0.0 |
---|
456 | |
---|
457 | CALL cpu_log( log_point(35), 'average_3d_data', 'stop' ) |
---|
458 | |
---|
459 | |
---|
460 | END SUBROUTINE average_3d_data |
---|