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