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