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