1 | SUBROUTINE average_3d_data |
---|
2 | |
---|
3 | !--------------------------------------------------------------------------------! |
---|
4 | ! This file is part of PALM. |
---|
5 | ! |
---|
6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
8 | ! either version 3 of the License, or (at your option) any later 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-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: average_3d_data.f90 1323 2014-03-20 17:09:54Z raasch $ |
---|
27 | ! |
---|
28 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
29 | ! REAL functions provided with KIND-attribute |
---|
30 | ! |
---|
31 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
32 | ! ONLY-attribute added to USE-statements, |
---|
33 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
34 | ! kinds are defined in new module kinds, |
---|
35 | ! revision history before 2012 removed, |
---|
36 | ! comment fields (!:) to be used for variable explanations added to |
---|
37 | ! all variable declaration statements |
---|
38 | ! |
---|
39 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
40 | ! barrier argument removed from cpu_log, |
---|
41 | ! module interfaces removed |
---|
42 | ! |
---|
43 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
44 | ! +qc |
---|
45 | ! |
---|
46 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
47 | ! averaging of nr, qr added |
---|
48 | ! |
---|
49 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
50 | ! code put under GPL (PALM 3.9) |
---|
51 | ! |
---|
52 | ! 978 2012-08-09 08:28:32Z fricke |
---|
53 | ! +z0h_av |
---|
54 | ! |
---|
55 | ! Revision 1.1 2006/02/23 09:48:58 raasch |
---|
56 | ! Initial revision |
---|
57 | ! |
---|
58 | ! |
---|
59 | ! Description: |
---|
60 | ! ------------ |
---|
61 | ! Time-averaging of 3d-data-arrays. |
---|
62 | !------------------------------------------------------------------------------! |
---|
63 | |
---|
64 | USE averaging |
---|
65 | |
---|
66 | USE control_parameters, & |
---|
67 | ONLY: average_count_3d, doav, doav_n |
---|
68 | |
---|
69 | USE cpulog, & |
---|
70 | ONLY: cpu_log, log_point |
---|
71 | |
---|
72 | USE indices, & |
---|
73 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
74 | |
---|
75 | USE kinds |
---|
76 | |
---|
77 | |
---|
78 | IMPLICIT NONE |
---|
79 | |
---|
80 | INTEGER(iwp) :: i !: |
---|
81 | INTEGER(iwp) :: ii !: |
---|
82 | INTEGER(iwp) :: j !: |
---|
83 | INTEGER(iwp) :: k !: |
---|
84 | |
---|
85 | |
---|
86 | CALL cpu_log (log_point(35),'average_3d_data','start') |
---|
87 | |
---|
88 | ! |
---|
89 | !-- Check, if averaging is necessary |
---|
90 | IF ( average_count_3d <= 1 ) RETURN |
---|
91 | |
---|
92 | ! |
---|
93 | !-- Loop of all variables to be averaged. |
---|
94 | DO ii = 1, doav_n |
---|
95 | |
---|
96 | ! |
---|
97 | !-- Store the array chosen on the temporary array. |
---|
98 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
99 | |
---|
100 | CASE ( 'e' ) |
---|
101 | DO i = nxlg, nxrg |
---|
102 | DO j = nysg, nyng |
---|
103 | DO k = nzb, nzt+1 |
---|
104 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
105 | ENDDO |
---|
106 | ENDDO |
---|
107 | ENDDO |
---|
108 | |
---|
109 | CASE ( 'qsws*' ) |
---|
110 | DO i = nxlg, nxrg |
---|
111 | DO j = nysg, nyng |
---|
112 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
113 | ENDDO |
---|
114 | ENDDO |
---|
115 | |
---|
116 | CASE ( 'lpt' ) |
---|
117 | DO i = nxlg, nxrg |
---|
118 | DO j = nysg, nyng |
---|
119 | DO k = nzb, nzt+1 |
---|
120 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
121 | ENDDO |
---|
122 | ENDDO |
---|
123 | ENDDO |
---|
124 | |
---|
125 | CASE ( 'lwp*' ) |
---|
126 | DO i = nxlg, nxrg |
---|
127 | DO j = nysg, nyng |
---|
128 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
129 | ENDDO |
---|
130 | ENDDO |
---|
131 | |
---|
132 | CASE ( 'nr' ) |
---|
133 | DO i = nxlg, nxrg |
---|
134 | DO j = nysg, nyng |
---|
135 | DO k = nzb, nzt+1 |
---|
136 | nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
137 | ENDDO |
---|
138 | ENDDO |
---|
139 | ENDDO |
---|
140 | |
---|
141 | CASE ( 'p' ) |
---|
142 | DO i = nxlg, nxrg |
---|
143 | DO j = nysg, nyng |
---|
144 | DO k = nzb, nzt+1 |
---|
145 | p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
146 | ENDDO |
---|
147 | ENDDO |
---|
148 | ENDDO |
---|
149 | |
---|
150 | CASE ( 'pc' ) |
---|
151 | DO i = nxl, nxr |
---|
152 | DO j = nys, nyn |
---|
153 | DO k = nzb, nzt+1 |
---|
154 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
155 | ENDDO |
---|
156 | ENDDO |
---|
157 | ENDDO |
---|
158 | |
---|
159 | CASE ( 'pr' ) |
---|
160 | DO i = nxl, nxr |
---|
161 | DO j = nys, nyn |
---|
162 | DO k = nzb, nzt+1 |
---|
163 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
164 | ENDDO |
---|
165 | ENDDO |
---|
166 | ENDDO |
---|
167 | |
---|
168 | CASE ( 'prr*' ) |
---|
169 | DO i = nxlg, nxrg |
---|
170 | DO j = nysg, nyng |
---|
171 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / & |
---|
172 | REAL( average_count_3d, KIND=wp ) |
---|
173 | ENDDO |
---|
174 | ENDDO |
---|
175 | |
---|
176 | CASE ( 'pt' ) |
---|
177 | DO i = nxlg, nxrg |
---|
178 | DO j = nysg, nyng |
---|
179 | DO k = nzb, nzt+1 |
---|
180 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
181 | ENDDO |
---|
182 | ENDDO |
---|
183 | ENDDO |
---|
184 | |
---|
185 | CASE ( 'q' ) |
---|
186 | DO i = nxlg, nxrg |
---|
187 | DO j = nysg, nyng |
---|
188 | DO k = nzb, nzt+1 |
---|
189 | q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
190 | ENDDO |
---|
191 | ENDDO |
---|
192 | ENDDO |
---|
193 | |
---|
194 | CASE ( 'qc' ) |
---|
195 | DO i = nxlg, nxrg |
---|
196 | DO j = nysg, nyng |
---|
197 | DO k = nzb, nzt+1 |
---|
198 | qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
199 | ENDDO |
---|
200 | ENDDO |
---|
201 | ENDDO |
---|
202 | |
---|
203 | CASE ( 'ql' ) |
---|
204 | DO i = nxlg, nxrg |
---|
205 | DO j = nysg, nyng |
---|
206 | DO k = nzb, nzt+1 |
---|
207 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
208 | ENDDO |
---|
209 | ENDDO |
---|
210 | ENDDO |
---|
211 | |
---|
212 | CASE ( 'ql_c' ) |
---|
213 | DO i = nxlg, nxrg |
---|
214 | DO j = nysg, nyng |
---|
215 | DO k = nzb, nzt+1 |
---|
216 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
217 | ENDDO |
---|
218 | ENDDO |
---|
219 | ENDDO |
---|
220 | |
---|
221 | CASE ( 'ql_v' ) |
---|
222 | DO i = nxlg, nxrg |
---|
223 | DO j = nysg, nyng |
---|
224 | DO k = nzb, nzt+1 |
---|
225 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
226 | ENDDO |
---|
227 | ENDDO |
---|
228 | ENDDO |
---|
229 | |
---|
230 | CASE ( 'ql_vp' ) |
---|
231 | DO i = nxlg, nxrg |
---|
232 | DO j = nysg, nyng |
---|
233 | DO k = nzb, nzt+1 |
---|
234 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & |
---|
235 | REAL( average_count_3d, KIND=wp ) |
---|
236 | ENDDO |
---|
237 | ENDDO |
---|
238 | ENDDO |
---|
239 | |
---|
240 | CASE ( 'qr' ) |
---|
241 | DO i = nxlg, nxrg |
---|
242 | DO j = nysg, nyng |
---|
243 | DO k = nzb, nzt+1 |
---|
244 | qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
245 | ENDDO |
---|
246 | ENDDO |
---|
247 | ENDDO |
---|
248 | |
---|
249 | CASE ( 'qv' ) |
---|
250 | DO i = nxlg, nxrg |
---|
251 | DO j = nysg, nyng |
---|
252 | DO k = nzb, nzt+1 |
---|
253 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
254 | ENDDO |
---|
255 | ENDDO |
---|
256 | ENDDO |
---|
257 | |
---|
258 | CASE ( 'rho' ) |
---|
259 | DO i = nxlg, nxrg |
---|
260 | DO j = nysg, nyng |
---|
261 | DO k = nzb, nzt+1 |
---|
262 | rho_av(k,j,i) = rho_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
263 | ENDDO |
---|
264 | ENDDO |
---|
265 | ENDDO |
---|
266 | |
---|
267 | CASE ( 's' ) |
---|
268 | DO i = nxlg, nxrg |
---|
269 | DO j = nysg, nyng |
---|
270 | DO k = nzb, nzt+1 |
---|
271 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
272 | ENDDO |
---|
273 | ENDDO |
---|
274 | ENDDO |
---|
275 | |
---|
276 | CASE ( 'sa' ) |
---|
277 | DO i = nxlg, nxrg |
---|
278 | DO j = nysg, nyng |
---|
279 | DO k = nzb, nzt+1 |
---|
280 | sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
281 | ENDDO |
---|
282 | ENDDO |
---|
283 | ENDDO |
---|
284 | |
---|
285 | CASE ( 'shf*' ) |
---|
286 | DO i = nxlg, nxrg |
---|
287 | DO j = nysg, nyng |
---|
288 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
289 | ENDDO |
---|
290 | ENDDO |
---|
291 | |
---|
292 | CASE ( 't*' ) |
---|
293 | DO i = nxlg, nxrg |
---|
294 | DO j = nysg, nyng |
---|
295 | ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
296 | ENDDO |
---|
297 | ENDDO |
---|
298 | |
---|
299 | CASE ( 'u' ) |
---|
300 | DO i = nxlg, nxrg |
---|
301 | DO j = nysg, nyng |
---|
302 | DO k = nzb, nzt+1 |
---|
303 | u_av(k,j,i) = u_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
304 | ENDDO |
---|
305 | ENDDO |
---|
306 | ENDDO |
---|
307 | |
---|
308 | CASE ( 'u*' ) |
---|
309 | DO i = nxlg, nxrg |
---|
310 | DO j = nysg, nyng |
---|
311 | us_av(j,i) = us_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
312 | ENDDO |
---|
313 | ENDDO |
---|
314 | |
---|
315 | CASE ( 'v' ) |
---|
316 | DO i = nxlg, nxrg |
---|
317 | DO j = nysg, nyng |
---|
318 | DO k = nzb, nzt+1 |
---|
319 | v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
320 | ENDDO |
---|
321 | ENDDO |
---|
322 | ENDDO |
---|
323 | |
---|
324 | CASE ( 'vpt' ) |
---|
325 | DO i = nxlg, nxrg |
---|
326 | DO j = nysg, nyng |
---|
327 | DO k = nzb, nzt+1 |
---|
328 | vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
329 | ENDDO |
---|
330 | ENDDO |
---|
331 | ENDDO |
---|
332 | |
---|
333 | CASE ( 'w' ) |
---|
334 | DO i = nxlg, nxrg |
---|
335 | DO j = nysg, nyng |
---|
336 | DO k = nzb, nzt+1 |
---|
337 | w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
338 | ENDDO |
---|
339 | ENDDO |
---|
340 | ENDDO |
---|
341 | |
---|
342 | CASE ( 'z0*' ) |
---|
343 | DO i = nxlg, nxrg |
---|
344 | DO j = nysg, nyng |
---|
345 | z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
346 | ENDDO |
---|
347 | ENDDO |
---|
348 | |
---|
349 | CASE ( 'z0h*' ) |
---|
350 | DO i = nxlg, nxrg |
---|
351 | DO j = nysg, nyng |
---|
352 | z0h_av(j,i) = z0h_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
353 | ENDDO |
---|
354 | ENDDO |
---|
355 | |
---|
356 | CASE DEFAULT |
---|
357 | ! |
---|
358 | !-- User-defined quantity |
---|
359 | CALL user_3d_data_averaging( 'average', doav(ii) ) |
---|
360 | |
---|
361 | END SELECT |
---|
362 | |
---|
363 | ENDDO |
---|
364 | |
---|
365 | ! |
---|
366 | !-- Reset the counter |
---|
367 | average_count_3d = 0.0 |
---|
368 | |
---|
369 | CALL cpu_log( log_point(35), 'average_3d_data', 'stop' ) |
---|
370 | |
---|
371 | |
---|
372 | END SUBROUTINE average_3d_data |
---|