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