[1682] | 1 | !> @file sum_up_3d_data.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1360] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: sum_up_3d_data.f90 3004 2018-04-27 12:33:25Z gronemeier $ |
---|
[3004] | 27 | ! prr field added to ONLY-list, prr* case/pr* case/precipitation_rate_av |
---|
| 28 | ! removed, further allocation checks implemented |
---|
| 29 | ! |
---|
| 30 | ! 2963 2018-04-12 14:47:44Z suehring |
---|
[2963] | 31 | ! Introduce index for vegetation/wall, pavement/green-wall and water/window |
---|
| 32 | ! surfaces, for clearer access of surface fraction, albedo, emissivity, etc. . |
---|
| 33 | ! |
---|
| 34 | ! 2894 2018-03-15 09:17:58Z Giersch |
---|
[2894] | 35 | ! Changed comment |
---|
| 36 | ! |
---|
| 37 | ! 2817 2018-02-19 16:32:21Z suehring |
---|
[2817] | 38 | ! Preliminary gust module interface implemented |
---|
| 39 | ! |
---|
| 40 | ! 2798 2018-02-09 17:16:39Z suehring |
---|
[2798] | 41 | ! Consider also default-type surfaces for surface temperature output. |
---|
| 42 | ! |
---|
| 43 | ! 2797 2018-02-08 13:24:35Z suehring |
---|
[2797] | 44 | ! Enable output of ground-heat flux also at urban surfaces. |
---|
| 45 | ! |
---|
| 46 | ! 2790 2018-02-06 11:57:19Z suehring |
---|
[2790] | 47 | ! Bugfix in summation of surface sensible and latent heat flux |
---|
| 48 | ! |
---|
| 49 | ! 2766 2018-01-22 17:17:47Z kanani |
---|
[2766] | 50 | ! Removed preprocessor directive __chem |
---|
| 51 | ! |
---|
| 52 | ! 2743 2018-01-12 16:03:39Z suehring |
---|
[2743] | 53 | ! In case of natural- and urban-type surfaces output surfaces fluxes in W/m2. |
---|
| 54 | ! |
---|
| 55 | ! 2742 2018-01-12 14:59:47Z suehring |
---|
[2742] | 56 | ! Enable output of surface temperature |
---|
| 57 | ! |
---|
| 58 | ! 2735 2018-01-11 12:01:27Z suehring |
---|
[2735] | 59 | ! output of r_a moved from land-surface to consider also urban-type surfaces |
---|
| 60 | ! |
---|
| 61 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 62 | ! Corrected "Former revisions" section |
---|
| 63 | ! |
---|
| 64 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 65 | ! - Change in file header (GPL part) |
---|
[2696] | 66 | ! - Implementation of uv exposure model (FK) |
---|
| 67 | ! - output of diss_av, kh_av, km_av (turbulence_closure_mod) (TG) |
---|
| 68 | ! - Implementation of chemistry module (FK) |
---|
| 69 | ! - Workaround for sum-up usm arrays in case of restart runs, to avoid program |
---|
| 70 | ! crash (MS) |
---|
| 71 | ! |
---|
| 72 | ! 2292 2017-06-20 09:51:42Z schwenkel |
---|
[2292] | 73 | ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' |
---|
| 74 | ! includes two more prognostic equations for cloud drop concentration (nc) |
---|
| 75 | ! and cloud water content (qc). |
---|
| 76 | ! |
---|
| 77 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[1321] | 78 | ! |
---|
[2233] | 79 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 80 | ! Adjustments to new surface concept |
---|
| 81 | ! |
---|
[2032] | 82 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
| 83 | ! renamed variable rho to rho_ocean and rho_av to rho_ocean_av |
---|
| 84 | ! |
---|
[2025] | 85 | ! 2024 2016-10-12 16:42:37Z kanani |
---|
| 86 | ! Added missing CASE for ssws* |
---|
| 87 | ! |
---|
[2012] | 88 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
| 89 | ! Flag urban_surface is now defined in module control_parameters, |
---|
| 90 | ! changed prefix for urban surface model output to "usm_", |
---|
| 91 | ! introduced control parameter varnamelength for LEN of trimvar. |
---|
| 92 | ! |
---|
[2008] | 93 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
| 94 | ! Added support for new urban surface model (temporary modifications of |
---|
| 95 | ! SELECT CASE ( ) necessary, see variable trimvar), |
---|
| 96 | ! added comments in variable declaration section |
---|
| 97 | ! |
---|
[2001] | 98 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 99 | ! Forced header and separation lines into 80 columns |
---|
| 100 | ! |
---|
[1993] | 101 | ! 1992 2016-08-12 15:14:59Z suehring |
---|
| 102 | ! Bugfix in summation of passive scalar |
---|
| 103 | ! |
---|
[1977] | 104 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
| 105 | ! Radiation actions are now done directly in the respective module |
---|
| 106 | ! |
---|
[1973] | 107 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
| 108 | ! Land surface actions are now done directly in the respective module |
---|
| 109 | ! |
---|
[1961] | 110 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 111 | ! Scalar surface flux added |
---|
| 112 | ! |
---|
[1950] | 113 | ! 1949 2016-06-17 07:19:16Z maronga |
---|
| 114 | ! Bugfix: calculation of lai_av, c_veg_av and c_liq_av. |
---|
| 115 | ! |
---|
[1851] | 116 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
| 117 | ! precipitation_rate moved to arrays_3d |
---|
[1852] | 118 | ! |
---|
[1789] | 119 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
| 120 | ! Added z0q and z0q_av |
---|
| 121 | ! |
---|
[1694] | 122 | ! 1693 2015-10-27 08:35:45Z maronga |
---|
| 123 | ! Last revision text corrected |
---|
| 124 | ! |
---|
[1692] | 125 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 126 | ! Added output of Obukhov length and radiative heating rates for RRTMG. |
---|
[1693] | 127 | ! Corrected output of liquid water path. |
---|
[1692] | 128 | ! |
---|
[1683] | 129 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 130 | ! Code annotations made doxygen readable |
---|
| 131 | ! |
---|
[1586] | 132 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
| 133 | ! Adapted for RRTMG |
---|
| 134 | ! |
---|
[1556] | 135 | ! 1555 2015-03-04 17:44:27Z maronga |
---|
| 136 | ! Added output of r_a and r_s |
---|
| 137 | ! |
---|
[1552] | 138 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 139 | ! Added support for land surface model and radiation model data. |
---|
| 140 | ! |
---|
[1360] | 141 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 142 | ! New particle structure integrated. |
---|
| 143 | ! |
---|
[1354] | 144 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 145 | ! REAL constants provided with KIND-attribute |
---|
| 146 | ! |
---|
[1321] | 147 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 148 | ! ONLY-attribute added to USE-statements, |
---|
| 149 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 150 | ! kinds are defined in new module kinds, |
---|
| 151 | ! old module precision_kind is removed, |
---|
| 152 | ! revision history before 2012 removed, |
---|
| 153 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 154 | ! all variable declaration statements |
---|
[1] | 155 | ! |
---|
[1319] | 156 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 157 | ! barrier argument removed from cpu_log, |
---|
| 158 | ! module interfaces removed |
---|
| 159 | ! |
---|
[1116] | 160 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 161 | ! ql is calculated by calc_liquid_water_content |
---|
| 162 | ! |
---|
[1054] | 163 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 164 | ! +nr, prr, qr |
---|
| 165 | ! |
---|
[1037] | 166 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 167 | ! code put under GPL (PALM 3.9) |
---|
| 168 | ! |
---|
[1008] | 169 | ! 1007 2012-09-19 14:30:36Z franke |
---|
| 170 | ! Bugfix in calculation of ql_vp |
---|
| 171 | ! |
---|
[979] | 172 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 173 | ! +z0h* |
---|
| 174 | ! |
---|
[1] | 175 | ! Revision 1.1 2006/02/23 12:55:23 raasch |
---|
| 176 | ! Initial revision |
---|
| 177 | ! |
---|
| 178 | ! |
---|
| 179 | ! Description: |
---|
| 180 | ! ------------ |
---|
[1682] | 181 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine |
---|
| 182 | !> average_3d_data. |
---|
[1] | 183 | !------------------------------------------------------------------------------! |
---|
[1682] | 184 | SUBROUTINE sum_up_3d_data |
---|
| 185 | |
---|
[1] | 186 | |
---|
[1320] | 187 | USE arrays_3d, & |
---|
[3004] | 188 | ONLY: dzw, e, heatflux_output_conversion, nc, nr, p, prr, pt, & |
---|
| 189 | q, qc, ql, ql_c, ql_v, qr, rho_ocean, s, sa, u, v, vpt, w, & |
---|
[2743] | 190 | waterflux_output_conversion |
---|
[1] | 191 | |
---|
[1320] | 192 | USE averaging, & |
---|
[2797] | 193 | ONLY: diss_av, e_av, ghf_av, kh_av, km_av, lpt_av, lwp_av, nc_av, & |
---|
| 194 | nr_av, & |
---|
[3004] | 195 | ol_av, p_av, pc_av, pr_av, prr_av, pt_av, q_av, qc_av, ql_av, & |
---|
| 196 | ql_c_av, ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, r_a_av, & |
---|
| 197 | rho_ocean_av, s_av, sa_av, shf_av, ssws_av, ts_av, tsurf_av, & |
---|
| 198 | u_av, us_av, v_av, vpt_av, w_av, z0_av, z0h_av, z0q_av |
---|
[2696] | 199 | USE chemistry_model_mod, & |
---|
| 200 | ONLY: chem_3d_data_averaging, chem_integrate, chem_species, nspec |
---|
[1320] | 201 | |
---|
| 202 | USE cloud_parameters, & |
---|
[2743] | 203 | ONLY: cp, l_d_cp, l_v, pt_d_t |
---|
[1320] | 204 | |
---|
| 205 | USE control_parameters, & |
---|
[2696] | 206 | ONLY: air_chemistry, average_count_3d, cloud_physics, doav, doav_n, & |
---|
| 207 | land_surface, rho_surface, urban_surface, uv_exposure, & |
---|
| 208 | varnamelength |
---|
[1320] | 209 | |
---|
| 210 | USE cpulog, & |
---|
| 211 | ONLY: cpu_log, log_point |
---|
| 212 | |
---|
[2817] | 213 | USE gust_mod, & |
---|
| 214 | ONLY: gust_3d_data_averaging, gust_module_enabled |
---|
| 215 | |
---|
[1320] | 216 | USE indices, & |
---|
| 217 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
| 218 | |
---|
| 219 | USE kinds |
---|
| 220 | |
---|
[1551] | 221 | USE land_surface_model_mod, & |
---|
[2232] | 222 | ONLY: lsm_3d_data_averaging |
---|
[1551] | 223 | |
---|
[1320] | 224 | USE particle_attributes, & |
---|
[1359] | 225 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
[1320] | 226 | |
---|
[1551] | 227 | USE radiation_model_mod, & |
---|
[1976] | 228 | ONLY: radiation, radiation_3d_data_averaging |
---|
[1551] | 229 | |
---|
[2232] | 230 | USE surface_mod, & |
---|
[2963] | 231 | ONLY: ind_pav_green, ind_veg_wall, ind_wat_win, & |
---|
| 232 | surf_def_h, surf_lsm_h, surf_usm_h |
---|
[2232] | 233 | |
---|
[2696] | 234 | USE turbulence_closure_mod, & |
---|
| 235 | ONLY: tcm_3d_data_averaging |
---|
| 236 | |
---|
[2007] | 237 | USE urban_surface_mod, & |
---|
[2011] | 238 | ONLY: usm_average_3d_data |
---|
[1691] | 239 | |
---|
[2696] | 240 | USE uv_exposure_model_mod, & |
---|
| 241 | ONLY: uvem_3d_data_averaging |
---|
[2007] | 242 | |
---|
[2696] | 243 | |
---|
[1] | 244 | IMPLICIT NONE |
---|
| 245 | |
---|
[2232] | 246 | INTEGER(iwp) :: i !< grid index x direction |
---|
[2007] | 247 | INTEGER(iwp) :: ii !< running index |
---|
[2232] | 248 | INTEGER(iwp) :: j !< grid index y direction |
---|
| 249 | INTEGER(iwp) :: k !< grid index x direction |
---|
| 250 | INTEGER(iwp) :: m !< running index surface type |
---|
[1682] | 251 | INTEGER(iwp) :: n !< |
---|
[1] | 252 | |
---|
[1682] | 253 | REAL(wp) :: mean_r !< |
---|
| 254 | REAL(wp) :: s_r2 !< |
---|
| 255 | REAL(wp) :: s_r3 !< |
---|
[1] | 256 | |
---|
[2011] | 257 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
[2007] | 258 | |
---|
| 259 | |
---|
[1] | 260 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
| 261 | |
---|
| 262 | ! |
---|
| 263 | !-- Allocate and initialize the summation arrays if called for the very first |
---|
| 264 | !-- time or the first time after average_3d_data has been called |
---|
| 265 | !-- (some or all of the arrays may have been already allocated |
---|
[2894] | 266 | !-- in rrd_local) |
---|
[1] | 267 | IF ( average_count_3d == 0 ) THEN |
---|
| 268 | |
---|
| 269 | DO ii = 1, doav_n |
---|
[2007] | 270 | ! |
---|
| 271 | !-- Temporary solution to account for data output within the new urban |
---|
| 272 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
| 273 | trimvar = TRIM( doav(ii) ) |
---|
[2011] | 274 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
[2007] | 275 | trimvar = 'usm_output' |
---|
| 276 | ENDIF |
---|
| 277 | |
---|
| 278 | SELECT CASE ( trimvar ) |
---|
[1] | 279 | |
---|
[2797] | 280 | CASE ( 'ghf*' ) |
---|
| 281 | IF ( .NOT. ALLOCATED( ghf_av ) ) THEN |
---|
| 282 | ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 283 | ENDIF |
---|
| 284 | ghf_av = 0.0_wp |
---|
| 285 | |
---|
[1] | 286 | CASE ( 'e' ) |
---|
| 287 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
[667] | 288 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 289 | ENDIF |
---|
[1353] | 290 | e_av = 0.0_wp |
---|
[1] | 291 | |
---|
[771] | 292 | CASE ( 'lpt' ) |
---|
| 293 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
| 294 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 295 | ENDIF |
---|
[1353] | 296 | lpt_av = 0.0_wp |
---|
[771] | 297 | |
---|
[1] | 298 | CASE ( 'lwp*' ) |
---|
| 299 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
[667] | 300 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 301 | ENDIF |
---|
[1353] | 302 | lwp_av = 0.0_wp |
---|
[1] | 303 | |
---|
[2292] | 304 | CASE ( 'nc' ) |
---|
| 305 | IF ( .NOT. ALLOCATED( nc_av ) ) THEN |
---|
| 306 | ALLOCATE( nc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 307 | ENDIF |
---|
| 308 | nc_av = 0.0_wp |
---|
| 309 | |
---|
[1053] | 310 | CASE ( 'nr' ) |
---|
| 311 | IF ( .NOT. ALLOCATED( nr_av ) ) THEN |
---|
| 312 | ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 313 | ENDIF |
---|
[1353] | 314 | nr_av = 0.0_wp |
---|
[1053] | 315 | |
---|
[1691] | 316 | CASE ( 'ol*' ) |
---|
| 317 | IF ( .NOT. ALLOCATED( ol_av ) ) THEN |
---|
| 318 | ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 319 | ENDIF |
---|
| 320 | ol_av = 0.0_wp |
---|
| 321 | |
---|
[1] | 322 | CASE ( 'p' ) |
---|
| 323 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
[667] | 324 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 325 | ENDIF |
---|
[1353] | 326 | p_av = 0.0_wp |
---|
[1] | 327 | |
---|
| 328 | CASE ( 'pc' ) |
---|
| 329 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
[667] | 330 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 331 | ENDIF |
---|
[1353] | 332 | pc_av = 0.0_wp |
---|
[1] | 333 | |
---|
| 334 | CASE ( 'pr' ) |
---|
| 335 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
[667] | 336 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 337 | ENDIF |
---|
[1353] | 338 | pr_av = 0.0_wp |
---|
[1] | 339 | |
---|
[1053] | 340 | CASE ( 'prr' ) |
---|
| 341 | IF ( .NOT. ALLOCATED( prr_av ) ) THEN |
---|
| 342 | ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 343 | ENDIF |
---|
[1353] | 344 | prr_av = 0.0_wp |
---|
[1053] | 345 | |
---|
[1] | 346 | CASE ( 'pt' ) |
---|
| 347 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
[667] | 348 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 349 | ENDIF |
---|
[1353] | 350 | pt_av = 0.0_wp |
---|
[1] | 351 | |
---|
| 352 | CASE ( 'q' ) |
---|
| 353 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
[667] | 354 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 355 | ENDIF |
---|
[1353] | 356 | q_av = 0.0_wp |
---|
[1] | 357 | |
---|
[1115] | 358 | CASE ( 'qc' ) |
---|
| 359 | IF ( .NOT. ALLOCATED( qc_av ) ) THEN |
---|
| 360 | ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 361 | ENDIF |
---|
[1353] | 362 | qc_av = 0.0_wp |
---|
[1115] | 363 | |
---|
[1] | 364 | CASE ( 'ql' ) |
---|
| 365 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
[667] | 366 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 367 | ENDIF |
---|
[1353] | 368 | ql_av = 0.0_wp |
---|
[1] | 369 | |
---|
| 370 | CASE ( 'ql_c' ) |
---|
| 371 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
[667] | 372 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 373 | ENDIF |
---|
[1353] | 374 | ql_c_av = 0.0_wp |
---|
[1] | 375 | |
---|
| 376 | CASE ( 'ql_v' ) |
---|
| 377 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
[667] | 378 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 379 | ENDIF |
---|
[1353] | 380 | ql_v_av = 0.0_wp |
---|
[1] | 381 | |
---|
| 382 | CASE ( 'ql_vp' ) |
---|
| 383 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
[667] | 384 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 385 | ENDIF |
---|
[1353] | 386 | ql_vp_av = 0.0_wp |
---|
[1] | 387 | |
---|
[1053] | 388 | CASE ( 'qr' ) |
---|
| 389 | IF ( .NOT. ALLOCATED( qr_av ) ) THEN |
---|
| 390 | ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 391 | ENDIF |
---|
[1353] | 392 | qr_av = 0.0_wp |
---|
[1053] | 393 | |
---|
[354] | 394 | CASE ( 'qsws*' ) |
---|
| 395 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
[667] | 396 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
[354] | 397 | ENDIF |
---|
[1353] | 398 | qsws_av = 0.0_wp |
---|
[354] | 399 | |
---|
[1] | 400 | CASE ( 'qv' ) |
---|
| 401 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
[667] | 402 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 403 | ENDIF |
---|
[1353] | 404 | qv_av = 0.0_wp |
---|
[1] | 405 | |
---|
[2735] | 406 | CASE ( 'r_a*' ) |
---|
| 407 | IF ( .NOT. ALLOCATED( r_a_av ) ) THEN |
---|
| 408 | ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 409 | ENDIF |
---|
| 410 | r_a_av = 0.0_wp |
---|
| 411 | |
---|
[2031] | 412 | CASE ( 'rho_ocean' ) |
---|
| 413 | IF ( .NOT. ALLOCATED( rho_ocean_av ) ) THEN |
---|
| 414 | ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[96] | 415 | ENDIF |
---|
[2031] | 416 | rho_ocean_av = 0.0_wp |
---|
[96] | 417 | |
---|
[1] | 418 | CASE ( 's' ) |
---|
| 419 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
[667] | 420 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 421 | ENDIF |
---|
[1353] | 422 | s_av = 0.0_wp |
---|
[1] | 423 | |
---|
[96] | 424 | CASE ( 'sa' ) |
---|
| 425 | IF ( .NOT. ALLOCATED( sa_av ) ) THEN |
---|
[667] | 426 | ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[96] | 427 | ENDIF |
---|
[1353] | 428 | sa_av = 0.0_wp |
---|
[96] | 429 | |
---|
[354] | 430 | CASE ( 'shf*' ) |
---|
| 431 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
[667] | 432 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
[354] | 433 | ENDIF |
---|
[1353] | 434 | shf_av = 0.0_wp |
---|
[2024] | 435 | |
---|
| 436 | CASE ( 'ssws*' ) |
---|
| 437 | IF ( .NOT. ALLOCATED( ssws_av ) ) THEN |
---|
| 438 | ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 439 | ENDIF |
---|
| 440 | ssws_av = 0.0_wp |
---|
[354] | 441 | |
---|
[1] | 442 | CASE ( 't*' ) |
---|
| 443 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
[667] | 444 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 445 | ENDIF |
---|
[1353] | 446 | ts_av = 0.0_wp |
---|
[1] | 447 | |
---|
[2742] | 448 | CASE ( 'tsurf*' ) |
---|
| 449 | IF ( .NOT. ALLOCATED( tsurf_av ) ) THEN |
---|
| 450 | ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 451 | ENDIF |
---|
| 452 | tsurf_av = 0.0_wp |
---|
| 453 | |
---|
[1] | 454 | CASE ( 'u' ) |
---|
| 455 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
[667] | 456 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 457 | ENDIF |
---|
[1353] | 458 | u_av = 0.0_wp |
---|
[1] | 459 | |
---|
| 460 | CASE ( 'u*' ) |
---|
| 461 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
[667] | 462 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 463 | ENDIF |
---|
[1353] | 464 | us_av = 0.0_wp |
---|
[1] | 465 | |
---|
| 466 | CASE ( 'v' ) |
---|
| 467 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
[667] | 468 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 469 | ENDIF |
---|
[1353] | 470 | v_av = 0.0_wp |
---|
[1] | 471 | |
---|
| 472 | CASE ( 'vpt' ) |
---|
| 473 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
[667] | 474 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 475 | ENDIF |
---|
[1353] | 476 | vpt_av = 0.0_wp |
---|
[1] | 477 | |
---|
| 478 | CASE ( 'w' ) |
---|
| 479 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
[667] | 480 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 481 | ENDIF |
---|
[1353] | 482 | w_av = 0.0_wp |
---|
[1] | 483 | |
---|
[72] | 484 | CASE ( 'z0*' ) |
---|
| 485 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
[667] | 486 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
[72] | 487 | ENDIF |
---|
[1353] | 488 | z0_av = 0.0_wp |
---|
[72] | 489 | |
---|
[978] | 490 | CASE ( 'z0h*' ) |
---|
| 491 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
| 492 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 493 | ENDIF |
---|
[1353] | 494 | z0h_av = 0.0_wp |
---|
[978] | 495 | |
---|
[1788] | 496 | CASE ( 'z0q*' ) |
---|
| 497 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
| 498 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 499 | ENDIF |
---|
| 500 | z0q_av = 0.0_wp |
---|
[2007] | 501 | ! |
---|
| 502 | !-- Block of urban surface model outputs |
---|
| 503 | CASE ( 'usm_output' ) |
---|
[1788] | 504 | |
---|
[2007] | 505 | CALL usm_average_3d_data( 'allocate', doav(ii) ) |
---|
| 506 | |
---|
| 507 | |
---|
[1] | 508 | CASE DEFAULT |
---|
[1972] | 509 | |
---|
[1] | 510 | ! |
---|
[2696] | 511 | !-- Turbulence closure module |
---|
| 512 | CALL tcm_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 513 | |
---|
| 514 | ! |
---|
[1972] | 515 | !-- Land surface quantity |
---|
| 516 | IF ( land_surface ) THEN |
---|
| 517 | CALL lsm_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 518 | ENDIF |
---|
| 519 | |
---|
| 520 | ! |
---|
[1976] | 521 | !-- Radiation quantity |
---|
| 522 | IF ( radiation ) THEN |
---|
| 523 | CALL radiation_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 524 | ENDIF |
---|
| 525 | |
---|
| 526 | ! |
---|
[2817] | 527 | !-- Gust module quantities |
---|
| 528 | IF ( gust_module_enabled ) THEN |
---|
| 529 | CALL gust_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 530 | ENDIF |
---|
| 531 | |
---|
| 532 | ! |
---|
[2696] | 533 | !-- Chemical quantity |
---|
| 534 | #if defined( __chem ) |
---|
| 535 | IF ( air_chemistry .AND. trimvar(1:3) == 'kc_') THEN |
---|
| 536 | CALL chem_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 537 | ENDIF |
---|
| 538 | #endif |
---|
| 539 | |
---|
| 540 | ! |
---|
| 541 | !-- UV exposure quantity |
---|
| 542 | IF ( uv_exposure .AND. trimvar(1:5) == 'uvem_') THEN |
---|
| 543 | CALL uvem_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 544 | ENDIF |
---|
| 545 | |
---|
| 546 | ! |
---|
[1] | 547 | !-- User-defined quantity |
---|
| 548 | CALL user_3d_data_averaging( 'allocate', doav(ii) ) |
---|
| 549 | |
---|
| 550 | END SELECT |
---|
| 551 | |
---|
| 552 | ENDDO |
---|
| 553 | |
---|
| 554 | ENDIF |
---|
| 555 | |
---|
| 556 | ! |
---|
| 557 | !-- Loop of all variables to be averaged. |
---|
| 558 | DO ii = 1, doav_n |
---|
| 559 | ! |
---|
[2007] | 560 | !-- Temporary solution to account for data output within the new urban |
---|
| 561 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ) |
---|
| 562 | trimvar = TRIM( doav(ii) ) |
---|
[2011] | 563 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
[2007] | 564 | trimvar = 'usm_output' |
---|
| 565 | ENDIF |
---|
| 566 | ! |
---|
[1] | 567 | !-- Store the array chosen on the temporary array. |
---|
[2007] | 568 | SELECT CASE ( trimvar ) |
---|
[1] | 569 | |
---|
[2797] | 570 | CASE ( 'ghf*' ) |
---|
[3004] | 571 | IF ( ALLOCATED( ghf_av ) ) THEN |
---|
| 572 | DO m = 1, surf_lsm_h%ns |
---|
| 573 | i = surf_lsm_h%i(m) |
---|
| 574 | j = surf_lsm_h%j(m) |
---|
| 575 | ghf_av(j,i) = ghf_av(j,i) + surf_lsm_h%ghf(m) |
---|
| 576 | ENDDO |
---|
[2797] | 577 | |
---|
[3004] | 578 | DO m = 1, surf_usm_h%ns |
---|
| 579 | i = surf_usm_h%i(m) |
---|
| 580 | j = surf_usm_h%j(m) |
---|
| 581 | ghf_av(j,i) = ghf_av(j,i) + surf_usm_h%frac(ind_veg_wall,m) * & |
---|
| 582 | surf_usm_h%wghf_eb(m) + & |
---|
| 583 | surf_usm_h%frac(ind_pav_green,m) * & |
---|
| 584 | surf_usm_h%wghf_eb_green(m) + & |
---|
| 585 | surf_usm_h%frac(ind_wat_win,m) * & |
---|
| 586 | surf_usm_h%wghf_eb_window(m) |
---|
| 587 | ENDDO |
---|
| 588 | ENDIF |
---|
[2797] | 589 | |
---|
[1] | 590 | CASE ( 'e' ) |
---|
[3004] | 591 | IF ( ALLOCATED( e_av ) ) THEN |
---|
| 592 | DO i = nxlg, nxrg |
---|
| 593 | DO j = nysg, nyng |
---|
| 594 | DO k = nzb, nzt+1 |
---|
| 595 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
| 596 | ENDDO |
---|
[1] | 597 | ENDDO |
---|
| 598 | ENDDO |
---|
[3004] | 599 | ENDIF |
---|
[1] | 600 | |
---|
[771] | 601 | CASE ( 'lpt' ) |
---|
[3004] | 602 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
| 603 | DO i = nxlg, nxrg |
---|
| 604 | DO j = nysg, nyng |
---|
| 605 | DO k = nzb, nzt+1 |
---|
| 606 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
| 607 | ENDDO |
---|
[771] | 608 | ENDDO |
---|
| 609 | ENDDO |
---|
[3004] | 610 | ENDIF |
---|
[771] | 611 | |
---|
[1] | 612 | CASE ( 'lwp*' ) |
---|
[3004] | 613 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
| 614 | DO i = nxlg, nxrg |
---|
| 615 | DO j = nysg, nyng |
---|
| 616 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) & |
---|
| 617 | * dzw(1:nzt+1) ) * rho_surface |
---|
| 618 | ENDDO |
---|
[1] | 619 | ENDDO |
---|
[3004] | 620 | ENDIF |
---|
[1] | 621 | |
---|
[2292] | 622 | CASE ( 'nc' ) |
---|
[3004] | 623 | IF ( ALLOCATED( nc_av ) ) THEN |
---|
| 624 | DO i = nxlg, nxrg |
---|
| 625 | DO j = nysg, nyng |
---|
| 626 | DO k = nzb, nzt+1 |
---|
| 627 | nc_av(k,j,i) = nc_av(k,j,i) + nc(k,j,i) |
---|
| 628 | ENDDO |
---|
[2292] | 629 | ENDDO |
---|
| 630 | ENDDO |
---|
[3004] | 631 | ENDIF |
---|
[2292] | 632 | |
---|
[1053] | 633 | CASE ( 'nr' ) |
---|
[3004] | 634 | IF ( ALLOCATED( nr_av ) ) THEN |
---|
| 635 | DO i = nxlg, nxrg |
---|
| 636 | DO j = nysg, nyng |
---|
| 637 | DO k = nzb, nzt+1 |
---|
| 638 | nr_av(k,j,i) = nr_av(k,j,i) + nr(k,j,i) |
---|
| 639 | ENDDO |
---|
[1053] | 640 | ENDDO |
---|
| 641 | ENDDO |
---|
[3004] | 642 | ENDIF |
---|
[1053] | 643 | |
---|
[1691] | 644 | CASE ( 'ol*' ) |
---|
[3004] | 645 | IF ( ALLOCATED( ol_av ) ) THEN |
---|
| 646 | DO m = 1, surf_def_h(0)%ns |
---|
| 647 | i = surf_def_h(0)%i(m) |
---|
| 648 | j = surf_def_h(0)%j(m) |
---|
| 649 | ol_av(j,i) = ol_av(j,i) + surf_def_h(0)%ol(m) |
---|
| 650 | ENDDO |
---|
| 651 | DO m = 1, surf_lsm_h%ns |
---|
| 652 | i = surf_lsm_h%i(m) |
---|
| 653 | j = surf_lsm_h%j(m) |
---|
| 654 | ol_av(j,i) = ol_av(j,i) + surf_lsm_h%ol(m) |
---|
| 655 | ENDDO |
---|
| 656 | DO m = 1, surf_usm_h%ns |
---|
| 657 | i = surf_usm_h%i(m) |
---|
| 658 | j = surf_usm_h%j(m) |
---|
| 659 | ol_av(j,i) = ol_av(j,i) + surf_usm_h%ol(m) |
---|
| 660 | ENDDO |
---|
| 661 | ENDIF |
---|
[1691] | 662 | |
---|
[1] | 663 | CASE ( 'p' ) |
---|
[3004] | 664 | IF ( ALLOCATED( p_av ) ) THEN |
---|
| 665 | DO i = nxlg, nxrg |
---|
| 666 | DO j = nysg, nyng |
---|
| 667 | DO k = nzb, nzt+1 |
---|
| 668 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
| 669 | ENDDO |
---|
[1] | 670 | ENDDO |
---|
| 671 | ENDDO |
---|
[3004] | 672 | ENDIF |
---|
[1] | 673 | |
---|
| 674 | CASE ( 'pc' ) |
---|
[3004] | 675 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
| 676 | DO i = nxl, nxr |
---|
| 677 | DO j = nys, nyn |
---|
| 678 | DO k = nzb, nzt+1 |
---|
| 679 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
| 680 | ENDDO |
---|
[1] | 681 | ENDDO |
---|
| 682 | ENDDO |
---|
[3004] | 683 | ENDIF |
---|
[1] | 684 | |
---|
| 685 | CASE ( 'pr' ) |
---|
[3004] | 686 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
| 687 | DO i = nxl, nxr |
---|
| 688 | DO j = nys, nyn |
---|
| 689 | DO k = nzb, nzt+1 |
---|
| 690 | number_of_particles = prt_count(k,j,i) |
---|
| 691 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 692 | particles => & |
---|
| 693 | grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 694 | s_r2 = 0.0_wp |
---|
| 695 | s_r3 = 0.0_wp |
---|
[1359] | 696 | |
---|
[3004] | 697 | DO n = 1, number_of_particles |
---|
| 698 | IF ( particles(n)%particle_mask ) THEN |
---|
| 699 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
| 700 | particles(n)%weight_factor |
---|
| 701 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
| 702 | particles(n)%weight_factor |
---|
| 703 | ENDIF |
---|
| 704 | ENDDO |
---|
| 705 | |
---|
| 706 | IF ( s_r2 > 0.0_wp ) THEN |
---|
| 707 | mean_r = s_r3 / s_r2 |
---|
| 708 | ELSE |
---|
| 709 | mean_r = 0.0_wp |
---|
[1359] | 710 | ENDIF |
---|
[3004] | 711 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
[1] | 712 | ENDDO |
---|
| 713 | ENDDO |
---|
| 714 | ENDDO |
---|
[3004] | 715 | ENDIF |
---|
[1] | 716 | |
---|
[3004] | 717 | CASE ( 'prr' ) |
---|
| 718 | IF ( ALLOCATED( prr_av ) ) THEN |
---|
| 719 | DO i = nxlg, nxrg |
---|
| 720 | DO j = nysg, nyng |
---|
| 721 | DO k = nzb, nzt+1 |
---|
| 722 | prr_av(k,j,i) = prr_av(k,j,i) + prr(k,j,i) |
---|
| 723 | ENDDO |
---|
| 724 | ENDDO |
---|
[72] | 725 | ENDDO |
---|
[3004] | 726 | ENDIF |
---|
[72] | 727 | |
---|
[1] | 728 | CASE ( 'pt' ) |
---|
[3004] | 729 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
| 730 | IF ( .NOT. cloud_physics ) THEN |
---|
| 731 | DO i = nxlg, nxrg |
---|
| 732 | DO j = nysg, nyng |
---|
| 733 | DO k = nzb, nzt+1 |
---|
| 734 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
| 735 | ENDDO |
---|
[1] | 736 | ENDDO |
---|
| 737 | ENDDO |
---|
[3004] | 738 | ELSE |
---|
| 739 | DO i = nxlg, nxrg |
---|
| 740 | DO j = nysg, nyng |
---|
| 741 | DO k = nzb, nzt+1 |
---|
| 742 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + l_d_cp * & |
---|
| 743 | pt_d_t(k) * ql(k,j,i) |
---|
| 744 | ENDDO |
---|
[1] | 745 | ENDDO |
---|
| 746 | ENDDO |
---|
[3004] | 747 | ENDIF |
---|
[1] | 748 | ENDIF |
---|
| 749 | |
---|
| 750 | CASE ( 'q' ) |
---|
[3004] | 751 | IF ( ALLOCATED( q_av ) ) THEN |
---|
| 752 | DO i = nxlg, nxrg |
---|
| 753 | DO j = nysg, nyng |
---|
| 754 | DO k = nzb, nzt+1 |
---|
| 755 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
| 756 | ENDDO |
---|
[1] | 757 | ENDDO |
---|
| 758 | ENDDO |
---|
[3004] | 759 | ENDIF |
---|
[402] | 760 | |
---|
[1115] | 761 | CASE ( 'qc' ) |
---|
[3004] | 762 | IF ( ALLOCATED( qc_av ) ) THEN |
---|
| 763 | DO i = nxlg, nxrg |
---|
| 764 | DO j = nysg, nyng |
---|
| 765 | DO k = nzb, nzt+1 |
---|
| 766 | qc_av(k,j,i) = qc_av(k,j,i) + qc(k,j,i) |
---|
| 767 | ENDDO |
---|
[1115] | 768 | ENDDO |
---|
| 769 | ENDDO |
---|
[3004] | 770 | ENDIF |
---|
[1115] | 771 | |
---|
[1] | 772 | CASE ( 'ql' ) |
---|
[3004] | 773 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
| 774 | DO i = nxlg, nxrg |
---|
| 775 | DO j = nysg, nyng |
---|
| 776 | DO k = nzb, nzt+1 |
---|
| 777 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
| 778 | ENDDO |
---|
[1] | 779 | ENDDO |
---|
| 780 | ENDDO |
---|
[3004] | 781 | ENDIF |
---|
[1] | 782 | |
---|
| 783 | CASE ( 'ql_c' ) |
---|
[3004] | 784 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
| 785 | DO i = nxlg, nxrg |
---|
| 786 | DO j = nysg, nyng |
---|
| 787 | DO k = nzb, nzt+1 |
---|
| 788 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
| 789 | ENDDO |
---|
[1] | 790 | ENDDO |
---|
| 791 | ENDDO |
---|
[3004] | 792 | ENDIF |
---|
[1] | 793 | |
---|
| 794 | CASE ( 'ql_v' ) |
---|
[3004] | 795 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
| 796 | DO i = nxlg, nxrg |
---|
| 797 | DO j = nysg, nyng |
---|
| 798 | DO k = nzb, nzt+1 |
---|
| 799 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
| 800 | ENDDO |
---|
[1] | 801 | ENDDO |
---|
| 802 | ENDDO |
---|
[3004] | 803 | ENDIF |
---|
[1] | 804 | |
---|
| 805 | CASE ( 'ql_vp' ) |
---|
[3004] | 806 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
| 807 | DO i = nxl, nxr |
---|
| 808 | DO j = nys, nyn |
---|
| 809 | DO k = nzb, nzt+1 |
---|
| 810 | number_of_particles = prt_count(k,j,i) |
---|
| 811 | IF ( number_of_particles <= 0 ) CYCLE |
---|
| 812 | particles => & |
---|
| 813 | grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 814 | DO n = 1, number_of_particles |
---|
| 815 | IF ( particles(n)%particle_mask ) THEN |
---|
| 816 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
| 817 | particles(n)%weight_factor / & |
---|
| 818 | number_of_particles |
---|
| 819 | ENDIF |
---|
| 820 | ENDDO |
---|
[1007] | 821 | ENDDO |
---|
[1] | 822 | ENDDO |
---|
| 823 | ENDDO |
---|
[3004] | 824 | ENDIF |
---|
[1] | 825 | |
---|
[1053] | 826 | CASE ( 'qr' ) |
---|
[3004] | 827 | IF ( ALLOCATED( qr_av ) ) THEN |
---|
| 828 | DO i = nxlg, nxrg |
---|
| 829 | DO j = nysg, nyng |
---|
| 830 | DO k = nzb, nzt+1 |
---|
| 831 | qr_av(k,j,i) = qr_av(k,j,i) + qr(k,j,i) |
---|
| 832 | ENDDO |
---|
[1053] | 833 | ENDDO |
---|
| 834 | ENDDO |
---|
[3004] | 835 | ENDIF |
---|
[1053] | 836 | |
---|
[402] | 837 | CASE ( 'qsws*' ) |
---|
[2743] | 838 | ! |
---|
| 839 | !-- In case of default surfaces, clean-up flux by density. |
---|
| 840 | !-- In case of land- and urban-surfaces, convert fluxes into |
---|
| 841 | !-- dynamic units. |
---|
[3004] | 842 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
| 843 | DO m = 1, surf_def_h(0)%ns |
---|
| 844 | i = surf_def_h(0)%i(m) |
---|
| 845 | j = surf_def_h(0)%j(m) |
---|
| 846 | k = surf_def_h(0)%k(m) |
---|
| 847 | qsws_av(j,i) = qsws_av(j,i) + surf_def_h(0)%qsws(m) * & |
---|
| 848 | waterflux_output_conversion(k) |
---|
| 849 | ENDDO |
---|
| 850 | DO m = 1, surf_lsm_h%ns |
---|
| 851 | i = surf_lsm_h%i(m) |
---|
| 852 | j = surf_lsm_h%j(m) |
---|
| 853 | qsws_av(j,i) = qsws_av(j,i) + surf_lsm_h%qsws(m) * l_v |
---|
| 854 | ENDDO |
---|
| 855 | DO m = 1, surf_usm_h%ns |
---|
| 856 | i = surf_usm_h%i(m) |
---|
| 857 | j = surf_usm_h%j(m) |
---|
| 858 | qsws_av(j,i) = qsws_av(j,i) + surf_usm_h%qsws(m) * l_v |
---|
| 859 | ENDDO |
---|
| 860 | ENDIF |
---|
[402] | 861 | |
---|
[1] | 862 | CASE ( 'qv' ) |
---|
[3004] | 863 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
| 864 | DO i = nxlg, nxrg |
---|
| 865 | DO j = nysg, nyng |
---|
| 866 | DO k = nzb, nzt+1 |
---|
| 867 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
| 868 | ENDDO |
---|
[1] | 869 | ENDDO |
---|
| 870 | ENDDO |
---|
[3004] | 871 | ENDIF |
---|
[1] | 872 | |
---|
[2735] | 873 | CASE ( 'r_a*' ) |
---|
[3004] | 874 | IF ( ALLOCATED( r_a_av ) ) THEN |
---|
| 875 | DO m = 1, surf_lsm_h%ns |
---|
| 876 | i = surf_lsm_h%i(m) |
---|
| 877 | j = surf_lsm_h%j(m) |
---|
| 878 | r_a_av(j,i) = r_a_av(j,i) + surf_lsm_h%r_a(m) |
---|
| 879 | ENDDO |
---|
[2735] | 880 | ! |
---|
[3004] | 881 | !-- Please note, resistance is also applied at urban-type surfaces, |
---|
| 882 | !-- and is output only as a single variable. Here, tile approach is |
---|
| 883 | !-- already implemented, so for each surface fraction resistance |
---|
| 884 | !-- need to be summed-up. |
---|
| 885 | DO m = 1, surf_usm_h%ns |
---|
| 886 | i = surf_usm_h%i(m) |
---|
| 887 | j = surf_usm_h%j(m) |
---|
| 888 | r_a_av(j,i) = r_a_av(j,i) + & |
---|
| 889 | ( surf_usm_h%frac(ind_veg_wall,m) * & |
---|
| 890 | surf_usm_h%r_a(m) + & |
---|
| 891 | surf_usm_h%frac(ind_pav_green,m) * & |
---|
| 892 | surf_usm_h%r_a_green(m) + & |
---|
| 893 | surf_usm_h%frac(ind_wat_win,m) * & |
---|
| 894 | surf_usm_h%r_a_window(m) ) |
---|
| 895 | ENDDO |
---|
| 896 | ENDIF |
---|
[2735] | 897 | |
---|
[2031] | 898 | CASE ( 'rho_ocean' ) |
---|
[3004] | 899 | IF ( ALLOCATED( rho_ocean_av ) ) THEN |
---|
| 900 | DO i = nxlg, nxrg |
---|
| 901 | DO j = nysg, nyng |
---|
| 902 | DO k = nzb, nzt+1 |
---|
| 903 | rho_ocean_av(k,j,i) = rho_ocean_av(k,j,i) + rho_ocean(k,j,i) |
---|
| 904 | ENDDO |
---|
[96] | 905 | ENDDO |
---|
| 906 | ENDDO |
---|
[3004] | 907 | ENDIF |
---|
[402] | 908 | |
---|
[1] | 909 | CASE ( 's' ) |
---|
[3004] | 910 | IF ( ALLOCATED( s_av ) ) THEN |
---|
| 911 | DO i = nxlg, nxrg |
---|
| 912 | DO j = nysg, nyng |
---|
| 913 | DO k = nzb, nzt+1 |
---|
| 914 | s_av(k,j,i) = s_av(k,j,i) + s(k,j,i) |
---|
| 915 | ENDDO |
---|
[1] | 916 | ENDDO |
---|
| 917 | ENDDO |
---|
[3004] | 918 | ENDIF |
---|
[402] | 919 | |
---|
[96] | 920 | CASE ( 'sa' ) |
---|
[3004] | 921 | IF ( ALLOCATED( sa_av ) ) THEN |
---|
| 922 | DO i = nxlg, nxrg |
---|
| 923 | DO j = nysg, nyng |
---|
| 924 | DO k = nzb, nzt+1 |
---|
| 925 | sa_av(k,j,i) = sa_av(k,j,i) + sa(k,j,i) |
---|
| 926 | ENDDO |
---|
[96] | 927 | ENDDO |
---|
| 928 | ENDDO |
---|
[3004] | 929 | ENDIF |
---|
[402] | 930 | |
---|
| 931 | CASE ( 'shf*' ) |
---|
[2743] | 932 | ! |
---|
| 933 | !-- In case of default surfaces, clean-up flux by density. |
---|
| 934 | !-- In case of land- and urban-surfaces, convert fluxes into |
---|
| 935 | !-- dynamic units. |
---|
[3004] | 936 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
| 937 | DO m = 1, surf_def_h(0)%ns |
---|
| 938 | i = surf_def_h(0)%i(m) |
---|
| 939 | j = surf_def_h(0)%j(m) |
---|
| 940 | k = surf_def_h(0)%k(m) |
---|
| 941 | shf_av(j,i) = shf_av(j,i) + surf_def_h(0)%shf(m) * & |
---|
| 942 | heatflux_output_conversion(k) |
---|
| 943 | ENDDO |
---|
| 944 | DO m = 1, surf_lsm_h%ns |
---|
| 945 | i = surf_lsm_h%i(m) |
---|
| 946 | j = surf_lsm_h%j(m) |
---|
| 947 | shf_av(j,i) = shf_av(j,i) + surf_lsm_h%shf(m) * cp |
---|
| 948 | ENDDO |
---|
| 949 | DO m = 1, surf_usm_h%ns |
---|
| 950 | i = surf_usm_h%i(m) |
---|
| 951 | j = surf_usm_h%j(m) |
---|
| 952 | shf_av(j,i) = shf_av(j,i) + surf_usm_h%shf(m) * cp |
---|
| 953 | ENDDO |
---|
| 954 | ENDIF |
---|
[402] | 955 | |
---|
[1960] | 956 | CASE ( 'ssws*' ) |
---|
[3004] | 957 | IF ( ALLOCATED( ssws_av ) ) THEN |
---|
| 958 | DO m = 1, surf_def_h(0)%ns |
---|
| 959 | i = surf_def_h(0)%i(m) |
---|
| 960 | j = surf_def_h(0)%j(m) |
---|
| 961 | ssws_av(j,i) = ssws_av(j,i) + surf_def_h(0)%ssws(m) |
---|
| 962 | ENDDO |
---|
| 963 | DO m = 1, surf_lsm_h%ns |
---|
| 964 | i = surf_lsm_h%i(m) |
---|
| 965 | j = surf_lsm_h%j(m) |
---|
| 966 | ssws_av(j,i) = ssws_av(j,i) + surf_lsm_h%ssws(m) |
---|
| 967 | ENDDO |
---|
| 968 | DO m = 1, surf_usm_h%ns |
---|
| 969 | i = surf_usm_h%i(m) |
---|
| 970 | j = surf_usm_h%j(m) |
---|
| 971 | ssws_av(j,i) = ssws_av(j,i) + surf_usm_h%ssws(m) |
---|
| 972 | ENDDO |
---|
| 973 | ENDIF |
---|
[1960] | 974 | |
---|
[1] | 975 | CASE ( 't*' ) |
---|
[3004] | 976 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
| 977 | DO m = 1, surf_def_h(0)%ns |
---|
| 978 | i = surf_def_h(0)%i(m) |
---|
| 979 | j = surf_def_h(0)%j(m) |
---|
| 980 | ts_av(j,i) = ts_av(j,i) + surf_def_h(0)%ts(m) |
---|
| 981 | ENDDO |
---|
| 982 | DO m = 1, surf_lsm_h%ns |
---|
| 983 | i = surf_lsm_h%i(m) |
---|
| 984 | j = surf_lsm_h%j(m) |
---|
| 985 | ts_av(j,i) = ts_av(j,i) + surf_lsm_h%ts(m) |
---|
| 986 | ENDDO |
---|
| 987 | DO m = 1, surf_usm_h%ns |
---|
| 988 | i = surf_usm_h%i(m) |
---|
| 989 | j = surf_usm_h%j(m) |
---|
| 990 | ts_av(j,i) = ts_av(j,i) + surf_usm_h%ts(m) |
---|
| 991 | ENDDO |
---|
| 992 | ENDIF |
---|
[1] | 993 | |
---|
[2742] | 994 | CASE ( 'tsurf*' ) |
---|
[3004] | 995 | IF ( ALLOCATED( tsurf_av ) ) THEN |
---|
| 996 | DO m = 1, surf_def_h(0)%ns |
---|
| 997 | i = surf_def_h(0)%i(m) |
---|
| 998 | j = surf_def_h(0)%j(m) |
---|
| 999 | tsurf_av(j,i) = tsurf_av(j,i) + surf_def_h(0)%pt_surface(m) |
---|
| 1000 | ENDDO |
---|
[2798] | 1001 | |
---|
[3004] | 1002 | DO m = 1, surf_lsm_h%ns |
---|
| 1003 | i = surf_lsm_h%i(m) |
---|
| 1004 | j = surf_lsm_h%j(m) |
---|
| 1005 | tsurf_av(j,i) = tsurf_av(j,i) + surf_lsm_h%pt_surface(m) |
---|
| 1006 | ENDDO |
---|
[2742] | 1007 | |
---|
[3004] | 1008 | DO m = 1, surf_usm_h%ns |
---|
| 1009 | i = surf_usm_h%i(m) |
---|
| 1010 | j = surf_usm_h%j(m) |
---|
| 1011 | tsurf_av(j,i) = tsurf_av(j,i) + surf_usm_h%pt_surface(m) |
---|
| 1012 | ENDDO |
---|
| 1013 | ENDIF |
---|
[2742] | 1014 | |
---|
[1] | 1015 | CASE ( 'u' ) |
---|
[3004] | 1016 | IF ( ALLOCATED( u_av ) ) THEN |
---|
| 1017 | DO i = nxlg, nxrg |
---|
| 1018 | DO j = nysg, nyng |
---|
| 1019 | DO k = nzb, nzt+1 |
---|
| 1020 | u_av(k,j,i) = u_av(k,j,i) + u(k,j,i) |
---|
| 1021 | ENDDO |
---|
[1] | 1022 | ENDDO |
---|
| 1023 | ENDDO |
---|
[3004] | 1024 | ENDIF |
---|
[1] | 1025 | |
---|
| 1026 | CASE ( 'u*' ) |
---|
[3004] | 1027 | IF ( ALLOCATED( us_av ) ) THEN |
---|
| 1028 | DO m = 1, surf_def_h(0)%ns |
---|
| 1029 | i = surf_def_h(0)%i(m) |
---|
| 1030 | j = surf_def_h(0)%j(m) |
---|
| 1031 | us_av(j,i) = us_av(j,i) + surf_def_h(0)%us(m) |
---|
| 1032 | ENDDO |
---|
| 1033 | DO m = 1, surf_lsm_h%ns |
---|
| 1034 | i = surf_lsm_h%i(m) |
---|
| 1035 | j = surf_lsm_h%j(m) |
---|
| 1036 | us_av(j,i) = us_av(j,i) + surf_lsm_h%us(m) |
---|
| 1037 | ENDDO |
---|
| 1038 | DO m = 1, surf_usm_h%ns |
---|
| 1039 | i = surf_usm_h%i(m) |
---|
| 1040 | j = surf_usm_h%j(m) |
---|
| 1041 | us_av(j,i) = us_av(j,i) + surf_usm_h%us(m) |
---|
| 1042 | ENDDO |
---|
| 1043 | ENDIF |
---|
[1] | 1044 | |
---|
| 1045 | CASE ( 'v' ) |
---|
[3004] | 1046 | IF ( ALLOCATED( v_av ) ) THEN |
---|
| 1047 | DO i = nxlg, nxrg |
---|
| 1048 | DO j = nysg, nyng |
---|
| 1049 | DO k = nzb, nzt+1 |
---|
| 1050 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
| 1051 | ENDDO |
---|
[1] | 1052 | ENDDO |
---|
| 1053 | ENDDO |
---|
[3004] | 1054 | ENDIF |
---|
[1] | 1055 | |
---|
| 1056 | CASE ( 'vpt' ) |
---|
[3004] | 1057 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
| 1058 | DO i = nxlg, nxrg |
---|
| 1059 | DO j = nysg, nyng |
---|
| 1060 | DO k = nzb, nzt+1 |
---|
| 1061 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
| 1062 | ENDDO |
---|
[1] | 1063 | ENDDO |
---|
| 1064 | ENDDO |
---|
[3004] | 1065 | ENDIF |
---|
[1] | 1066 | |
---|
| 1067 | CASE ( 'w' ) |
---|
[3004] | 1068 | IF ( ALLOCATED( w_av ) ) THEN |
---|
| 1069 | DO i = nxlg, nxrg |
---|
| 1070 | DO j = nysg, nyng |
---|
| 1071 | DO k = nzb, nzt+1 |
---|
| 1072 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
| 1073 | ENDDO |
---|
[1] | 1074 | ENDDO |
---|
| 1075 | ENDDO |
---|
[3004] | 1076 | ENDIF |
---|
[1] | 1077 | |
---|
[72] | 1078 | CASE ( 'z0*' ) |
---|
[3004] | 1079 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
| 1080 | DO m = 1, surf_def_h(0)%ns |
---|
| 1081 | i = surf_def_h(0)%i(m) |
---|
| 1082 | j = surf_def_h(0)%j(m) |
---|
| 1083 | z0_av(j,i) = z0_av(j,i) + surf_def_h(0)%z0(m) |
---|
| 1084 | ENDDO |
---|
| 1085 | DO m = 1, surf_lsm_h%ns |
---|
| 1086 | i = surf_lsm_h%i(m) |
---|
| 1087 | j = surf_lsm_h%j(m) |
---|
| 1088 | z0_av(j,i) = z0_av(j,i) + surf_lsm_h%z0(m) |
---|
| 1089 | ENDDO |
---|
| 1090 | DO m = 1, surf_usm_h%ns |
---|
| 1091 | i = surf_usm_h%i(m) |
---|
| 1092 | j = surf_usm_h%j(m) |
---|
| 1093 | z0_av(j,i) = z0_av(j,i) + surf_usm_h%z0(m) |
---|
| 1094 | ENDDO |
---|
| 1095 | ENDIF |
---|
[72] | 1096 | |
---|
[978] | 1097 | CASE ( 'z0h*' ) |
---|
[3004] | 1098 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
| 1099 | DO m = 1, surf_def_h(0)%ns |
---|
| 1100 | i = surf_def_h(0)%i(m) |
---|
| 1101 | j = surf_def_h(0)%j(m) |
---|
| 1102 | z0h_av(j,i) = z0h_av(j,i) + surf_def_h(0)%z0h(m) |
---|
| 1103 | ENDDO |
---|
| 1104 | DO m = 1, surf_lsm_h%ns |
---|
| 1105 | i = surf_lsm_h%i(m) |
---|
| 1106 | j = surf_lsm_h%j(m) |
---|
| 1107 | z0h_av(j,i) = z0h_av(j,i) + surf_lsm_h%z0h(m) |
---|
| 1108 | ENDDO |
---|
| 1109 | DO m = 1, surf_usm_h%ns |
---|
| 1110 | i = surf_usm_h%i(m) |
---|
| 1111 | j = surf_usm_h%j(m) |
---|
| 1112 | z0h_av(j,i) = z0h_av(j,i) + surf_usm_h%z0h(m) |
---|
| 1113 | ENDDO |
---|
| 1114 | ENDIF |
---|
| 1115 | |
---|
[1788] | 1116 | CASE ( 'z0q*' ) |
---|
[3004] | 1117 | IF ( ALLOCATED( z0q_av ) ) THEN |
---|
| 1118 | DO m = 1, surf_def_h(0)%ns |
---|
| 1119 | i = surf_def_h(0)%i(m) |
---|
| 1120 | j = surf_def_h(0)%j(m) |
---|
| 1121 | z0q_av(j,i) = z0q_av(j,i) + surf_def_h(0)%z0q(m) |
---|
| 1122 | ENDDO |
---|
| 1123 | DO m = 1, surf_lsm_h%ns |
---|
| 1124 | i = surf_lsm_h%i(m) |
---|
| 1125 | j = surf_lsm_h%j(m) |
---|
| 1126 | z0q_av(j,i) = z0q_av(j,i) + surf_lsm_h%z0q(m) |
---|
| 1127 | ENDDO |
---|
| 1128 | DO m = 1, surf_usm_h%ns |
---|
| 1129 | i = surf_usm_h%i(m) |
---|
| 1130 | j = surf_usm_h%j(m) |
---|
| 1131 | z0q_av(j,i) = z0q_av(j,i) + surf_usm_h%z0q(m) |
---|
| 1132 | ENDDO |
---|
| 1133 | ENDIF |
---|
[2007] | 1134 | ! |
---|
[2696] | 1135 | !-- Block of urban surface model outputs. |
---|
| 1136 | !-- In case of urban surface variables it should be always checked |
---|
| 1137 | !-- if respective arrays are allocated, at least in case of a restart |
---|
[3004] | 1138 | !-- run, as averaged usm arrays are not read from file at the moment. |
---|
[2007] | 1139 | CASE ( 'usm_output' ) |
---|
[2696] | 1140 | CALL usm_average_3d_data( 'allocate', doav(ii) ) |
---|
[2007] | 1141 | CALL usm_average_3d_data( 'sum', doav(ii) ) |
---|
[1788] | 1142 | |
---|
[1] | 1143 | CASE DEFAULT |
---|
| 1144 | ! |
---|
[2696] | 1145 | !-- Turbulence closure module |
---|
| 1146 | CALL tcm_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 1147 | |
---|
| 1148 | ! |
---|
[1972] | 1149 | !-- Land surface quantity |
---|
| 1150 | IF ( land_surface ) THEN |
---|
| 1151 | CALL lsm_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 1152 | ENDIF |
---|
| 1153 | |
---|
| 1154 | ! |
---|
[1976] | 1155 | !-- Radiation quantity |
---|
| 1156 | IF ( radiation ) THEN |
---|
| 1157 | CALL radiation_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 1158 | ENDIF |
---|
| 1159 | |
---|
| 1160 | ! |
---|
[2817] | 1161 | !-- Gust module quantities |
---|
| 1162 | IF ( gust_module_enabled ) THEN |
---|
| 1163 | CALL gust_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 1164 | ENDIF |
---|
| 1165 | |
---|
| 1166 | ! |
---|
[2696] | 1167 | !-- Chemical quantity |
---|
| 1168 | IF ( air_chemistry .AND. trimvar(1:3) == 'kc_') THEN |
---|
| 1169 | CALL chem_3d_data_averaging( 'sum',doav(ii) ) |
---|
| 1170 | ENDIF |
---|
| 1171 | |
---|
| 1172 | ! |
---|
| 1173 | !-- UV exposure quantity |
---|
| 1174 | IF ( uv_exposure ) THEN |
---|
| 1175 | CALL uvem_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 1176 | ENDIF |
---|
| 1177 | |
---|
| 1178 | ! |
---|
[1] | 1179 | !-- User-defined quantity |
---|
| 1180 | CALL user_3d_data_averaging( 'sum', doav(ii) ) |
---|
| 1181 | |
---|
| 1182 | END SELECT |
---|
| 1183 | |
---|
| 1184 | ENDDO |
---|
| 1185 | |
---|
[1318] | 1186 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
[1] | 1187 | |
---|
| 1188 | |
---|
| 1189 | END SUBROUTINE sum_up_3d_data |
---|