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