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