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