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