[1682] | 1 | !> @file sum_up_3d_data.f90 |
---|
[4591] | 2 | !--------------------------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[4591] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General |
---|
| 6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
| 7 | ! (at your option) any later version. |
---|
[1036] | 8 | ! |
---|
[4591] | 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
| 10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
| 11 | ! Public License for more details. |
---|
[1036] | 12 | ! |
---|
[4591] | 13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
| 14 | ! <http://www.gnu.org/licenses/>. |
---|
[1036] | 15 | ! |
---|
[4828] | 16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
[4591] | 17 | !--------------------------------------------------------------------------------------------------! |
---|
[1036] | 18 | ! |
---|
[4591] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[4591] | 21 | ! ----------------- |
---|
| 22 | ! |
---|
| 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: sum_up_3d_data.f90 4828 2021-01-05 11:21:41Z moh.hefny $ |
---|
[4671] | 27 | ! Implementation of downward facing USM and LSM surfaces |
---|
| 28 | ! |
---|
| 29 | ! 4591 2020-07-06 15:56:08Z raasch |
---|
[4591] | 30 | ! File re-formatted to follow the PALM coding standard |
---|
| 31 | ! |
---|
| 32 | ! 4516 2020-04-30 16:55:10Z suehring |
---|
| 33 | ! Remove double index |
---|
| 34 | ! |
---|
[4516] | 35 | ! 4514 2020-04-30 16:29:59Z suehring |
---|
[4514] | 36 | ! Enable output of qsurf and ssurf |
---|
[4591] | 37 | ! |
---|
[4514] | 38 | ! 4442 2020-03-04 19:21:13Z suehring |
---|
[4591] | 39 | ! Change order of dimension in surface array %frac to allow for better vectorization. |
---|
| 40 | ! |
---|
[4442] | 41 | ! 4441 2020-03-04 19:20:35Z suehring |
---|
[4331] | 42 | ! Move 2-m potential temperature output to diagnostic_output_quantities |
---|
[4591] | 43 | ! |
---|
[4331] | 44 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
[4182] | 45 | ! Corrected "Former revisions" section |
---|
[4591] | 46 | ! |
---|
[4182] | 47 | ! 4048 2019-06-21 21:00:21Z knoop |
---|
[4048] | 48 | ! Moved tcm_3d_data_averaging to module_interface |
---|
[4591] | 49 | ! |
---|
[4048] | 50 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
[4039] | 51 | ! Modularize diagnostic output |
---|
[4591] | 52 | ! |
---|
[4039] | 53 | ! 3994 2019-05-22 18:08:09Z suehring |
---|
[4591] | 54 | ! Output of turbulence intensity added |
---|
| 55 | ! |
---|
[3994] | 56 | ! 3943 2019-05-02 09:50:41Z maronga |
---|
[3943] | 57 | ! Added output of qsws_av for green roofs. |
---|
[4591] | 58 | ! |
---|
[3943] | 59 | ! 3933 2019-04-25 12:33:20Z kanani |
---|
[3933] | 60 | ! Formatting |
---|
[4591] | 61 | ! |
---|
[3933] | 62 | ! 3773 2019-03-01 08:56:57Z maronga |
---|
[3773] | 63 | ! Added output of theta_2m*_xy_av |
---|
[4591] | 64 | ! |
---|
[3773] | 65 | ! 3761 2019-02-25 15:31:42Z raasch |
---|
[3761] | 66 | ! unused variables removed |
---|
[4591] | 67 | ! |
---|
[3761] | 68 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3637] | 69 | ! Implementation of the PALM module interface |
---|
[3582] | 70 | ! |
---|
[4182] | 71 | ! Revision 1.1 2006/02/23 12:55:23 raasch |
---|
| 72 | ! Initial revision |
---|
| 73 | ! |
---|
| 74 | ! |
---|
[1] | 75 | ! Description: |
---|
| 76 | ! ------------ |
---|
[4591] | 77 | !> Sum-up the values of 3d-arrays. The real averaging is later done in routine average_3d_data. |
---|
| 78 | !--------------------------------------------------------------------------------------------------! |
---|
[1682] | 79 | SUBROUTINE sum_up_3d_data |
---|
[1] | 80 | |
---|
[4591] | 81 | |
---|
| 82 | USE arrays_3d, & |
---|
| 83 | ONLY: dzw, & |
---|
| 84 | d_exner, & |
---|
| 85 | e, & |
---|
| 86 | heatflux_output_conversion, & |
---|
| 87 | p, & |
---|
| 88 | pt, & |
---|
| 89 | q, & |
---|
| 90 | ql, & |
---|
| 91 | ql_c, & |
---|
| 92 | ql_v, & |
---|
| 93 | s, & |
---|
| 94 | u, & |
---|
| 95 | v, & |
---|
| 96 | vpt, & |
---|
| 97 | w, & |
---|
[3294] | 98 | waterflux_output_conversion |
---|
[1] | 99 | |
---|
[4591] | 100 | USE averaging, & |
---|
| 101 | ONLY: e_av, & |
---|
| 102 | ghf_av, & |
---|
| 103 | lpt_av, & |
---|
| 104 | lwp_av, & |
---|
| 105 | ol_av, & |
---|
| 106 | p_av, & |
---|
| 107 | pc_av, & |
---|
| 108 | pr_av, & |
---|
| 109 | pt_av, & |
---|
| 110 | q_av, & |
---|
| 111 | ql_av, & |
---|
| 112 | ql_c_av, & |
---|
| 113 | ql_v_av, & |
---|
| 114 | ql_vp_av, & |
---|
| 115 | qsurf_av, & |
---|
| 116 | qsws_av, & |
---|
| 117 | qv_av, & |
---|
| 118 | r_a_av, & |
---|
| 119 | s_av, & |
---|
| 120 | shf_av, & |
---|
| 121 | ssurf_av, & |
---|
| 122 | ssws_av, & |
---|
| 123 | ts_av, & |
---|
| 124 | tsurf_av, & |
---|
| 125 | u_av, & |
---|
| 126 | us_av, & |
---|
| 127 | v_av, & |
---|
| 128 | vpt_av, & |
---|
| 129 | w_av, & |
---|
| 130 | z0_av, & |
---|
| 131 | z0h_av, & |
---|
| 132 | z0q_av |
---|
[3241] | 133 | |
---|
[4591] | 134 | USE basic_constants_and_equations_mod, & |
---|
| 135 | ONLY: c_p, & |
---|
| 136 | lv_d_cp, & |
---|
| 137 | l_v |
---|
[3274] | 138 | |
---|
[4591] | 139 | USE bulk_cloud_model_mod, & |
---|
[3637] | 140 | ONLY: bulk_cloud_model |
---|
[3274] | 141 | |
---|
[4591] | 142 | USE control_parameters, & |
---|
| 143 | ONLY: average_count_3d, & |
---|
| 144 | doav, & |
---|
| 145 | doav_n, & |
---|
| 146 | rho_surface, & |
---|
| 147 | urban_surface, & |
---|
[3569] | 148 | varnamelength |
---|
[1320] | 149 | |
---|
[4591] | 150 | USE cpulog, & |
---|
| 151 | ONLY: cpu_log, & |
---|
| 152 | log_point |
---|
[1320] | 153 | |
---|
[4591] | 154 | USE indices, & |
---|
| 155 | ONLY: nxl, & |
---|
| 156 | nxlg, & |
---|
| 157 | nxr, & |
---|
| 158 | nxrg, & |
---|
| 159 | nyn, & |
---|
| 160 | nyng, & |
---|
| 161 | nys, & |
---|
| 162 | nysg, & |
---|
| 163 | nzb, & |
---|
| 164 | nzt, & |
---|
[4514] | 165 | topo_top_ind |
---|
[1320] | 166 | |
---|
| 167 | USE kinds |
---|
| 168 | |
---|
[4591] | 169 | USE module_interface, & |
---|
[3637] | 170 | ONLY: module_interface_3d_data_averaging |
---|
[1551] | 171 | |
---|
[4591] | 172 | USE particle_attributes, & |
---|
| 173 | ONLY: grid_particles, & |
---|
| 174 | number_of_particles, & |
---|
| 175 | particles, & |
---|
| 176 | prt_count |
---|
[1320] | 177 | |
---|
[4591] | 178 | USE surface_mod, & |
---|
| 179 | ONLY: ind_pav_green, & |
---|
| 180 | ind_veg_wall, & |
---|
| 181 | ind_wat_win, & |
---|
| 182 | surf_def_h, & |
---|
| 183 | surf_lsm_h, & |
---|
| 184 | surf_usm_h |
---|
[2232] | 185 | |
---|
[4591] | 186 | USE urban_surface_mod, & |
---|
[3637] | 187 | ONLY: usm_3d_data_averaging |
---|
[1691] | 188 | |
---|
[2007] | 189 | |
---|
[1] | 190 | IMPLICIT NONE |
---|
| 191 | |
---|
[4591] | 192 | CHARACTER(LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
| 193 | |
---|
[2232] | 194 | INTEGER(iwp) :: i !< grid index x direction |
---|
[2007] | 195 | INTEGER(iwp) :: ii !< running index |
---|
[2232] | 196 | INTEGER(iwp) :: j !< grid index y direction |
---|
| 197 | INTEGER(iwp) :: k !< grid index x direction |
---|
[3552] | 198 | INTEGER(iwp) :: m !< running index over surfacle elements |
---|
| 199 | INTEGER(iwp) :: n !< running index over number of particles per grid box |
---|
[1] | 200 | |
---|
[4591] | 201 | LOGICAL :: match_def !< flag indicating default-type surface |
---|
| 202 | LOGICAL :: match_lsm !< flag indicating natural-type surface |
---|
| 203 | LOGICAL :: match_usm !< flag indicating urban-type surface |
---|
[1] | 204 | |
---|
[4591] | 205 | REAL(wp) :: mean_r !< mean-particle radius witin grid box |
---|
| 206 | REAL(wp) :: s_r2 !< mean-particle radius witin grid box to the power of two |
---|
| 207 | REAL(wp) :: s_r3 !< mean-particle radius witin grid box to the power of three |
---|
[2007] | 208 | |
---|
| 209 | |
---|
[4591] | 210 | |
---|
[1] | 211 | CALL cpu_log (log_point(34),'sum_up_3d_data','start') |
---|
| 212 | |
---|
| 213 | ! |
---|
[4591] | 214 | !-- Allocate and initialize the summation arrays if called for the very first time or the first time |
---|
| 215 | !-- after average_3d_data has been called (some or all of the arrays may have been already allocated |
---|
[2894] | 216 | !-- in rrd_local) |
---|
[1] | 217 | IF ( average_count_3d == 0 ) THEN |
---|
| 218 | |
---|
| 219 | DO ii = 1, doav_n |
---|
[3337] | 220 | |
---|
[2007] | 221 | trimvar = TRIM( doav(ii) ) |
---|
[3337] | 222 | |
---|
[2007] | 223 | SELECT CASE ( trimvar ) |
---|
[1] | 224 | |
---|
[2797] | 225 | CASE ( 'ghf*' ) |
---|
| 226 | IF ( .NOT. ALLOCATED( ghf_av ) ) THEN |
---|
| 227 | ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 228 | ENDIF |
---|
| 229 | ghf_av = 0.0_wp |
---|
| 230 | |
---|
[1] | 231 | CASE ( 'e' ) |
---|
| 232 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
[667] | 233 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 234 | ENDIF |
---|
[1353] | 235 | e_av = 0.0_wp |
---|
[1] | 236 | |
---|
[3421] | 237 | CASE ( 'thetal' ) |
---|
[771] | 238 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
| 239 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 240 | ENDIF |
---|
[1353] | 241 | lpt_av = 0.0_wp |
---|
[771] | 242 | |
---|
[1] | 243 | CASE ( 'lwp*' ) |
---|
| 244 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
[667] | 245 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 246 | ENDIF |
---|
[1353] | 247 | lwp_av = 0.0_wp |
---|
[1] | 248 | |
---|
[1691] | 249 | CASE ( 'ol*' ) |
---|
| 250 | IF ( .NOT. ALLOCATED( ol_av ) ) THEN |
---|
| 251 | ALLOCATE( ol_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 252 | ENDIF |
---|
| 253 | ol_av = 0.0_wp |
---|
| 254 | |
---|
[1] | 255 | CASE ( 'p' ) |
---|
| 256 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
[667] | 257 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 258 | ENDIF |
---|
[1353] | 259 | p_av = 0.0_wp |
---|
[1] | 260 | |
---|
| 261 | CASE ( 'pc' ) |
---|
| 262 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
[667] | 263 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 264 | ENDIF |
---|
[1353] | 265 | pc_av = 0.0_wp |
---|
[1] | 266 | |
---|
| 267 | CASE ( 'pr' ) |
---|
| 268 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
[667] | 269 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 270 | ENDIF |
---|
[1353] | 271 | pr_av = 0.0_wp |
---|
[1] | 272 | |
---|
[3421] | 273 | CASE ( 'theta' ) |
---|
[1] | 274 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
[667] | 275 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 276 | ENDIF |
---|
[1353] | 277 | pt_av = 0.0_wp |
---|
[1] | 278 | |
---|
| 279 | CASE ( 'q' ) |
---|
| 280 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
[667] | 281 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 282 | ENDIF |
---|
[1353] | 283 | q_av = 0.0_wp |
---|
[1] | 284 | |
---|
| 285 | CASE ( 'ql' ) |
---|
| 286 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
[667] | 287 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 288 | ENDIF |
---|
[1353] | 289 | ql_av = 0.0_wp |
---|
[1] | 290 | |
---|
| 291 | CASE ( 'ql_c' ) |
---|
| 292 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
[667] | 293 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 294 | ENDIF |
---|
[1353] | 295 | ql_c_av = 0.0_wp |
---|
[1] | 296 | |
---|
| 297 | CASE ( 'ql_v' ) |
---|
| 298 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
[667] | 299 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 300 | ENDIF |
---|
[1353] | 301 | ql_v_av = 0.0_wp |
---|
[1] | 302 | |
---|
| 303 | CASE ( 'ql_vp' ) |
---|
| 304 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
[667] | 305 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 306 | ENDIF |
---|
[1353] | 307 | ql_vp_av = 0.0_wp |
---|
[1] | 308 | |
---|
[4514] | 309 | CASE ( 'qsurf*' ) |
---|
| 310 | IF ( .NOT. ALLOCATED( qsurf_av ) ) THEN |
---|
| 311 | ALLOCATE( qsurf_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 312 | ENDIF |
---|
| 313 | qsurf_av = 0.0_wp |
---|
| 314 | |
---|
[354] | 315 | CASE ( 'qsws*' ) |
---|
| 316 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
[667] | 317 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
[354] | 318 | ENDIF |
---|
[1353] | 319 | qsws_av = 0.0_wp |
---|
[354] | 320 | |
---|
[1] | 321 | CASE ( 'qv' ) |
---|
| 322 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
[667] | 323 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 324 | ENDIF |
---|
[1353] | 325 | qv_av = 0.0_wp |
---|
[1] | 326 | |
---|
[2735] | 327 | CASE ( 'r_a*' ) |
---|
| 328 | IF ( .NOT. ALLOCATED( r_a_av ) ) THEN |
---|
| 329 | ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 330 | ENDIF |
---|
| 331 | r_a_av = 0.0_wp |
---|
| 332 | |
---|
[1] | 333 | CASE ( 's' ) |
---|
| 334 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
[667] | 335 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 336 | ENDIF |
---|
[1353] | 337 | s_av = 0.0_wp |
---|
[1] | 338 | |
---|
[354] | 339 | CASE ( 'shf*' ) |
---|
| 340 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
[667] | 341 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
[354] | 342 | ENDIF |
---|
[1353] | 343 | shf_av = 0.0_wp |
---|
[4514] | 344 | |
---|
| 345 | CASE ( 'ssurf*' ) |
---|
| 346 | IF ( .NOT. ALLOCATED( ssurf_av ) ) THEN |
---|
| 347 | ALLOCATE( ssurf_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 348 | ENDIF |
---|
| 349 | ssurf_av = 0.0_wp |
---|
| 350 | |
---|
[2024] | 351 | CASE ( 'ssws*' ) |
---|
| 352 | IF ( .NOT. ALLOCATED( ssws_av ) ) THEN |
---|
| 353 | ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 354 | ENDIF |
---|
[4591] | 355 | ssws_av = 0.0_wp |
---|
[354] | 356 | |
---|
[1] | 357 | CASE ( 't*' ) |
---|
| 358 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
[667] | 359 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 360 | ENDIF |
---|
[1353] | 361 | ts_av = 0.0_wp |
---|
[1] | 362 | |
---|
[2742] | 363 | CASE ( 'tsurf*' ) |
---|
| 364 | IF ( .NOT. ALLOCATED( tsurf_av ) ) THEN |
---|
| 365 | ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 366 | ENDIF |
---|
| 367 | tsurf_av = 0.0_wp |
---|
| 368 | |
---|
[1] | 369 | CASE ( 'u' ) |
---|
| 370 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
[667] | 371 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 372 | ENDIF |
---|
[1353] | 373 | u_av = 0.0_wp |
---|
[1] | 374 | |
---|
[3421] | 375 | CASE ( 'us*' ) |
---|
[1] | 376 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
[667] | 377 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 378 | ENDIF |
---|
[1353] | 379 | us_av = 0.0_wp |
---|
[1] | 380 | |
---|
| 381 | CASE ( 'v' ) |
---|
| 382 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
[667] | 383 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 384 | ENDIF |
---|
[1353] | 385 | v_av = 0.0_wp |
---|
[1] | 386 | |
---|
[3421] | 387 | CASE ( 'thetav' ) |
---|
[1] | 388 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
[667] | 389 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 390 | ENDIF |
---|
[1353] | 391 | vpt_av = 0.0_wp |
---|
[1] | 392 | |
---|
| 393 | CASE ( 'w' ) |
---|
| 394 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
[667] | 395 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1] | 396 | ENDIF |
---|
[1353] | 397 | w_av = 0.0_wp |
---|
[1] | 398 | |
---|
[72] | 399 | CASE ( 'z0*' ) |
---|
| 400 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
[667] | 401 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
[72] | 402 | ENDIF |
---|
[1353] | 403 | z0_av = 0.0_wp |
---|
[72] | 404 | |
---|
[978] | 405 | CASE ( 'z0h*' ) |
---|
| 406 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
| 407 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 408 | ENDIF |
---|
[1353] | 409 | z0h_av = 0.0_wp |
---|
[978] | 410 | |
---|
[1788] | 411 | CASE ( 'z0q*' ) |
---|
| 412 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
| 413 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 414 | ENDIF |
---|
| 415 | z0q_av = 0.0_wp |
---|
[3294] | 416 | |
---|
[2007] | 417 | |
---|
[1] | 418 | CASE DEFAULT |
---|
[1972] | 419 | |
---|
[1] | 420 | ! |
---|
[3637] | 421 | !-- Allocating and initializing data arrays for all other modules |
---|
| 422 | CALL module_interface_3d_data_averaging( 'allocate', trimvar ) |
---|
[3337] | 423 | |
---|
[3274] | 424 | |
---|
[1] | 425 | END SELECT |
---|
| 426 | |
---|
| 427 | ENDDO |
---|
| 428 | |
---|
| 429 | ENDIF |
---|
| 430 | |
---|
| 431 | ! |
---|
| 432 | !-- Loop of all variables to be averaged. |
---|
| 433 | DO ii = 1, doav_n |
---|
[3337] | 434 | |
---|
| 435 | trimvar = TRIM( doav(ii) ) |
---|
[1] | 436 | ! |
---|
| 437 | !-- Store the array chosen on the temporary array. |
---|
[2007] | 438 | SELECT CASE ( trimvar ) |
---|
[1] | 439 | |
---|
[2797] | 440 | CASE ( 'ghf*' ) |
---|
[3004] | 441 | IF ( ALLOCATED( ghf_av ) ) THEN |
---|
[3170] | 442 | DO i = nxl, nxr |
---|
| 443 | DO j = nys, nyn |
---|
| 444 | ! |
---|
[4591] | 445 | !-- Check whether grid point is a natural- or urban-type surface. |
---|
[4671] | 446 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 447 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 448 | ! |
---|
[4591] | 449 | !-- In order to avoid double-counting of surface properties, always assume that |
---|
| 450 | !-- natural-type surfaces are below urban type surfaces, e.g. in case of bridges. |
---|
| 451 | !-- Further, take only the last suface element, i.e. the uppermost surface which |
---|
| 452 | !-- would be visible from above |
---|
[3170] | 453 | IF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 454 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 455 | ghf_av(j,i) = ghf_av(j,i) + surf_lsm_h(0)%ghf(m) |
---|
[3170] | 456 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 457 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 458 | ghf_av(j,i) = ghf_av(j,i) + surf_usm_h(0)%frac(m,ind_veg_wall) * & |
---|
| 459 | surf_usm_h(0)%wghf_eb(m) + & |
---|
| 460 | surf_usm_h(0)%frac(m,ind_pav_green) * & |
---|
| 461 | surf_usm_h(0)%wghf_eb_green(m) + & |
---|
| 462 | surf_usm_h(0)%frac(m,ind_wat_win) * & |
---|
| 463 | surf_usm_h(0)%wghf_eb_window(m) |
---|
[3170] | 464 | ENDIF |
---|
| 465 | ENDDO |
---|
[3004] | 466 | ENDDO |
---|
| 467 | ENDIF |
---|
[2797] | 468 | |
---|
[1] | 469 | CASE ( 'e' ) |
---|
[3004] | 470 | IF ( ALLOCATED( e_av ) ) THEN |
---|
| 471 | DO i = nxlg, nxrg |
---|
| 472 | DO j = nysg, nyng |
---|
| 473 | DO k = nzb, nzt+1 |
---|
| 474 | e_av(k,j,i) = e_av(k,j,i) + e(k,j,i) |
---|
| 475 | ENDDO |
---|
[1] | 476 | ENDDO |
---|
| 477 | ENDDO |
---|
[3004] | 478 | ENDIF |
---|
[1] | 479 | |
---|
[3421] | 480 | CASE ( 'thetal' ) |
---|
[3004] | 481 | IF ( ALLOCATED( lpt_av ) ) THEN |
---|
| 482 | DO i = nxlg, nxrg |
---|
| 483 | DO j = nysg, nyng |
---|
| 484 | DO k = nzb, nzt+1 |
---|
| 485 | lpt_av(k,j,i) = lpt_av(k,j,i) + pt(k,j,i) |
---|
| 486 | ENDDO |
---|
[771] | 487 | ENDDO |
---|
| 488 | ENDDO |
---|
[3004] | 489 | ENDIF |
---|
[771] | 490 | |
---|
[1] | 491 | CASE ( 'lwp*' ) |
---|
[3004] | 492 | IF ( ALLOCATED( lwp_av ) ) THEN |
---|
| 493 | DO i = nxlg, nxrg |
---|
| 494 | DO j = nysg, nyng |
---|
[4591] | 495 | lwp_av(j,i) = lwp_av(j,i) + SUM( ql(nzb:nzt,j,i) * dzw(1:nzt+1) ) & |
---|
| 496 | * rho_surface |
---|
[3004] | 497 | ENDDO |
---|
[1] | 498 | ENDDO |
---|
[3004] | 499 | ENDIF |
---|
[1] | 500 | |
---|
[1691] | 501 | CASE ( 'ol*' ) |
---|
[3004] | 502 | IF ( ALLOCATED( ol_av ) ) THEN |
---|
[3170] | 503 | DO i = nxl, nxr |
---|
| 504 | DO j = nys, nyn |
---|
[4591] | 505 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 506 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 507 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 508 | |
---|
| 509 | IF ( match_def ) THEN |
---|
| 510 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 511 | ol_av(j,i) = ol_av(j,i) + surf_def_h(0)%ol(m) |
---|
[3170] | 512 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 513 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 514 | ol_av(j,i) = ol_av(j,i) + surf_lsm_h(0)%ol(m) |
---|
[3170] | 515 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 516 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 517 | ol_av(j,i) = ol_av(j,i) + surf_usm_h(0)%ol(m) |
---|
[3170] | 518 | ENDIF |
---|
| 519 | ENDDO |
---|
[3004] | 520 | ENDDO |
---|
| 521 | ENDIF |
---|
[1691] | 522 | |
---|
[1] | 523 | CASE ( 'p' ) |
---|
[3004] | 524 | IF ( ALLOCATED( p_av ) ) THEN |
---|
| 525 | DO i = nxlg, nxrg |
---|
| 526 | DO j = nysg, nyng |
---|
| 527 | DO k = nzb, nzt+1 |
---|
| 528 | p_av(k,j,i) = p_av(k,j,i) + p(k,j,i) |
---|
| 529 | ENDDO |
---|
[1] | 530 | ENDDO |
---|
| 531 | ENDDO |
---|
[3004] | 532 | ENDIF |
---|
[1] | 533 | |
---|
| 534 | CASE ( 'pc' ) |
---|
[3004] | 535 | IF ( ALLOCATED( pc_av ) ) THEN |
---|
| 536 | DO i = nxl, nxr |
---|
| 537 | DO j = nys, nyn |
---|
| 538 | DO k = nzb, nzt+1 |
---|
| 539 | pc_av(k,j,i) = pc_av(k,j,i) + prt_count(k,j,i) |
---|
| 540 | ENDDO |
---|
[1] | 541 | ENDDO |
---|
| 542 | ENDDO |
---|
[3004] | 543 | ENDIF |
---|
[1] | 544 | |
---|
| 545 | CASE ( 'pr' ) |
---|
[3004] | 546 | IF ( ALLOCATED( pr_av ) ) THEN |
---|
| 547 | DO i = nxl, nxr |
---|
| 548 | DO j = nys, nyn |
---|
| 549 | DO k = nzb, nzt+1 |
---|
| 550 | number_of_particles = prt_count(k,j,i) |
---|
| 551 | IF ( number_of_particles <= 0 ) CYCLE |
---|
[4591] | 552 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
[3004] | 553 | s_r2 = 0.0_wp |
---|
| 554 | s_r3 = 0.0_wp |
---|
[1359] | 555 | |
---|
[3004] | 556 | DO n = 1, number_of_particles |
---|
| 557 | IF ( particles(n)%particle_mask ) THEN |
---|
[4591] | 558 | s_r2 = s_r2 + particles(n)%radius**2 * particles(n)%weight_factor |
---|
| 559 | s_r3 = s_r3 + particles(n)%radius**3 * particles(n)%weight_factor |
---|
[3004] | 560 | ENDIF |
---|
| 561 | ENDDO |
---|
| 562 | |
---|
| 563 | IF ( s_r2 > 0.0_wp ) THEN |
---|
| 564 | mean_r = s_r3 / s_r2 |
---|
| 565 | ELSE |
---|
| 566 | mean_r = 0.0_wp |
---|
[1359] | 567 | ENDIF |
---|
[3004] | 568 | pr_av(k,j,i) = pr_av(k,j,i) + mean_r |
---|
[1] | 569 | ENDDO |
---|
| 570 | ENDDO |
---|
| 571 | ENDDO |
---|
[3004] | 572 | ENDIF |
---|
[1] | 573 | |
---|
[3421] | 574 | CASE ( 'theta' ) |
---|
[3004] | 575 | IF ( ALLOCATED( pt_av ) ) THEN |
---|
[3274] | 576 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
[3004] | 577 | DO i = nxlg, nxrg |
---|
| 578 | DO j = nysg, nyng |
---|
| 579 | DO k = nzb, nzt+1 |
---|
| 580 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) |
---|
| 581 | ENDDO |
---|
[1] | 582 | ENDDO |
---|
| 583 | ENDDO |
---|
[3004] | 584 | ELSE |
---|
| 585 | DO i = nxlg, nxrg |
---|
| 586 | DO j = nysg, nyng |
---|
| 587 | DO k = nzb, nzt+1 |
---|
[4591] | 588 | pt_av(k,j,i) = pt_av(k,j,i) + pt(k,j,i) + lv_d_cp * d_exner(k) & |
---|
| 589 | * ql(k,j,i) |
---|
[3004] | 590 | ENDDO |
---|
[1] | 591 | ENDDO |
---|
| 592 | ENDDO |
---|
[3004] | 593 | ENDIF |
---|
[1] | 594 | ENDIF |
---|
| 595 | |
---|
| 596 | CASE ( 'q' ) |
---|
[3004] | 597 | IF ( ALLOCATED( q_av ) ) THEN |
---|
| 598 | DO i = nxlg, nxrg |
---|
| 599 | DO j = nysg, nyng |
---|
| 600 | DO k = nzb, nzt+1 |
---|
| 601 | q_av(k,j,i) = q_av(k,j,i) + q(k,j,i) |
---|
| 602 | ENDDO |
---|
[1] | 603 | ENDDO |
---|
| 604 | ENDDO |
---|
[3004] | 605 | ENDIF |
---|
[402] | 606 | |
---|
[1] | 607 | CASE ( 'ql' ) |
---|
[3004] | 608 | IF ( ALLOCATED( ql_av ) ) THEN |
---|
| 609 | DO i = nxlg, nxrg |
---|
| 610 | DO j = nysg, nyng |
---|
| 611 | DO k = nzb, nzt+1 |
---|
| 612 | ql_av(k,j,i) = ql_av(k,j,i) + ql(k,j,i) |
---|
| 613 | ENDDO |
---|
[1] | 614 | ENDDO |
---|
| 615 | ENDDO |
---|
[3004] | 616 | ENDIF |
---|
[1] | 617 | |
---|
| 618 | CASE ( 'ql_c' ) |
---|
[4591] | 619 | IF ( ALLOCATED( ql_c_av ) ) THEN |
---|
[3004] | 620 | DO i = nxlg, nxrg |
---|
| 621 | DO j = nysg, nyng |
---|
| 622 | DO k = nzb, nzt+1 |
---|
| 623 | ql_c_av(k,j,i) = ql_c_av(k,j,i) + ql_c(k,j,i) |
---|
| 624 | ENDDO |
---|
[1] | 625 | ENDDO |
---|
| 626 | ENDDO |
---|
[3004] | 627 | ENDIF |
---|
[1] | 628 | |
---|
| 629 | CASE ( 'ql_v' ) |
---|
[4591] | 630 | IF ( ALLOCATED( ql_v_av ) ) THEN |
---|
[3004] | 631 | DO i = nxlg, nxrg |
---|
| 632 | DO j = nysg, nyng |
---|
| 633 | DO k = nzb, nzt+1 |
---|
| 634 | ql_v_av(k,j,i) = ql_v_av(k,j,i) + ql_v(k,j,i) |
---|
| 635 | ENDDO |
---|
[1] | 636 | ENDDO |
---|
| 637 | ENDDO |
---|
[3004] | 638 | ENDIF |
---|
[1] | 639 | |
---|
| 640 | CASE ( 'ql_vp' ) |
---|
[4591] | 641 | IF ( ALLOCATED( ql_vp_av ) ) THEN |
---|
[3004] | 642 | DO i = nxl, nxr |
---|
| 643 | DO j = nys, nyn |
---|
| 644 | DO k = nzb, nzt+1 |
---|
| 645 | number_of_particles = prt_count(k,j,i) |
---|
| 646 | IF ( number_of_particles <= 0 ) CYCLE |
---|
[4591] | 647 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
[3004] | 648 | DO n = 1, number_of_particles |
---|
| 649 | IF ( particles(n)%particle_mask ) THEN |
---|
[4591] | 650 | ql_vp_av(k,j,i) = ql_vp_av(k,j,i) + & |
---|
| 651 | particles(n)%weight_factor / number_of_particles |
---|
[3004] | 652 | ENDIF |
---|
| 653 | ENDDO |
---|
[1007] | 654 | ENDDO |
---|
[1] | 655 | ENDDO |
---|
| 656 | ENDDO |
---|
[3004] | 657 | ENDIF |
---|
[1] | 658 | |
---|
[4514] | 659 | CASE ( 'qsurf*' ) |
---|
| 660 | IF ( ALLOCATED( qsurf_av ) ) THEN |
---|
| 661 | DO i = nxl, nxr |
---|
| 662 | DO j = nys, nyn |
---|
[4591] | 663 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 664 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 665 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[4514] | 666 | |
---|
| 667 | IF ( match_def ) THEN |
---|
| 668 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 669 | qsurf_av(j,i) = qsurf_av(j,i) + surf_def_h(0)%q_surface(m) |
---|
[4514] | 670 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 671 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 672 | qsurf_av(j,i) = qsurf_av(j,i) + surf_lsm_h(0)%q_surface(m) |
---|
[4514] | 673 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 674 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 675 | qsurf_av(j,i) = qsurf_av(j,i) + surf_usm_h(0)%q_surface(m) |
---|
[4514] | 676 | ENDIF |
---|
| 677 | ENDDO |
---|
| 678 | ENDDO |
---|
| 679 | ENDIF |
---|
| 680 | |
---|
[402] | 681 | CASE ( 'qsws*' ) |
---|
[2743] | 682 | ! |
---|
| 683 | !-- In case of default surfaces, clean-up flux by density. |
---|
[4591] | 684 | !-- In case of land- and urban-surfaces, convert fluxes into dynamic units. |
---|
[3943] | 685 | !-- Question (maronga): are the .NOT. statements really required? |
---|
[4591] | 686 | IF ( ALLOCATED( qsws_av ) ) THEN |
---|
[3170] | 687 | DO i = nxl, nxr |
---|
| 688 | DO j = nys, nyn |
---|
[4591] | 689 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 690 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 691 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 692 | |
---|
| 693 | IF ( match_def ) THEN |
---|
| 694 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 695 | qsws_av(j,i) = qsws_av(j,i) + surf_def_h(0)%qsws(m) * & |
---|
| 696 | waterflux_output_conversion(nzb) |
---|
[3170] | 697 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 698 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 699 | qsws_av(j,i) = qsws_av(j,i) + surf_lsm_h(0)%qsws(m) * l_v |
---|
[3943] | 700 | ELSEIF ( match_usm .AND. .NOT. match_lsm ) THEN |
---|
[4671] | 701 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 702 | qsws_av(j,i) = qsws_av(j,i) + surf_usm_h(0)%qsws(m) * l_v |
---|
[3170] | 703 | ENDIF |
---|
| 704 | ENDDO |
---|
[3004] | 705 | ENDDO |
---|
| 706 | ENDIF |
---|
[402] | 707 | |
---|
[1] | 708 | CASE ( 'qv' ) |
---|
[4591] | 709 | IF ( ALLOCATED( qv_av ) ) THEN |
---|
[3004] | 710 | DO i = nxlg, nxrg |
---|
| 711 | DO j = nysg, nyng |
---|
| 712 | DO k = nzb, nzt+1 |
---|
| 713 | qv_av(k,j,i) = qv_av(k,j,i) + q(k,j,i) - ql(k,j,i) |
---|
| 714 | ENDDO |
---|
[1] | 715 | ENDDO |
---|
| 716 | ENDDO |
---|
[3004] | 717 | ENDIF |
---|
[1] | 718 | |
---|
[2735] | 719 | CASE ( 'r_a*' ) |
---|
[4591] | 720 | IF ( ALLOCATED( r_a_av ) ) THEN |
---|
[3170] | 721 | DO i = nxl, nxr |
---|
| 722 | DO j = nys, nyn |
---|
[4671] | 723 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 724 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 725 | |
---|
| 726 | IF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 727 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 728 | r_a_av(j,i) = r_a_av(j,i) + surf_lsm_h(0)%r_a(m) |
---|
[3170] | 729 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 730 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 731 | r_a_av(j,i) = r_a_av(j,i) + surf_usm_h(0)%frac(m,ind_veg_wall) * & |
---|
| 732 | surf_usm_h(0)%r_a(m) + & |
---|
| 733 | surf_usm_h(0)%frac(m,ind_pav_green) * & |
---|
| 734 | surf_usm_h(0)%r_a_green(m) + & |
---|
| 735 | surf_usm_h(0)%frac(m,ind_wat_win) * & |
---|
| 736 | surf_usm_h(0)%r_a_window(m) |
---|
[3170] | 737 | ENDIF |
---|
| 738 | ENDDO |
---|
[3004] | 739 | ENDDO |
---|
| 740 | ENDIF |
---|
[2735] | 741 | |
---|
[1] | 742 | CASE ( 's' ) |
---|
[4591] | 743 | IF ( ALLOCATED( s_av ) ) THEN |
---|
[3004] | 744 | DO i = nxlg, nxrg |
---|
| 745 | DO j = nysg, nyng |
---|
| 746 | DO k = nzb, nzt+1 |
---|
| 747 | s_av(k,j,i) = s_av(k,j,i) + s(k,j,i) |
---|
| 748 | ENDDO |
---|
[1] | 749 | ENDDO |
---|
| 750 | ENDDO |
---|
[3004] | 751 | ENDIF |
---|
[402] | 752 | |
---|
| 753 | CASE ( 'shf*' ) |
---|
[2743] | 754 | ! |
---|
| 755 | !-- In case of default surfaces, clean-up flux by density. |
---|
[4591] | 756 | !-- In case of land- and urban-surfaces, convert fluxes into dynamic units. |
---|
| 757 | IF ( ALLOCATED( shf_av ) ) THEN |
---|
[3170] | 758 | DO i = nxl, nxr |
---|
| 759 | DO j = nys, nyn |
---|
[4591] | 760 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 761 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 762 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 763 | |
---|
| 764 | IF ( match_def ) THEN |
---|
| 765 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 766 | shf_av(j,i) = shf_av(j,i) + surf_def_h(0)%shf(m) * & |
---|
| 767 | heatflux_output_conversion(nzb) |
---|
[3170] | 768 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 769 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 770 | shf_av(j,i) = shf_av(j,i) + surf_lsm_h(0)%shf(m) * c_p |
---|
[3170] | 771 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 772 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 773 | shf_av(j,i) = shf_av(j,i) + surf_usm_h(0)%shf(m) * c_p |
---|
[3170] | 774 | ENDIF |
---|
| 775 | ENDDO |
---|
[3004] | 776 | ENDDO |
---|
| 777 | ENDIF |
---|
[402] | 778 | |
---|
[4514] | 779 | CASE ( 'ssurf*' ) |
---|
| 780 | IF ( ALLOCATED( ssurf_av ) ) THEN |
---|
| 781 | DO i = nxl, nxr |
---|
| 782 | DO j = nys, nyn |
---|
| 783 | k = topo_top_ind(j,i,0) |
---|
| 784 | ssurf_av(j,i) = ssurf_av(j,i) + s(k,j,i) |
---|
| 785 | ENDDO |
---|
| 786 | ENDDO |
---|
| 787 | ENDIF |
---|
| 788 | |
---|
[1960] | 789 | CASE ( 'ssws*' ) |
---|
[4591] | 790 | IF ( ALLOCATED( ssws_av ) ) THEN |
---|
[3170] | 791 | DO i = nxl, nxr |
---|
| 792 | DO j = nys, nyn |
---|
[4591] | 793 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 794 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 795 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 796 | |
---|
| 797 | IF ( match_def ) THEN |
---|
| 798 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 799 | ssws_av(j,i) = ssws_av(j,i) + surf_def_h(0)%ssws(m) |
---|
[3170] | 800 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 801 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 802 | ssws_av(j,i) = ssws_av(j,i) + surf_lsm_h(0)%ssws(m) |
---|
[3170] | 803 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 804 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 805 | ssws_av(j,i) = ssws_av(j,i) + surf_usm_h(0)%ssws(m) |
---|
[3170] | 806 | ENDIF |
---|
| 807 | ENDDO |
---|
[3004] | 808 | ENDDO |
---|
| 809 | ENDIF |
---|
[1960] | 810 | |
---|
[1] | 811 | CASE ( 't*' ) |
---|
[4591] | 812 | IF ( ALLOCATED( ts_av ) ) THEN |
---|
[3170] | 813 | DO i = nxl, nxr |
---|
| 814 | DO j = nys, nyn |
---|
[4591] | 815 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 816 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 817 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 818 | |
---|
| 819 | IF ( match_def ) THEN |
---|
| 820 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 821 | ts_av(j,i) = ts_av(j,i) + surf_def_h(0)%ts(m) |
---|
[3170] | 822 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 823 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 824 | ts_av(j,i) = ts_av(j,i) + surf_lsm_h(0)%ts(m) |
---|
[3170] | 825 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 826 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 827 | ts_av(j,i) = ts_av(j,i) + surf_usm_h(0)%ts(m) |
---|
[3170] | 828 | ENDIF |
---|
| 829 | ENDDO |
---|
[3004] | 830 | ENDDO |
---|
| 831 | ENDIF |
---|
[1] | 832 | |
---|
[2742] | 833 | CASE ( 'tsurf*' ) |
---|
[4591] | 834 | IF ( ALLOCATED( tsurf_av ) ) THEN |
---|
[3170] | 835 | DO i = nxl, nxr |
---|
| 836 | DO j = nys, nyn |
---|
[4591] | 837 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 838 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 839 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[2798] | 840 | |
---|
[3170] | 841 | IF ( match_def ) THEN |
---|
| 842 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 843 | tsurf_av(j,i) = tsurf_av(j,i) + surf_def_h(0)%pt_surface(m) |
---|
[3170] | 844 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 845 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 846 | tsurf_av(j,i) = tsurf_av(j,i) + surf_lsm_h(0)%pt_surface(m) |
---|
[3170] | 847 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 848 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 849 | tsurf_av(j,i) = tsurf_av(j,i) + surf_usm_h(0)%pt_surface(m) |
---|
[3170] | 850 | ENDIF |
---|
| 851 | ENDDO |
---|
[3004] | 852 | ENDDO |
---|
| 853 | ENDIF |
---|
[2742] | 854 | |
---|
[1] | 855 | CASE ( 'u' ) |
---|
[3004] | 856 | IF ( ALLOCATED( u_av ) ) THEN |
---|
| 857 | DO i = nxlg, nxrg |
---|
| 858 | DO j = nysg, nyng |
---|
| 859 | DO k = nzb, nzt+1 |
---|
| 860 | u_av(k,j,i) = u_av(k,j,i) + u(k,j,i) |
---|
| 861 | ENDDO |
---|
[1] | 862 | ENDDO |
---|
| 863 | ENDDO |
---|
[3004] | 864 | ENDIF |
---|
[1] | 865 | |
---|
[3421] | 866 | CASE ( 'us*' ) |
---|
[4591] | 867 | IF ( ALLOCATED( us_av ) ) THEN |
---|
[3170] | 868 | DO i = nxl, nxr |
---|
| 869 | DO j = nys, nyn |
---|
[4591] | 870 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 871 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 872 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 873 | |
---|
| 874 | IF ( match_def ) THEN |
---|
| 875 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 876 | us_av(j,i) = us_av(j,i) + surf_def_h(0)%us(m) |
---|
[3170] | 877 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 878 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 879 | us_av(j,i) = us_av(j,i) + surf_lsm_h(0)%us(m) |
---|
[3170] | 880 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 881 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 882 | us_av(j,i) = us_av(j,i) + surf_usm_h(0)%us(m) |
---|
[3170] | 883 | ENDIF |
---|
| 884 | ENDDO |
---|
[3004] | 885 | ENDDO |
---|
| 886 | ENDIF |
---|
[1] | 887 | |
---|
| 888 | CASE ( 'v' ) |
---|
[4591] | 889 | IF ( ALLOCATED( v_av ) ) THEN |
---|
[3004] | 890 | DO i = nxlg, nxrg |
---|
| 891 | DO j = nysg, nyng |
---|
| 892 | DO k = nzb, nzt+1 |
---|
| 893 | v_av(k,j,i) = v_av(k,j,i) + v(k,j,i) |
---|
| 894 | ENDDO |
---|
[1] | 895 | ENDDO |
---|
| 896 | ENDDO |
---|
[3004] | 897 | ENDIF |
---|
[1] | 898 | |
---|
[3421] | 899 | CASE ( 'thetav' ) |
---|
[4591] | 900 | IF ( ALLOCATED( vpt_av ) ) THEN |
---|
[3004] | 901 | DO i = nxlg, nxrg |
---|
| 902 | DO j = nysg, nyng |
---|
| 903 | DO k = nzb, nzt+1 |
---|
| 904 | vpt_av(k,j,i) = vpt_av(k,j,i) + vpt(k,j,i) |
---|
| 905 | ENDDO |
---|
[1] | 906 | ENDDO |
---|
| 907 | ENDDO |
---|
[3004] | 908 | ENDIF |
---|
[1] | 909 | |
---|
| 910 | CASE ( 'w' ) |
---|
[4591] | 911 | IF ( ALLOCATED( w_av ) ) THEN |
---|
[3004] | 912 | DO i = nxlg, nxrg |
---|
| 913 | DO j = nysg, nyng |
---|
| 914 | DO k = nzb, nzt+1 |
---|
| 915 | w_av(k,j,i) = w_av(k,j,i) + w(k,j,i) |
---|
| 916 | ENDDO |
---|
[1] | 917 | ENDDO |
---|
| 918 | ENDDO |
---|
[3004] | 919 | ENDIF |
---|
[1] | 920 | |
---|
[72] | 921 | CASE ( 'z0*' ) |
---|
[4591] | 922 | IF ( ALLOCATED( z0_av ) ) THEN |
---|
[3170] | 923 | DO i = nxl, nxr |
---|
| 924 | DO j = nys, nyn |
---|
[4591] | 925 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 926 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 927 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 928 | |
---|
| 929 | IF ( match_def ) THEN |
---|
| 930 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 931 | z0_av(j,i) = z0_av(j,i) + surf_def_h(0)%z0(m) |
---|
[3170] | 932 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 933 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 934 | z0_av(j,i) = z0_av(j,i) + surf_lsm_h(0)%z0(m) |
---|
[3170] | 935 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 936 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 937 | z0_av(j,i) = z0_av(j,i) + surf_usm_h(0)%z0(m) |
---|
[3170] | 938 | ENDIF |
---|
| 939 | ENDDO |
---|
[4591] | 940 | ENDDO |
---|
[3004] | 941 | ENDIF |
---|
[72] | 942 | |
---|
[978] | 943 | CASE ( 'z0h*' ) |
---|
[4591] | 944 | IF ( ALLOCATED( z0h_av ) ) THEN |
---|
[3170] | 945 | DO i = nxl, nxr |
---|
| 946 | DO j = nys, nyn |
---|
[4591] | 947 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 948 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 949 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 950 | |
---|
| 951 | IF ( match_def ) THEN |
---|
| 952 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 953 | z0h_av(j,i) = z0h_av(j,i) + surf_def_h(0)%z0h(m) |
---|
[3170] | 954 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 955 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 956 | z0h_av(j,i) = z0h_av(j,i) + surf_lsm_h(0)%z0h(m) |
---|
[3170] | 957 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 958 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 959 | z0h_av(j,i) = z0h_av(j,i) + surf_usm_h(0)%z0h(m) |
---|
[3170] | 960 | ENDIF |
---|
| 961 | ENDDO |
---|
[3004] | 962 | ENDDO |
---|
| 963 | ENDIF |
---|
[4591] | 964 | |
---|
[1788] | 965 | CASE ( 'z0q*' ) |
---|
[4591] | 966 | IF ( ALLOCATED( z0q_av ) ) THEN |
---|
[3170] | 967 | DO i = nxl, nxr |
---|
| 968 | DO j = nys, nyn |
---|
[4591] | 969 | match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i) |
---|
[4671] | 970 | match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) |
---|
| 971 | match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) |
---|
[3170] | 972 | |
---|
| 973 | IF ( match_def ) THEN |
---|
| 974 | m = surf_def_h(0)%end_index(j,i) |
---|
[4591] | 975 | z0q_av(j,i) = z0q_av(j,i) + surf_def_h(0)%z0q(m) |
---|
[3170] | 976 | ELSEIF ( match_lsm .AND. .NOT. match_usm ) THEN |
---|
[4671] | 977 | m = surf_lsm_h(0)%end_index(j,i) |
---|
| 978 | z0q_av(j,i) = z0q_av(j,i) + surf_lsm_h(0)%z0q(m) |
---|
[3170] | 979 | ELSEIF ( match_usm ) THEN |
---|
[4671] | 980 | m = surf_usm_h(0)%end_index(j,i) |
---|
| 981 | z0q_av(j,i) = z0q_av(j,i) + surf_usm_h(0)%z0q(m) |
---|
[3170] | 982 | ENDIF |
---|
| 983 | ENDDO |
---|
[3004] | 984 | ENDDO |
---|
| 985 | ENDIF |
---|
[3294] | 986 | |
---|
[1] | 987 | CASE DEFAULT |
---|
[3274] | 988 | |
---|
[4591] | 989 | !-- In case of urban surface variables it should be always checked if respective arrays are |
---|
| 990 | !-- allocated, at least in case of a restart run, as averaged usm arrays are not read from |
---|
| 991 | !-- file at the moment. |
---|
[3637] | 992 | IF ( urban_surface ) THEN |
---|
| 993 | CALL usm_3d_data_averaging( 'allocate', trimvar ) |
---|
[3337] | 994 | ENDIF |
---|
| 995 | |
---|
[2696] | 996 | ! |
---|
[3637] | 997 | !-- Summing up data from all other modules |
---|
| 998 | CALL module_interface_3d_data_averaging( 'sum', trimvar ) |
---|
| 999 | |
---|
| 1000 | |
---|
[1] | 1001 | END SELECT |
---|
| 1002 | |
---|
| 1003 | ENDDO |
---|
| 1004 | |
---|
[1318] | 1005 | CALL cpu_log( log_point(34), 'sum_up_3d_data', 'stop' ) |
---|
[1] | 1006 | |
---|
| 1007 | |
---|
| 1008 | END SUBROUTINE sum_up_3d_data |
---|