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