[1682] | 1 | !> @file average_3d_data.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1818] | 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[1552] | 21 | ! |
---|
[1973] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: average_3d_data.f90 1976 2016-07-27 13:28:04Z gronemeier $ |
---|
| 26 | ! |
---|
[1973] | 27 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
| 28 | ! Output of land surface quantities is now done directly in the respective module |
---|
| 29 | ! |
---|
[1961] | 30 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 31 | ! Treat humidity and passive scalar separately |
---|
| 32 | ! |
---|
[1692] | 33 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 34 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
| 35 | ! |
---|
[1683] | 36 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 37 | ! Code annotations made doxygen readable |
---|
| 38 | ! |
---|
[1586] | 39 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
| 40 | ! Adapted for RRTMG |
---|
| 41 | ! |
---|
[1556] | 42 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
| 43 | ! Added output of r_a and r_s |
---|
| 44 | ! |
---|
[1552] | 45 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 46 | ! Added support for land surface and radiation model parameters. |
---|
| 47 | ! |
---|
[1323] | 48 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 49 | ! REAL functions provided with KIND-attribute |
---|
| 50 | ! |
---|
[1321] | 51 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 52 | ! ONLY-attribute added to USE-statements, |
---|
| 53 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 54 | ! kinds are defined in new module kinds, |
---|
| 55 | ! revision history before 2012 removed, |
---|
| 56 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 57 | ! all variable declaration statements |
---|
[772] | 58 | ! |
---|
[1319] | 59 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 60 | ! barrier argument removed from cpu_log, |
---|
| 61 | ! module interfaces removed |
---|
| 62 | ! |
---|
[1116] | 63 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 64 | ! +qc |
---|
| 65 | ! |
---|
[1054] | 66 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 67 | ! averaging of nr, qr added |
---|
| 68 | ! |
---|
[1037] | 69 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 70 | ! code put under GPL (PALM 3.9) |
---|
| 71 | ! |
---|
[979] | 72 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 73 | ! +z0h_av |
---|
[77] | 74 | ! |
---|
[1] | 75 | ! Revision 1.1 2006/02/23 09:48:58 raasch |
---|
| 76 | ! Initial revision |
---|
| 77 | ! |
---|
| 78 | ! |
---|
| 79 | ! Description: |
---|
| 80 | ! ------------ |
---|
[1682] | 81 | !> Time-averaging of 3d-data-arrays. |
---|
[1] | 82 | !------------------------------------------------------------------------------! |
---|
[1682] | 83 | SUBROUTINE average_3d_data |
---|
| 84 | |
---|
[1] | 85 | |
---|
| 86 | USE averaging |
---|
| 87 | |
---|
[1320] | 88 | USE control_parameters, & |
---|
| 89 | ONLY: average_count_3d, doav, doav_n |
---|
| 90 | |
---|
| 91 | USE cpulog, & |
---|
| 92 | ONLY: cpu_log, log_point |
---|
| 93 | |
---|
| 94 | USE indices, & |
---|
| 95 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
| 96 | |
---|
| 97 | USE kinds |
---|
| 98 | |
---|
[1551] | 99 | USE land_surface_model_mod, & |
---|
[1972] | 100 | ONLY: land_surface, lsm_3d_data_averaging |
---|
[1320] | 101 | |
---|
[1551] | 102 | USE radiation_model_mod, & |
---|
[1976] | 103 | ONLY: radiation, radiation_3d_data_averaging |
---|
[1551] | 104 | |
---|
[1691] | 105 | |
---|
[1] | 106 | IMPLICIT NONE |
---|
| 107 | |
---|
[1682] | 108 | INTEGER(iwp) :: i !< |
---|
| 109 | INTEGER(iwp) :: ii !< |
---|
| 110 | INTEGER(iwp) :: j !< |
---|
| 111 | INTEGER(iwp) :: k !< |
---|
[1] | 112 | |
---|
| 113 | |
---|
| 114 | CALL cpu_log (log_point(35),'average_3d_data','start') |
---|
| 115 | |
---|
| 116 | ! |
---|
| 117 | !-- Check, if averaging is necessary |
---|
| 118 | IF ( average_count_3d <= 1 ) RETURN |
---|
| 119 | |
---|
| 120 | ! |
---|
| 121 | !-- Loop of all variables to be averaged. |
---|
| 122 | DO ii = 1, doav_n |
---|
| 123 | |
---|
| 124 | ! |
---|
| 125 | !-- Store the array chosen on the temporary array. |
---|
| 126 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
| 127 | |
---|
| 128 | CASE ( 'e' ) |
---|
[667] | 129 | DO i = nxlg, nxrg |
---|
| 130 | DO j = nysg, nyng |
---|
[1] | 131 | DO k = nzb, nzt+1 |
---|
[1322] | 132 | e_av(k,j,i) = e_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 133 | ENDDO |
---|
| 134 | ENDDO |
---|
| 135 | ENDDO |
---|
| 136 | |
---|
[354] | 137 | CASE ( 'qsws*' ) |
---|
[667] | 138 | DO i = nxlg, nxrg |
---|
| 139 | DO j = nysg, nyng |
---|
[1322] | 140 | qsws_av(j,i) = qsws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[354] | 141 | ENDDO |
---|
| 142 | ENDDO |
---|
| 143 | |
---|
[771] | 144 | CASE ( 'lpt' ) |
---|
| 145 | DO i = nxlg, nxrg |
---|
| 146 | DO j = nysg, nyng |
---|
| 147 | DO k = nzb, nzt+1 |
---|
[1322] | 148 | lpt_av(k,j,i) = lpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[771] | 149 | ENDDO |
---|
| 150 | ENDDO |
---|
| 151 | ENDDO |
---|
| 152 | |
---|
[1] | 153 | CASE ( 'lwp*' ) |
---|
[667] | 154 | DO i = nxlg, nxrg |
---|
| 155 | DO j = nysg, nyng |
---|
[1322] | 156 | lwp_av(j,i) = lwp_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 157 | ENDDO |
---|
| 158 | ENDDO |
---|
| 159 | |
---|
[1053] | 160 | CASE ( 'nr' ) |
---|
| 161 | DO i = nxlg, nxrg |
---|
| 162 | DO j = nysg, nyng |
---|
| 163 | DO k = nzb, nzt+1 |
---|
[1322] | 164 | nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1053] | 165 | ENDDO |
---|
| 166 | ENDDO |
---|
| 167 | ENDDO |
---|
| 168 | |
---|
[1691] | 169 | CASE ( 'ol*' ) |
---|
| 170 | DO i = nxlg, nxrg |
---|
| 171 | DO j = nysg, nyng |
---|
| 172 | ol_av(j,i) = ol_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
| 173 | ENDDO |
---|
| 174 | ENDDO |
---|
| 175 | |
---|
[1] | 176 | CASE ( 'p' ) |
---|
[667] | 177 | DO i = nxlg, nxrg |
---|
| 178 | DO j = nysg, nyng |
---|
[1] | 179 | DO k = nzb, nzt+1 |
---|
[1322] | 180 | p_av(k,j,i) = p_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 181 | ENDDO |
---|
| 182 | ENDDO |
---|
| 183 | ENDDO |
---|
| 184 | |
---|
| 185 | CASE ( 'pc' ) |
---|
| 186 | DO i = nxl, nxr |
---|
| 187 | DO j = nys, nyn |
---|
| 188 | DO k = nzb, nzt+1 |
---|
[1322] | 189 | pc_av(k,j,i) = pc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 190 | ENDDO |
---|
| 191 | ENDDO |
---|
| 192 | ENDDO |
---|
| 193 | |
---|
| 194 | CASE ( 'pr' ) |
---|
| 195 | DO i = nxl, nxr |
---|
| 196 | DO j = nys, nyn |
---|
| 197 | DO k = nzb, nzt+1 |
---|
[1322] | 198 | pr_av(k,j,i) = pr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 199 | ENDDO |
---|
| 200 | ENDDO |
---|
| 201 | ENDDO |
---|
| 202 | |
---|
[72] | 203 | CASE ( 'prr*' ) |
---|
[667] | 204 | DO i = nxlg, nxrg |
---|
| 205 | DO j = nysg, nyng |
---|
[1320] | 206 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / & |
---|
[1322] | 207 | REAL( average_count_3d, KIND=wp ) |
---|
[72] | 208 | ENDDO |
---|
| 209 | ENDDO |
---|
| 210 | |
---|
[1] | 211 | CASE ( 'pt' ) |
---|
[667] | 212 | DO i = nxlg, nxrg |
---|
| 213 | DO j = nysg, nyng |
---|
[1] | 214 | DO k = nzb, nzt+1 |
---|
[1322] | 215 | pt_av(k,j,i) = pt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 216 | ENDDO |
---|
| 217 | ENDDO |
---|
| 218 | ENDDO |
---|
| 219 | |
---|
| 220 | CASE ( 'q' ) |
---|
[667] | 221 | DO i = nxlg, nxrg |
---|
| 222 | DO j = nysg, nyng |
---|
[1] | 223 | DO k = nzb, nzt+1 |
---|
[1322] | 224 | q_av(k,j,i) = q_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 225 | ENDDO |
---|
| 226 | ENDDO |
---|
| 227 | ENDDO |
---|
[367] | 228 | |
---|
[1115] | 229 | CASE ( 'qc' ) |
---|
| 230 | DO i = nxlg, nxrg |
---|
| 231 | DO j = nysg, nyng |
---|
| 232 | DO k = nzb, nzt+1 |
---|
[1322] | 233 | qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1115] | 234 | ENDDO |
---|
| 235 | ENDDO |
---|
| 236 | ENDDO |
---|
| 237 | |
---|
[1] | 238 | CASE ( 'ql' ) |
---|
[667] | 239 | DO i = nxlg, nxrg |
---|
| 240 | DO j = nysg, nyng |
---|
[1] | 241 | DO k = nzb, nzt+1 |
---|
[1322] | 242 | ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 243 | ENDDO |
---|
| 244 | ENDDO |
---|
| 245 | ENDDO |
---|
| 246 | |
---|
| 247 | CASE ( 'ql_c' ) |
---|
[667] | 248 | DO i = nxlg, nxrg |
---|
| 249 | DO j = nysg, nyng |
---|
[1] | 250 | DO k = nzb, nzt+1 |
---|
[1322] | 251 | ql_c_av(k,j,i) = ql_c_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 252 | ENDDO |
---|
| 253 | ENDDO |
---|
| 254 | ENDDO |
---|
| 255 | |
---|
| 256 | CASE ( 'ql_v' ) |
---|
[667] | 257 | DO i = nxlg, nxrg |
---|
| 258 | DO j = nysg, nyng |
---|
[1] | 259 | DO k = nzb, nzt+1 |
---|
[1322] | 260 | ql_v_av(k,j,i) = ql_v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 261 | ENDDO |
---|
| 262 | ENDDO |
---|
| 263 | ENDDO |
---|
| 264 | |
---|
| 265 | CASE ( 'ql_vp' ) |
---|
[667] | 266 | DO i = nxlg, nxrg |
---|
| 267 | DO j = nysg, nyng |
---|
[1] | 268 | DO k = nzb, nzt+1 |
---|
[1320] | 269 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / & |
---|
[1322] | 270 | REAL( average_count_3d, KIND=wp ) |
---|
[1] | 271 | ENDDO |
---|
| 272 | ENDDO |
---|
| 273 | ENDDO |
---|
| 274 | |
---|
[1053] | 275 | CASE ( 'qr' ) |
---|
| 276 | DO i = nxlg, nxrg |
---|
| 277 | DO j = nysg, nyng |
---|
| 278 | DO k = nzb, nzt+1 |
---|
[1322] | 279 | qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1053] | 280 | ENDDO |
---|
| 281 | ENDDO |
---|
| 282 | ENDDO |
---|
| 283 | |
---|
[1] | 284 | CASE ( 'qv' ) |
---|
[667] | 285 | DO i = nxlg, nxrg |
---|
| 286 | DO j = nysg, nyng |
---|
[1] | 287 | DO k = nzb, nzt+1 |
---|
[1322] | 288 | qv_av(k,j,i) = qv_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 289 | ENDDO |
---|
| 290 | ENDDO |
---|
| 291 | ENDDO |
---|
[367] | 292 | |
---|
[96] | 293 | CASE ( 'rho' ) |
---|
[667] | 294 | DO i = nxlg, nxrg |
---|
| 295 | DO j = nysg, nyng |
---|
[96] | 296 | DO k = nzb, nzt+1 |
---|
[1322] | 297 | rho_av(k,j,i) = rho_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[96] | 298 | ENDDO |
---|
| 299 | ENDDO |
---|
| 300 | ENDDO |
---|
[367] | 301 | |
---|
[1] | 302 | CASE ( 's' ) |
---|
[667] | 303 | DO i = nxlg, nxrg |
---|
| 304 | DO j = nysg, nyng |
---|
[1] | 305 | DO k = nzb, nzt+1 |
---|
[1322] | 306 | s_av(k,j,i) = s_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 307 | ENDDO |
---|
| 308 | ENDDO |
---|
| 309 | ENDDO |
---|
[367] | 310 | |
---|
[96] | 311 | CASE ( 'sa' ) |
---|
[667] | 312 | DO i = nxlg, nxrg |
---|
| 313 | DO j = nysg, nyng |
---|
[96] | 314 | DO k = nzb, nzt+1 |
---|
[1322] | 315 | sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[96] | 316 | ENDDO |
---|
| 317 | ENDDO |
---|
| 318 | ENDDO |
---|
[367] | 319 | |
---|
[354] | 320 | CASE ( 'shf*' ) |
---|
[667] | 321 | DO i = nxlg, nxrg |
---|
| 322 | DO j = nysg, nyng |
---|
[1322] | 323 | shf_av(j,i) = shf_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[354] | 324 | ENDDO |
---|
| 325 | ENDDO |
---|
[367] | 326 | |
---|
[1960] | 327 | CASE ( 'ssws*' ) |
---|
| 328 | DO i = nxlg, nxrg |
---|
| 329 | DO j = nysg, nyng |
---|
| 330 | ssws_av(j,i) = ssws_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
| 331 | ENDDO |
---|
| 332 | ENDDO |
---|
| 333 | |
---|
[1] | 334 | CASE ( 't*' ) |
---|
[667] | 335 | DO i = nxlg, nxrg |
---|
| 336 | DO j = nysg, nyng |
---|
[1322] | 337 | ts_av(j,i) = ts_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 338 | ENDDO |
---|
| 339 | ENDDO |
---|
| 340 | |
---|
| 341 | CASE ( 'u' ) |
---|
[667] | 342 | DO i = nxlg, nxrg |
---|
| 343 | DO j = nysg, nyng |
---|
[1] | 344 | DO k = nzb, nzt+1 |
---|
[1322] | 345 | u_av(k,j,i) = u_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 346 | ENDDO |
---|
| 347 | ENDDO |
---|
| 348 | ENDDO |
---|
| 349 | |
---|
| 350 | CASE ( 'u*' ) |
---|
[667] | 351 | DO i = nxlg, nxrg |
---|
| 352 | DO j = nysg, nyng |
---|
[1322] | 353 | us_av(j,i) = us_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 354 | ENDDO |
---|
| 355 | ENDDO |
---|
| 356 | |
---|
| 357 | CASE ( 'v' ) |
---|
[667] | 358 | DO i = nxlg, nxrg |
---|
| 359 | DO j = nysg, nyng |
---|
[1] | 360 | DO k = nzb, nzt+1 |
---|
[1322] | 361 | v_av(k,j,i) = v_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 362 | ENDDO |
---|
| 363 | ENDDO |
---|
| 364 | ENDDO |
---|
| 365 | |
---|
| 366 | CASE ( 'vpt' ) |
---|
[667] | 367 | DO i = nxlg, nxrg |
---|
| 368 | DO j = nysg, nyng |
---|
[1] | 369 | DO k = nzb, nzt+1 |
---|
[1322] | 370 | vpt_av(k,j,i) = vpt_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 371 | ENDDO |
---|
| 372 | ENDDO |
---|
| 373 | ENDDO |
---|
| 374 | |
---|
| 375 | CASE ( 'w' ) |
---|
[667] | 376 | DO i = nxlg, nxrg |
---|
| 377 | DO j = nysg, nyng |
---|
[1] | 378 | DO k = nzb, nzt+1 |
---|
[1322] | 379 | w_av(k,j,i) = w_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[1] | 380 | ENDDO |
---|
| 381 | ENDDO |
---|
| 382 | ENDDO |
---|
| 383 | |
---|
[72] | 384 | CASE ( 'z0*' ) |
---|
[667] | 385 | DO i = nxlg, nxrg |
---|
| 386 | DO j = nysg, nyng |
---|
[1322] | 387 | z0_av(j,i) = z0_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[72] | 388 | ENDDO |
---|
| 389 | ENDDO |
---|
| 390 | |
---|
[978] | 391 | CASE ( 'z0h*' ) |
---|
| 392 | DO i = nxlg, nxrg |
---|
| 393 | DO j = nysg, nyng |
---|
[1322] | 394 | z0h_av(j,i) = z0h_av(j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[978] | 395 | ENDDO |
---|
| 396 | ENDDO |
---|
| 397 | |
---|
[1] | 398 | CASE DEFAULT |
---|
| 399 | ! |
---|
[1972] | 400 | !-- Land surface quantity |
---|
| 401 | IF ( land_surface ) THEN |
---|
| 402 | CALL lsm_3d_data_averaging( 'average', doav(ii) ) |
---|
| 403 | ENDIF |
---|
| 404 | |
---|
| 405 | ! |
---|
[1976] | 406 | !-- Radiation quantity |
---|
| 407 | IF ( radiation ) THEN |
---|
| 408 | CALL radiation_3d_data_averaging( 'average', doav(ii) ) |
---|
| 409 | ENDIF |
---|
| 410 | |
---|
| 411 | ! |
---|
[1] | 412 | !-- User-defined quantity |
---|
| 413 | CALL user_3d_data_averaging( 'average', doav(ii) ) |
---|
| 414 | |
---|
| 415 | END SELECT |
---|
| 416 | |
---|
| 417 | ENDDO |
---|
| 418 | |
---|
| 419 | ! |
---|
| 420 | !-- Reset the counter |
---|
| 421 | average_count_3d = 0.0 |
---|
| 422 | |
---|
[1318] | 423 | CALL cpu_log( log_point(35), 'average_3d_data', 'stop' ) |
---|
[1] | 424 | |
---|
| 425 | |
---|
| 426 | END SUBROUTINE average_3d_data |
---|