[1] | 1 | SUBROUTINE average_3d_data |
---|
| 2 | |
---|
[1036] | 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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1321] | 22 | ! |
---|
[1323] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: average_3d_data.f90 1323 2014-03-20 17:09:54Z boeske $ |
---|
| 27 | ! |
---|
[1323] | 28 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 29 | ! REAL functions provided with KIND-attribute |
---|
| 30 | ! |
---|
[1321] | 31 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 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 |
---|
[772] | 38 | ! |
---|
[1319] | 39 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 40 | ! barrier argument removed from cpu_log, |
---|
| 41 | ! module interfaces removed |
---|
| 42 | ! |
---|
[1116] | 43 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 44 | ! +qc |
---|
| 45 | ! |
---|
[1054] | 46 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 47 | ! averaging of nr, qr added |
---|
| 48 | ! |
---|
[1037] | 49 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 50 | ! code put under GPL (PALM 3.9) |
---|
| 51 | ! |
---|
[979] | 52 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 53 | ! +z0h_av |
---|
[77] | 54 | ! |
---|
[1] | 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 | |
---|
[1320] | 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 | |
---|
[1] | 78 | IMPLICIT NONE |
---|
| 79 | |
---|
[1320] | 80 | INTEGER(iwp) :: i !: |
---|
| 81 | INTEGER(iwp) :: ii !: |
---|
| 82 | INTEGER(iwp) :: j !: |
---|
| 83 | INTEGER(iwp) :: k !: |
---|
[1] | 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' ) |
---|
[667] | 101 | DO i = nxlg, nxrg |
---|
| 102 | DO j = nysg, nyng |
---|
[1] | 103 | DO k = nzb, nzt+1 |
---|
[1322] | 104 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 105 | ENDDO |
---|
| 106 | ENDDO |
---|
| 107 | ENDDO |
---|
| 108 | |
---|
[354] | 109 | CASE ( 'qsws*' ) |
---|
[667] | 110 | DO i = nxlg, nxrg |
---|
| 111 | DO j = nysg, nyng |
---|
[1322] | 112 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[354] | 113 | ENDDO |
---|
| 114 | ENDDO |
---|
| 115 | |
---|
[771] | 116 | CASE ( 'lpt' ) |
---|
| 117 | DO i = nxlg, nxrg |
---|
| 118 | DO j = nysg, nyng |
---|
| 119 | DO k = nzb, nzt+1 |
---|
[1322] | 120 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[771] | 121 | ENDDO |
---|
| 122 | ENDDO |
---|
| 123 | ENDDO |
---|
| 124 | |
---|
[1] | 125 | CASE ( 'lwp*' ) |
---|
[667] | 126 | DO i = nxlg, nxrg |
---|
| 127 | DO j = nysg, nyng |
---|
[1322] | 128 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 129 | ENDDO |
---|
| 130 | ENDDO |
---|
| 131 | |
---|
[1053] | 132 | CASE ( 'nr' ) |
---|
| 133 | DO i = nxlg, nxrg |
---|
| 134 | DO j = nysg, nyng |
---|
| 135 | DO k = nzb, nzt+1 |
---|
[1322] | 136 | nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1053] | 137 | ENDDO |
---|
| 138 | ENDDO |
---|
| 139 | ENDDO |
---|
| 140 | |
---|
[1] | 141 | CASE ( 'p' ) |
---|
[667] | 142 | DO i = nxlg, nxrg |
---|
| 143 | DO j = nysg, nyng |
---|
[1] | 144 | DO k = nzb, nzt+1 |
---|
[1322] | 145 | p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 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 |
---|
[1322] | 154 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 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 |
---|
[1322] | 163 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 164 | ENDDO |
---|
| 165 | ENDDO |
---|
| 166 | ENDDO |
---|
| 167 | |
---|
[72] | 168 | CASE ( 'prr*' ) |
---|
[667] | 169 | DO i = nxlg, nxrg |
---|
| 170 | DO j = nysg, nyng |
---|
[1320] | 171 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / & |
---|
[1322] | 172 | REAL( average_count_3d, KIND=wp ) |
---|
[72] | 173 | ENDDO |
---|
| 174 | ENDDO |
---|
| 175 | |
---|
[1] | 176 | CASE ( 'pt' ) |
---|
[667] | 177 | DO i = nxlg, nxrg |
---|
| 178 | DO j = nysg, nyng |
---|
[1] | 179 | DO k = nzb, nzt+1 |
---|
[1322] | 180 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 181 | ENDDO |
---|
| 182 | ENDDO |
---|
| 183 | ENDDO |
---|
| 184 | |
---|
| 185 | CASE ( 'q' ) |
---|
[667] | 186 | DO i = nxlg, nxrg |
---|
| 187 | DO j = nysg, nyng |
---|
[1] | 188 | DO k = nzb, nzt+1 |
---|
[1322] | 189 | q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 190 | ENDDO |
---|
| 191 | ENDDO |
---|
| 192 | ENDDO |
---|
[367] | 193 | |
---|
[1115] | 194 | CASE ( 'qc' ) |
---|
| 195 | DO i = nxlg, nxrg |
---|
| 196 | DO j = nysg, nyng |
---|
| 197 | DO k = nzb, nzt+1 |
---|
[1322] | 198 | qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1115] | 199 | ENDDO |
---|
| 200 | ENDDO |
---|
| 201 | ENDDO |
---|
| 202 | |
---|
[1] | 203 | CASE ( 'ql' ) |
---|
[667] | 204 | DO i = nxlg, nxrg |
---|
| 205 | DO j = nysg, nyng |
---|
[1] | 206 | DO k = nzb, nzt+1 |
---|
[1322] | 207 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 208 | ENDDO |
---|
| 209 | ENDDO |
---|
| 210 | ENDDO |
---|
| 211 | |
---|
| 212 | CASE ( 'ql_c' ) |
---|
[667] | 213 | DO i = nxlg, nxrg |
---|
| 214 | DO j = nysg, nyng |
---|
[1] | 215 | DO k = nzb, nzt+1 |
---|
[1322] | 216 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 217 | ENDDO |
---|
| 218 | ENDDO |
---|
| 219 | ENDDO |
---|
| 220 | |
---|
| 221 | CASE ( 'ql_v' ) |
---|
[667] | 222 | DO i = nxlg, nxrg |
---|
| 223 | DO j = nysg, nyng |
---|
[1] | 224 | DO k = nzb, nzt+1 |
---|
[1322] | 225 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 226 | ENDDO |
---|
| 227 | ENDDO |
---|
| 228 | ENDDO |
---|
| 229 | |
---|
| 230 | CASE ( 'ql_vp' ) |
---|
[667] | 231 | DO i = nxlg, nxrg |
---|
| 232 | DO j = nysg, nyng |
---|
[1] | 233 | DO k = nzb, nzt+1 |
---|
[1320] | 234 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & |
---|
[1322] | 235 | REAL( average_count_3d, KIND=wp ) |
---|
[1] | 236 | ENDDO |
---|
| 237 | ENDDO |
---|
| 238 | ENDDO |
---|
| 239 | |
---|
[1053] | 240 | CASE ( 'qr' ) |
---|
| 241 | DO i = nxlg, nxrg |
---|
| 242 | DO j = nysg, nyng |
---|
| 243 | DO k = nzb, nzt+1 |
---|
[1322] | 244 | qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1053] | 245 | ENDDO |
---|
| 246 | ENDDO |
---|
| 247 | ENDDO |
---|
| 248 | |
---|
[1] | 249 | CASE ( 'qv' ) |
---|
[667] | 250 | DO i = nxlg, nxrg |
---|
| 251 | DO j = nysg, nyng |
---|
[1] | 252 | DO k = nzb, nzt+1 |
---|
[1322] | 253 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 254 | ENDDO |
---|
| 255 | ENDDO |
---|
| 256 | ENDDO |
---|
[367] | 257 | |
---|
[96] | 258 | CASE ( 'rho' ) |
---|
[667] | 259 | DO i = nxlg, nxrg |
---|
| 260 | DO j = nysg, nyng |
---|
[96] | 261 | DO k = nzb, nzt+1 |
---|
[1322] | 262 | rho_av(k,j,i) = rho_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[96] | 263 | ENDDO |
---|
| 264 | ENDDO |
---|
| 265 | ENDDO |
---|
[367] | 266 | |
---|
[1] | 267 | CASE ( 's' ) |
---|
[667] | 268 | DO i = nxlg, nxrg |
---|
| 269 | DO j = nysg, nyng |
---|
[1] | 270 | DO k = nzb, nzt+1 |
---|
[1322] | 271 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 272 | ENDDO |
---|
| 273 | ENDDO |
---|
| 274 | ENDDO |
---|
[367] | 275 | |
---|
[96] | 276 | CASE ( 'sa' ) |
---|
[667] | 277 | DO i = nxlg, nxrg |
---|
| 278 | DO j = nysg, nyng |
---|
[96] | 279 | DO k = nzb, nzt+1 |
---|
[1322] | 280 | sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[96] | 281 | ENDDO |
---|
| 282 | ENDDO |
---|
| 283 | ENDDO |
---|
[367] | 284 | |
---|
[354] | 285 | CASE ( 'shf*' ) |
---|
[667] | 286 | DO i = nxlg, nxrg |
---|
| 287 | DO j = nysg, nyng |
---|
[1322] | 288 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[354] | 289 | ENDDO |
---|
| 290 | ENDDO |
---|
[367] | 291 | |
---|
[1] | 292 | CASE ( 't*' ) |
---|
[667] | 293 | DO i = nxlg, nxrg |
---|
| 294 | DO j = nysg, nyng |
---|
[1322] | 295 | ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 296 | ENDDO |
---|
| 297 | ENDDO |
---|
| 298 | |
---|
| 299 | CASE ( 'u' ) |
---|
[667] | 300 | DO i = nxlg, nxrg |
---|
| 301 | DO j = nysg, nyng |
---|
[1] | 302 | DO k = nzb, nzt+1 |
---|
[1322] | 303 | u_av(k,j,i) = u_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 304 | ENDDO |
---|
| 305 | ENDDO |
---|
| 306 | ENDDO |
---|
| 307 | |
---|
| 308 | CASE ( 'u*' ) |
---|
[667] | 309 | DO i = nxlg, nxrg |
---|
| 310 | DO j = nysg, nyng |
---|
[1322] | 311 | us_av(j,i) = us_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 312 | ENDDO |
---|
| 313 | ENDDO |
---|
| 314 | |
---|
| 315 | CASE ( 'v' ) |
---|
[667] | 316 | DO i = nxlg, nxrg |
---|
| 317 | DO j = nysg, nyng |
---|
[1] | 318 | DO k = nzb, nzt+1 |
---|
[1322] | 319 | v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 320 | ENDDO |
---|
| 321 | ENDDO |
---|
| 322 | ENDDO |
---|
| 323 | |
---|
| 324 | CASE ( 'vpt' ) |
---|
[667] | 325 | DO i = nxlg, nxrg |
---|
| 326 | DO j = nysg, nyng |
---|
[1] | 327 | DO k = nzb, nzt+1 |
---|
[1322] | 328 | vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 329 | ENDDO |
---|
| 330 | ENDDO |
---|
| 331 | ENDDO |
---|
| 332 | |
---|
| 333 | CASE ( 'w' ) |
---|
[667] | 334 | DO i = nxlg, nxrg |
---|
| 335 | DO j = nysg, nyng |
---|
[1] | 336 | DO k = nzb, nzt+1 |
---|
[1322] | 337 | w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 338 | ENDDO |
---|
| 339 | ENDDO |
---|
| 340 | ENDDO |
---|
| 341 | |
---|
[72] | 342 | CASE ( 'z0*' ) |
---|
[667] | 343 | DO i = nxlg, nxrg |
---|
| 344 | DO j = nysg, nyng |
---|
[1322] | 345 | z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[72] | 346 | ENDDO |
---|
| 347 | ENDDO |
---|
| 348 | |
---|
[978] | 349 | CASE ( 'z0h*' ) |
---|
| 350 | DO i = nxlg, nxrg |
---|
| 351 | DO j = nysg, nyng |
---|
[1322] | 352 | z0h_av(j,i) = z0h_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[978] | 353 | ENDDO |
---|
| 354 | ENDDO |
---|
| 355 | |
---|
[1] | 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 | |
---|
[1318] | 369 | CALL cpu_log( log_point(35), 'average_3d_data', 'stop' ) |
---|
[1] | 370 | |
---|
| 371 | |
---|
| 372 | END SUBROUTINE average_3d_data |
---|