[1682] | 1 | !> @file sum_up_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 | ! ----------------- |
---|
[1360] | 21 | ! |
---|
[1977] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: sum_up_3d_data.f90 1977 2016-07-27 13:28:18Z suehring $ |
---|
| 26 | ! |
---|
[1977] | 27 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
| 28 | ! Radiation actions are now done directly in the respective module |
---|
| 29 | ! |
---|
[1973] | 30 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
| 31 | ! Land surface actions are now done directly in the respective module |
---|
| 32 | ! |
---|
[1961] | 33 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 34 | ! Scalar surface flux added |
---|
| 35 | ! |
---|
[1950] | 36 | ! 1949 2016-06-17 07:19:16Z maronga |
---|
| 37 | ! Bugfix: calculation of lai_av, c_veg_av and c_liq_av. |
---|
| 38 | ! |
---|
[1851] | 39 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
| 40 | ! precipitation_rate moved to arrays_3d |
---|
[1852] | 41 | ! |
---|
[1789] | 42 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
| 43 | ! Added z0q and z0q_av |
---|
| 44 | ! |
---|
[1694] | 45 | ! 1693 2015-10-27 08:35:45Z maronga |
---|
| 46 | ! Last revision text corrected |
---|
| 47 | ! |
---|
[1692] | 48 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 49 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
[1693] | 50 | ! Corrected output of liquid water path. |
---|
[1692] | 51 | ! |
---|
[1683] | 52 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 53 | ! Code annotations made doxygen readable |
---|
| 54 | ! |
---|
[1586] | 55 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
| 56 | ! Adapted for RRTMG |
---|
| 57 | ! |
---|
[1556] | 58 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
| 59 | ! Added output of r_a and r_s |
---|
| 60 | ! |
---|
[1552] | 61 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 62 | ! Added support for land surface model and radiation model data. |
---|
| 63 | ! |
---|
[1360] | 64 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 65 | ! New particle structure integrated. |
---|
| 66 | ! |
---|
[1354] | 67 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 68 | ! REAL constants provided with KIND-attribute |
---|
| 69 | ! |
---|
[1321] | 70 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 71 | ! ONLY-attribute added to USE-statements, |
---|
| 72 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 73 | ! kinds are defined in new module kinds, |
---|
| 74 | ! old module precision_kind is removed, |
---|
| 75 | ! revision history before 2012 removed, |
---|
| 76 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 77 | ! all variable declaration statements |
---|
[1] | 78 | ! |
---|
[1319] | 79 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 80 | ! barrier argument removed from cpu_log, |
---|
| 81 | ! module interfaces removed |
---|
| 82 | ! |
---|
[1116] | 83 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 84 | ! ql is calculated by calc_liquid_water_content |
---|
| 85 | ! |
---|
[1054] | 86 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 87 | ! +nr, prr, qr |
---|
| 88 | ! |
---|
[1037] | 89 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 90 | ! code put under GPL (PALM 3.9) |
---|
| 91 | ! |
---|
[1008] | 92 | ! 1007 2012-09-19 14:30:36Z franke |
---|
| 93 | ! Bugfix in calculation of ql_vp |
---|
| 94 | ! |
---|
[979] | 95 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 96 | ! +z0h* |
---|
| 97 | ! |
---|
[1] | 98 | ! Revision 1.1 2006/02/23 12:55:23 raasch |
---|
| 99 | ! Initial revision |
---|
| 100 | ! |
---|
| 101 | ! |
---|
| 102 | ! Description: |
---|
| 103 | ! ------------ |
---|
[1682] | 104 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine |
---|
| 105 | !> average_3d_data. |
---|
[1] | 106 | !------------------------------------------------------------------------------! |
---|
[1682] | 107 | SUBROUTINE sum_up_3d_data |
---|
| 108 | |
---|
[1] | 109 | |
---|
[1320] | 110 | USE arrays_3d, & |
---|
[1849] | 111 | ONLY: dzw, e, nr, ol, p, pt, precipitation_rate, q, qc, ql, ql_c, & |
---|
[1960] | 112 | ql_v, qr, qsws, rho, sa, shf, ssws, ts, u, us, v, vpt, w, z0, & |
---|
| 113 | z0h, z0q |
---|
[1] | 114 | |
---|
[1320] | 115 | USE averaging, & |
---|
[1691] | 116 | ONLY: e_av, lpt_av, lwp_av, nr_av, ol_av, p_av, pc_av, pr_av, prr_av, & |
---|
[1320] | 117 | precipitation_rate_av, pt_av, q_av, qc_av, ql_av, ql_c_av, & |
---|
| 118 | ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, rho_av, s_av, sa_av, & |
---|
[1960] | 119 | shf_av, ssws_av, ts_av, u_av, us_av, v_av, vpt_av, w_av, z0_av, & |
---|
| 120 | z0h_av, z0q_av |
---|
[1320] | 121 | |
---|
| 122 | USE cloud_parameters, & |
---|
[1849] | 123 | ONLY: l_d_cp, pt_d_t |
---|
[1320] | 124 | |
---|
| 125 | USE control_parameters, & |
---|
[1691] | 126 | ONLY: average_count_3d, cloud_physics, doav, doav_n, rho_surface |
---|
[1320] | 127 | |
---|
| 128 | USE cpulog, & |
---|
| 129 | ONLY: cpu_log, log_point |
---|
| 130 | |
---|
| 131 | USE indices, & |
---|
| 132 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
| 133 | |
---|
| 134 | USE kinds |
---|
| 135 | |
---|
[1551] | 136 | USE land_surface_model_mod, & |
---|
[1972] | 137 | ONLY: land_surface, lsm_3d_data_averaging |
---|
[1551] | 138 | |
---|
[1320] | 139 | USE particle_attributes, & |
---|
[1359] | 140 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
[1320] | 141 | |
---|
[1551] | 142 | USE radiation_model_mod, & |
---|
[1976] | 143 | ONLY: radiation, radiation_3d_data_averaging |
---|
[1551] | 144 | |
---|
[1691] | 145 | |
---|
[1] | 146 | IMPLICIT NONE |
---|
| 147 | |
---|
[1682] | 148 | INTEGER(iwp) :: i !< |
---|
| 149 | INTEGER(iwp) :: ii !< |
---|
| 150 | INTEGER(iwp) :: j !< |
---|
| 151 | INTEGER(iwp) :: k !< |
---|
| 152 | INTEGER(iwp) :: n !< |
---|
| 153 | INTEGER(iwp) :: psi !< |
---|
[1] | 154 | |
---|
[1682] | 155 | REAL(wp) :: mean_r !< |
---|
| 156 | REAL(wp) :: s_r2 !< |
---|
| 157 | REAL(wp) :: s_r3 !< |
---|
[1] | 158 | |
---|
| 159 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
| 160 | |
---|
| 161 | ! |
---|
| 162 | !-- Allocate and initialize the summation arrays if called for the very first |
---|
| 163 | !-- time or the first time after average_3d_data has been called |
---|
| 164 | !-- (some or all of the arrays may have been already allocated |
---|
| 165 | !-- in read_3d_binary) |
---|
| 166 | IF ( average_count_3d == 0 ) THEN |
---|
| 167 | |
---|
| 168 | DO ii = 1, doav_n |
---|
| 169 | |
---|
| 170 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
| 171 | |
---|
| 172 | CASE ( 'e' ) |
---|
| 173 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
[667] | 174 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 175 | ENDIF |
---|
[1353] | 176 | e_av = 0.0_wp |
---|
[1] | 177 | |
---|
[771] | 178 | CASE ( 'lpt' ) |
---|
| 179 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
| 180 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 181 | ENDIF |
---|
[1353] | 182 | lpt_av = 0.0_wp |
---|
[771] | 183 | |
---|
[1] | 184 | CASE ( 'lwp*' ) |
---|
| 185 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
[667] | 186 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 187 | ENDIF |
---|
[1353] | 188 | lwp_av = 0.0_wp |
---|
[1] | 189 | |
---|
[1053] | 190 | CASE ( 'nr' ) |
---|
| 191 | IF ( .NOT. ALLOCATED( nr_av ) ) THEN |
---|
| 192 | ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 193 | ENDIF |
---|
[1353] | 194 | nr_av = 0.0_wp |
---|
[1053] | 195 | |
---|
[1691] | 196 | CASE ( 'ol*' ) |
---|
| 197 | IF ( .NOT. ALLOCATED( ol_av ) ) THEN |
---|
| 198 | ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 199 | ENDIF |
---|
| 200 | ol_av = 0.0_wp |
---|
| 201 | |
---|
[1] | 202 | CASE ( 'p' ) |
---|
| 203 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
[667] | 204 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 205 | ENDIF |
---|
[1353] | 206 | p_av = 0.0_wp |
---|
[1] | 207 | |
---|
| 208 | CASE ( 'pc' ) |
---|
| 209 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
[667] | 210 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 211 | ENDIF |
---|
[1353] | 212 | pc_av = 0.0_wp |
---|
[1] | 213 | |
---|
| 214 | CASE ( 'pr' ) |
---|
| 215 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
[667] | 216 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 217 | ENDIF |
---|
[1353] | 218 | pr_av = 0.0_wp |
---|
[1] | 219 | |
---|
[1053] | 220 | CASE ( 'prr' ) |
---|
| 221 | IF ( .NOT. ALLOCATED( prr_av ) ) THEN |
---|
| 222 | ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 223 | ENDIF |
---|
[1353] | 224 | prr_av = 0.0_wp |
---|
[1053] | 225 | |
---|
[72] | 226 | CASE ( 'prr*' ) |
---|
| 227 | IF ( .NOT. ALLOCATED( precipitation_rate_av ) ) THEN |
---|
[667] | 228 | ALLOCATE( precipitation_rate_av(nysg:nyng,nxlg:nxrg) ) |
---|
[72] | 229 | ENDIF |
---|
[1353] | 230 | precipitation_rate_av = 0.0_wp |
---|
[72] | 231 | |
---|
[1] | 232 | CASE ( 'pt' ) |
---|
| 233 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
[667] | 234 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 235 | ENDIF |
---|
[1353] | 236 | pt_av = 0.0_wp |
---|
[1] | 237 | |
---|
| 238 | CASE ( 'q' ) |
---|
| 239 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
[667] | 240 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 241 | ENDIF |
---|
[1353] | 242 | q_av = 0.0_wp |
---|
[1] | 243 | |
---|
[1115] | 244 | CASE ( 'qc' ) |
---|
| 245 | IF ( .NOT. ALLOCATED( qc_av ) ) THEN |
---|
| 246 | ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 247 | ENDIF |
---|
[1353] | 248 | qc_av = 0.0_wp |
---|
[1115] | 249 | |
---|
[1] | 250 | CASE ( 'ql' ) |
---|
| 251 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
[667] | 252 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 253 | ENDIF |
---|
[1353] | 254 | ql_av = 0.0_wp |
---|
[1] | 255 | |
---|
| 256 | CASE ( 'ql_c' ) |
---|
| 257 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
[667] | 258 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 259 | ENDIF |
---|
[1353] | 260 | ql_c_av = 0.0_wp |
---|
[1] | 261 | |
---|
| 262 | CASE ( 'ql_v' ) |
---|
| 263 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
[667] | 264 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 265 | ENDIF |
---|
[1353] | 266 | ql_v_av = 0.0_wp |
---|
[1] | 267 | |
---|
| 268 | CASE ( 'ql_vp' ) |
---|
| 269 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
[667] | 270 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 271 | ENDIF |
---|
[1353] | 272 | ql_vp_av = 0.0_wp |
---|
[1] | 273 | |
---|
[1053] | 274 | CASE ( 'qr' ) |
---|
| 275 | IF ( .NOT. ALLOCATED( qr_av ) ) THEN |
---|
| 276 | ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 277 | ENDIF |
---|
[1353] | 278 | qr_av = 0.0_wp |
---|
[1053] | 279 | |
---|
[354] | 280 | CASE ( 'qsws*' ) |
---|
| 281 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
[667] | 282 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
[354] | 283 | ENDIF |
---|
[1353] | 284 | qsws_av = 0.0_wp |
---|
[354] | 285 | |
---|
[1] | 286 | CASE ( 'qv' ) |
---|
| 287 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
[667] | 288 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 289 | ENDIF |
---|
[1353] | 290 | qv_av = 0.0_wp |
---|
[1] | 291 | |
---|
[96] | 292 | CASE ( 'rho' ) |
---|
| 293 | IF ( .NOT. ALLOCATED( rho_av ) ) THEN |
---|
[667] | 294 | ALLOCATE( rho_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[96] | 295 | ENDIF |
---|
[1353] | 296 | rho_av = 0.0_wp |
---|
[96] | 297 | |
---|
[1] | 298 | CASE ( 's' ) |
---|
| 299 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
[667] | 300 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 301 | ENDIF |
---|
[1353] | 302 | s_av = 0.0_wp |
---|
[1] | 303 | |
---|
[96] | 304 | CASE ( 'sa' ) |
---|
| 305 | IF ( .NOT. ALLOCATED( sa_av ) ) THEN |
---|
[667] | 306 | ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[96] | 307 | ENDIF |
---|
[1353] | 308 | sa_av = 0.0_wp |
---|
[96] | 309 | |
---|
[354] | 310 | CASE ( 'shf*' ) |
---|
| 311 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
[667] | 312 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
[354] | 313 | ENDIF |
---|
[1353] | 314 | shf_av = 0.0_wp |
---|
[354] | 315 | |
---|
[1] | 316 | CASE ( 't*' ) |
---|
| 317 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
[667] | 318 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 319 | ENDIF |
---|
[1353] | 320 | ts_av = 0.0_wp |
---|
[1] | 321 | |
---|
| 322 | CASE ( 'u' ) |
---|
| 323 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
[667] | 324 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 325 | ENDIF |
---|
[1353] | 326 | u_av = 0.0_wp |
---|
[1] | 327 | |
---|
| 328 | CASE ( 'u*' ) |
---|
| 329 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
[667] | 330 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 331 | ENDIF |
---|
[1353] | 332 | us_av = 0.0_wp |
---|
[1] | 333 | |
---|
| 334 | CASE ( 'v' ) |
---|
| 335 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
[667] | 336 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 337 | ENDIF |
---|
[1353] | 338 | v_av = 0.0_wp |
---|
[1] | 339 | |
---|
| 340 | CASE ( 'vpt' ) |
---|
| 341 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
[667] | 342 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 343 | ENDIF |
---|
[1353] | 344 | vpt_av = 0.0_wp |
---|
[1] | 345 | |
---|
| 346 | CASE ( 'w' ) |
---|
| 347 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
[667] | 348 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 349 | ENDIF |
---|
[1353] | 350 | w_av = 0.0_wp |
---|
[1] | 351 | |
---|
[72] | 352 | CASE ( 'z0*' ) |
---|
| 353 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
[667] | 354 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
[72] | 355 | ENDIF |
---|
[1353] | 356 | z0_av = 0.0_wp |
---|
[72] | 357 | |
---|
[978] | 358 | CASE ( 'z0h*' ) |
---|
| 359 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
| 360 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 361 | ENDIF |
---|
[1353] | 362 | z0h_av = 0.0_wp |
---|
[978] | 363 | |
---|
[1788] | 364 | CASE ( 'z0q*' ) |
---|
| 365 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
| 366 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 367 | ENDIF |
---|
| 368 | z0q_av = 0.0_wp |
---|
| 369 | |
---|
[1] | 370 | CASE DEFAULT |
---|
[1972] | 371 | |
---|
[1] | 372 | ! |
---|
[1972] | 373 | !-- Land surface quantity |
---|
| 374 | IF ( land_surface ) THEN |
---|
| 375 | CALL lsm_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 376 | ENDIF |
---|
| 377 | |
---|
| 378 | ! |
---|
[1976] | 379 | !-- Radiation quantity |
---|
| 380 | IF ( radiation ) THEN |
---|
| 381 | CALL radiation_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 382 | ENDIF |
---|
| 383 | |
---|
| 384 | ! |
---|
[1] | 385 | !-- User-defined quantity |
---|
| 386 | CALL user_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 387 | |
---|
| 388 | END SELECT |
---|
| 389 | |
---|
| 390 | ENDDO |
---|
| 391 | |
---|
| 392 | ENDIF |
---|
| 393 | |
---|
| 394 | ! |
---|
| 395 | !-- Loop of all variables to be averaged. |
---|
| 396 | DO ii = 1, doav_n |
---|
| 397 | |
---|
| 398 | ! |
---|
| 399 | !-- Store the array chosen on the temporary array. |
---|
| 400 | SELECT CASE ( TRIM( doav(ii) ) ) |
---|
| 401 | |
---|
| 402 | CASE ( 'e' ) |
---|
[667] | 403 | DO i = nxlg, nxrg |
---|
| 404 | DO j = nysg, nyng |
---|
[1] | 405 | DO k = nzb, nzt+1 |
---|
| 406 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
| 407 | ENDDO |
---|
| 408 | ENDDO |
---|
| 409 | ENDDO |
---|
| 410 | |
---|
[771] | 411 | CASE ( 'lpt' ) |
---|
| 412 | DO i = nxlg, nxrg |
---|
| 413 | DO j = nysg, nyng |
---|
| 414 | DO k = nzb, nzt+1 |
---|
| 415 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
| 416 | ENDDO |
---|
| 417 | ENDDO |
---|
| 418 | ENDDO |
---|
| 419 | |
---|
[1] | 420 | CASE ( 'lwp*' ) |
---|
[667] | 421 | DO i = nxlg, nxrg |
---|
| 422 | DO j = nysg, nyng |
---|
[1691] | 423 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) & |
---|
| 424 | * dzw(1:nzt+1) ) * rho_surface |
---|
[1] | 425 | ENDDO |
---|
| 426 | ENDDO |
---|
| 427 | |
---|
[1053] | 428 | CASE ( 'nr' ) |
---|
| 429 | DO i = nxlg, nxrg |
---|
| 430 | DO j = nysg, nyng |
---|
| 431 | DO k = nzb, nzt+1 |
---|
| 432 | nr_av(k,j,i) = nr_av(k,j,i) + nr(k,j,i) |
---|
| 433 | ENDDO |
---|
| 434 | ENDDO |
---|
| 435 | ENDDO |
---|
| 436 | |
---|
[1691] | 437 | CASE ( 'ol*' ) |
---|
| 438 | DO i = nxlg, nxrg |
---|
| 439 | DO j = nysg, nyng |
---|
| 440 | ol_av(j,i) = ol_av(j,i) + ol(j,i) |
---|
| 441 | ENDDO |
---|
| 442 | ENDDO |
---|
| 443 | |
---|
[1] | 444 | CASE ( 'p' ) |
---|
[667] | 445 | DO i = nxlg, nxrg |
---|
| 446 | DO j = nysg, nyng |
---|
[1] | 447 | DO k = nzb, nzt+1 |
---|
| 448 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
| 449 | ENDDO |
---|
| 450 | ENDDO |
---|
| 451 | ENDDO |
---|
| 452 | |
---|
| 453 | CASE ( 'pc' ) |
---|
| 454 | DO i = nxl, nxr |
---|
| 455 | DO j = nys, nyn |
---|
| 456 | DO k = nzb, nzt+1 |
---|
| 457 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
| 458 | ENDDO |
---|
| 459 | ENDDO |
---|
| 460 | ENDDO |
---|
| 461 | |
---|
| 462 | CASE ( 'pr' ) |
---|
| 463 | DO i = nxl, nxr |
---|
| 464 | DO j = nys, nyn |
---|
| 465 | DO k = nzb, nzt+1 |
---|
[1359] | 466 | number_of_particles = prt_count(k,j,i) |
---|
| 467 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 468 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 469 | s_r2 = 0.0_wp |
---|
[1353] | 470 | s_r3 = 0.0_wp |
---|
[1359] | 471 | |
---|
| 472 | DO n = 1, number_of_particles |
---|
| 473 | IF ( particles(n)%particle_mask ) THEN |
---|
| 474 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
| 475 | particles(n)%weight_factor |
---|
| 476 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
| 477 | particles(n)%weight_factor |
---|
| 478 | ENDIF |
---|
[1] | 479 | ENDDO |
---|
[1359] | 480 | |
---|
| 481 | IF ( s_r2 > 0.0_wp ) THEN |
---|
| 482 | mean_r = s_r3 / s_r2 |
---|
[1] | 483 | ELSE |
---|
[1353] | 484 | mean_r = 0.0_wp |
---|
[1] | 485 | ENDIF |
---|
| 486 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
| 487 | ENDDO |
---|
| 488 | ENDDO |
---|
| 489 | ENDDO |
---|
| 490 | |
---|
[1359] | 491 | |
---|
[72] | 492 | CASE ( 'pr*' ) |
---|
[667] | 493 | DO i = nxlg, nxrg |
---|
| 494 | DO j = nysg, nyng |
---|
[72] | 495 | precipitation_rate_av(j,i) = precipitation_rate_av(j,i) + & |
---|
| 496 | precipitation_rate(j,i) |
---|
| 497 | ENDDO |
---|
| 498 | ENDDO |
---|
| 499 | |
---|
[1] | 500 | CASE ( 'pt' ) |
---|
| 501 | IF ( .NOT. cloud_physics ) THEN |
---|
[667] | 502 | DO i = nxlg, nxrg |
---|
| 503 | DO j = nysg, nyng |
---|
| 504 | DO k = nzb, nzt+1 |
---|
[1] | 505 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
| 506 | ENDDO |
---|
| 507 | ENDDO |
---|
| 508 | ENDDO |
---|
| 509 | ELSE |
---|
[667] | 510 | DO i = nxlg, nxrg |
---|
| 511 | DO j = nysg, nyng |
---|
| 512 | DO k = nzb, nzt+1 |
---|
[1] | 513 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + l_d_cp * & |
---|
| 514 | pt_d_t(k) * ql(k,j,i) |
---|
| 515 | ENDDO |
---|
| 516 | ENDDO |
---|
| 517 | ENDDO |
---|
| 518 | ENDIF |
---|
| 519 | |
---|
| 520 | CASE ( 'q' ) |
---|
[667] | 521 | DO i = nxlg, nxrg |
---|
| 522 | DO j = nysg, nyng |
---|
[1] | 523 | DO k = nzb, nzt+1 |
---|
| 524 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
| 525 | ENDDO |
---|
| 526 | ENDDO |
---|
| 527 | ENDDO |
---|
[402] | 528 | |
---|
[1115] | 529 | CASE ( 'qc' ) |
---|
| 530 | DO i = nxlg, nxrg |
---|
| 531 | DO j = nysg, nyng |
---|
| 532 | DO k = nzb, nzt+1 |
---|
| 533 | qc_av(k,j,i) = qc_av(k,j,i) + qc(k,j,i) |
---|
| 534 | ENDDO |
---|
| 535 | ENDDO |
---|
| 536 | ENDDO |
---|
| 537 | |
---|
[1] | 538 | CASE ( 'ql' ) |
---|
[667] | 539 | DO i = nxlg, nxrg |
---|
| 540 | DO j = nysg, nyng |
---|
[1] | 541 | DO k = nzb, nzt+1 |
---|
| 542 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
| 543 | ENDDO |
---|
| 544 | ENDDO |
---|
| 545 | ENDDO |
---|
| 546 | |
---|
| 547 | CASE ( 'ql_c' ) |
---|
[667] | 548 | DO i = nxlg, nxrg |
---|
| 549 | DO j = nysg, nyng |
---|
[1] | 550 | DO k = nzb, nzt+1 |
---|
| 551 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
| 552 | ENDDO |
---|
| 553 | ENDDO |
---|
| 554 | ENDDO |
---|
| 555 | |
---|
| 556 | CASE ( 'ql_v' ) |
---|
[667] | 557 | DO i = nxlg, nxrg |
---|
| 558 | DO j = nysg, nyng |
---|
[1] | 559 | DO k = nzb, nzt+1 |
---|
| 560 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
| 561 | ENDDO |
---|
| 562 | ENDDO |
---|
| 563 | ENDDO |
---|
| 564 | |
---|
| 565 | CASE ( 'ql_vp' ) |
---|
[1007] | 566 | DO i = nxl, nxr |
---|
| 567 | DO j = nys, nyn |
---|
[1] | 568 | DO k = nzb, nzt+1 |
---|
[1359] | 569 | number_of_particles = prt_count(k,j,i) |
---|
| 570 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 571 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 572 | DO n = 1, number_of_particles |
---|
| 573 | IF ( particles(n)%particle_mask ) THEN |
---|
| 574 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
| 575 | particles(n)%weight_factor / & |
---|
| 576 | number_of_particles |
---|
| 577 | ENDIF |
---|
[1007] | 578 | ENDDO |
---|
[1] | 579 | ENDDO |
---|
| 580 | ENDDO |
---|
| 581 | ENDDO |
---|
| 582 | |
---|
[1053] | 583 | CASE ( 'qr' ) |
---|
| 584 | DO i = nxlg, nxrg |
---|
| 585 | DO j = nysg, nyng |
---|
| 586 | DO k = nzb, nzt+1 |
---|
| 587 | qr_av(k,j,i) = qr_av(k,j,i) + qr(k,j,i) |
---|
| 588 | ENDDO |
---|
| 589 | ENDDO |
---|
| 590 | ENDDO |
---|
| 591 | |
---|
[402] | 592 | CASE ( 'qsws*' ) |
---|
[667] | 593 | DO i = nxlg, nxrg |
---|
| 594 | DO j = nysg, nyng |
---|
[402] | 595 | qsws_av(j,i) = qsws_av(j,i) + qsws(j,i) |
---|
| 596 | ENDDO |
---|
| 597 | ENDDO |
---|
| 598 | |
---|
[1] | 599 | CASE ( 'qv' ) |
---|
[667] | 600 | DO i = nxlg, nxrg |
---|
| 601 | DO j = nysg, nyng |
---|
[1] | 602 | DO k = nzb, nzt+1 |
---|
| 603 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
| 604 | ENDDO |
---|
| 605 | ENDDO |
---|
| 606 | ENDDO |
---|
| 607 | |
---|
[96] | 608 | CASE ( 'rho' ) |
---|
[667] | 609 | DO i = nxlg, nxrg |
---|
| 610 | DO j = nysg, nyng |
---|
[96] | 611 | DO k = nzb, nzt+1 |
---|
| 612 | rho_av(k,j,i) = rho_av(k,j,i) + rho(k,j,i) |
---|
| 613 | ENDDO |
---|
| 614 | ENDDO |
---|
| 615 | ENDDO |
---|
[402] | 616 | |
---|
[1] | 617 | CASE ( 's' ) |
---|
[667] | 618 | DO i = nxlg, nxrg |
---|
| 619 | DO j = nysg, nyng |
---|
[1] | 620 | DO k = nzb, nzt+1 |
---|
| 621 | s_av(k,j,i) = s_av(k,j,i) + q(k,j,i) |
---|
| 622 | ENDDO |
---|
| 623 | ENDDO |
---|
| 624 | ENDDO |
---|
[402] | 625 | |
---|
[96] | 626 | CASE ( 'sa' ) |
---|
[667] | 627 | DO i = nxlg, nxrg |
---|
| 628 | DO j = nysg, nyng |
---|
[96] | 629 | DO k = nzb, nzt+1 |
---|
| 630 | sa_av(k,j,i) = sa_av(k,j,i) + sa(k,j,i) |
---|
| 631 | ENDDO |
---|
| 632 | ENDDO |
---|
| 633 | ENDDO |
---|
[402] | 634 | |
---|
| 635 | CASE ( 'shf*' ) |
---|
[667] | 636 | DO i = nxlg, nxrg |
---|
| 637 | DO j = nysg, nyng |
---|
[402] | 638 | shf_av(j,i) = shf_av(j,i) + shf(j,i) |
---|
| 639 | ENDDO |
---|
| 640 | ENDDO |
---|
| 641 | |
---|
[1960] | 642 | CASE ( 'ssws*' ) |
---|
| 643 | DO i = nxlg, nxrg |
---|
| 644 | DO j = nysg, nyng |
---|
| 645 | ssws_av(j,i) = ssws_av(j,i) + ssws(j,i) |
---|
| 646 | ENDDO |
---|
| 647 | ENDDO |
---|
| 648 | |
---|
[1] | 649 | CASE ( 't*' ) |
---|
[667] | 650 | DO i = nxlg, nxrg |
---|
| 651 | DO j = nysg, nyng |
---|
[1] | 652 | ts_av(j,i) = ts_av(j,i) + ts(j,i) |
---|
| 653 | ENDDO |
---|
| 654 | ENDDO |
---|
| 655 | |
---|
| 656 | CASE ( 'u' ) |
---|
[667] | 657 | DO i = nxlg, nxrg |
---|
| 658 | DO j = nysg, nyng |
---|
[1] | 659 | DO k = nzb, nzt+1 |
---|
| 660 | u_av(k,j,i) = u_av(k,j,i) + u(k,j,i) |
---|
| 661 | ENDDO |
---|
| 662 | ENDDO |
---|
| 663 | ENDDO |
---|
| 664 | |
---|
| 665 | CASE ( 'u*' ) |
---|
[667] | 666 | DO i = nxlg, nxrg |
---|
| 667 | DO j = nysg, nyng |
---|
[1] | 668 | us_av(j,i) = us_av(j,i) + us(j,i) |
---|
| 669 | ENDDO |
---|
| 670 | ENDDO |
---|
| 671 | |
---|
| 672 | CASE ( 'v' ) |
---|
[667] | 673 | DO i = nxlg, nxrg |
---|
| 674 | DO j = nysg, nyng |
---|
[1] | 675 | DO k = nzb, nzt+1 |
---|
| 676 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
| 677 | ENDDO |
---|
| 678 | ENDDO |
---|
| 679 | ENDDO |
---|
| 680 | |
---|
| 681 | CASE ( 'vpt' ) |
---|
[667] | 682 | DO i = nxlg, nxrg |
---|
| 683 | DO j = nysg, nyng |
---|
[1] | 684 | DO k = nzb, nzt+1 |
---|
| 685 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
| 686 | ENDDO |
---|
| 687 | ENDDO |
---|
| 688 | ENDDO |
---|
| 689 | |
---|
| 690 | CASE ( 'w' ) |
---|
[667] | 691 | DO i = nxlg, nxrg |
---|
| 692 | DO j = nysg, nyng |
---|
[1] | 693 | DO k = nzb, nzt+1 |
---|
| 694 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
| 695 | ENDDO |
---|
| 696 | ENDDO |
---|
| 697 | ENDDO |
---|
| 698 | |
---|
[72] | 699 | CASE ( 'z0*' ) |
---|
[667] | 700 | DO i = nxlg, nxrg |
---|
| 701 | DO j = nysg, nyng |
---|
[72] | 702 | z0_av(j,i) = z0_av(j,i) + z0(j,i) |
---|
| 703 | ENDDO |
---|
| 704 | ENDDO |
---|
| 705 | |
---|
[978] | 706 | CASE ( 'z0h*' ) |
---|
| 707 | DO i = nxlg, nxrg |
---|
| 708 | DO j = nysg, nyng |
---|
| 709 | z0h_av(j,i) = z0h_av(j,i) + z0h(j,i) |
---|
| 710 | ENDDO |
---|
| 711 | ENDDO |
---|
| 712 | |
---|
[1788] | 713 | CASE ( 'z0q*' ) |
---|
| 714 | DO i = nxlg, nxrg |
---|
| 715 | DO j = nysg, nyng |
---|
| 716 | z0q_av(j,i) = z0q_av(j,i) + z0q(j,i) |
---|
| 717 | ENDDO |
---|
| 718 | ENDDO |
---|
| 719 | |
---|
[1] | 720 | CASE DEFAULT |
---|
| 721 | ! |
---|
[1972] | 722 | !-- Land surface quantity |
---|
| 723 | IF ( land_surface ) THEN |
---|
| 724 | CALL lsm_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 725 | ENDIF |
---|
| 726 | |
---|
| 727 | ! |
---|
[1976] | 728 | !-- Radiation quantity |
---|
| 729 | IF ( radiation ) THEN |
---|
| 730 | CALL radiation_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 731 | ENDIF |
---|
| 732 | |
---|
| 733 | ! |
---|
[1] | 734 | !-- User-defined quantity |
---|
| 735 | CALL user_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 736 | |
---|
| 737 | END SELECT |
---|
| 738 | |
---|
| 739 | ENDDO |
---|
| 740 | |
---|
[1318] | 741 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
[1] | 742 | |
---|
| 743 | |
---|
| 744 | END SUBROUTINE sum_up_3d_data |
---|