[1682] | 1 | !> @file flow_statistics.f90 |
---|
[4646] | 2 | !--------------------------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[4646] | 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 | ! |
---|
[4646] | 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 | ! |
---|
[4646] | 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 | ! |
---|
[4360] | 16 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
[4646] | 17 | !--------------------------------------------------------------------------------------------------! |
---|
[1036] | 18 | ! |
---|
[254] | 19 | ! Current revisions: |
---|
[3298] | 20 | ! ------------------ |
---|
[4646] | 21 | ! |
---|
| 22 | ! |
---|
[1739] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: flow_statistics.f90 4672 2020-09-09 21:27:32Z pavelkrc $ |
---|
[4672] | 26 | ! OpenACC bugfix |
---|
| 27 | ! |
---|
| 28 | ! 4671 2020-09-09 20:27:58Z pavelkrc |
---|
[4671] | 29 | ! Implementation of downward facing USM and LSM surfaces |
---|
| 30 | ! |
---|
| 31 | ! 4646 2020-08-24 16:02:40Z raasch |
---|
[4646] | 32 | ! file re-formatted to follow the PALM coding standard |
---|
| 33 | ! |
---|
| 34 | ! 4581 2020-06-29 08:49:58Z suehring |
---|
[4581] | 35 | ! Formatting adjustment |
---|
[4646] | 36 | ! |
---|
[4581] | 37 | ! 4551 2020-06-02 10:22:25Z suehring |
---|
[4551] | 38 | ! Bugfix in summation for statistical regions |
---|
[4646] | 39 | ! |
---|
[4551] | 40 | ! 4521 2020-05-06 11:39:49Z schwenkel |
---|
[4521] | 41 | ! Rename variable |
---|
[4646] | 42 | ! |
---|
[4521] | 43 | ! 4502 2020-04-17 16:14:16Z schwenkel |
---|
[4502] | 44 | ! Implementation of ice microphysics |
---|
[4646] | 45 | ! |
---|
[4502] | 46 | ! 4472 2020-03-24 12:21:00Z Giersch |
---|
[4472] | 47 | ! Calculations of the Kolmogorov lengt scale eta implemented |
---|
| 48 | ! |
---|
| 49 | ! 4464 2020-03-17 11:08:46Z Giersch |
---|
[4464] | 50 | ! Reset last change (r4463) |
---|
[4472] | 51 | ! |
---|
[4464] | 52 | ! 4463 2020-03-17 09:27:36Z Giersch |
---|
[4646] | 53 | ! Calculate horizontally averaged profiles of all velocity components at the same place |
---|
[4464] | 54 | ! |
---|
[4463] | 55 | ! 4444 2020-03-05 15:59:50Z raasch |
---|
[4444] | 56 | ! bugfix: cpp-directives for serial mode added |
---|
[4472] | 57 | ! |
---|
[4444] | 58 | ! 4442 2020-03-04 19:21:13Z suehring |
---|
[4646] | 59 | ! Change order of dimension in surface array %frac to allow for better vectorization. |
---|
[4472] | 60 | ! |
---|
[4442] | 61 | ! 4441 2020-03-04 19:20:35Z suehring |
---|
[4646] | 62 | ! Introduction of wall_flags_total_0, which currently sets bits based on static topography |
---|
| 63 | ! information used in wall_flags_static_0 |
---|
[4472] | 64 | ! |
---|
[4346] | 65 | ! 4329 2019-12-10 15:46:36Z motisi |
---|
[4329] | 66 | ! Renamed wall_flags_0 to wall_flags_static_0 |
---|
[4472] | 67 | ! |
---|
[4329] | 68 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
[4182] | 69 | ! Corrected "Former revisions" section |
---|
[4472] | 70 | ! |
---|
[4182] | 71 | ! 4131 2019-08-02 11:06:18Z monakurppa |
---|
[4131] | 72 | ! Allow profile output for salsa variables. |
---|
[4472] | 73 | ! |
---|
[4131] | 74 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
[4646] | 75 | ! Correct conversion to kinematic scalar fluxes in case of pw-scheme and statistic regions |
---|
[4472] | 76 | ! |
---|
[4039] | 77 | ! 3828 2019-03-27 19:36:23Z raasch |
---|
[3828] | 78 | ! unused variables removed |
---|
[4472] | 79 | ! |
---|
[3828] | 80 | ! 3676 2019-01-16 15:07:05Z knoop |
---|
[3651] | 81 | ! Bugfix, terminate OMP Parallel block |
---|
[3298] | 82 | ! |
---|
[4182] | 83 | ! Revision 1.1 1997/08/11 06:15:17 raasch |
---|
| 84 | ! Initial revision |
---|
| 85 | ! |
---|
| 86 | ! |
---|
[1] | 87 | ! Description: |
---|
| 88 | ! ------------ |
---|
[4646] | 89 | !> Compute average profiles and further average flow quantities for the different user-defined |
---|
| 90 | !> (sub-)regions. The region indexed 0 is the total model domain. |
---|
[1682] | 91 | !> |
---|
[4646] | 92 | !> @note For simplicity, nzb_s_inner and nzb_diff_s_inner are used as a lower vertical index for |
---|
| 93 | !> k-loops for all variables, although strictly speaking the k-loops would have to be split |
---|
| 94 | !> up according to the staggered grid. However, this implies no error since staggered velocity |
---|
| 95 | !> components are zero at the walls and inside buildings. |
---|
| 96 | !--------------------------------------------------------------------------------------------------! |
---|
[1682] | 97 | SUBROUTINE flow_statistics |
---|
[1] | 98 | |
---|
[3298] | 99 | |
---|
[4646] | 100 | USE arrays_3d, & |
---|
| 101 | ONLY: ddzu, ddzw, d_exner, e, heatflux_output_conversion, hyp, km, kh, & |
---|
| 102 | momentumflux_output_conversion, nc, ni, nr, p, prho, prr, pt, q, qc, qi, ql, qr, & |
---|
| 103 | rho_air, rho_air_zw, rho_ocean, s, sa, u, ug, v, vg, vpt, w, w_subs, & |
---|
| 104 | waterflux_output_conversion, zw |
---|
[3298] | 105 | |
---|
[4646] | 106 | USE basic_constants_and_equations_mod, & |
---|
[3298] | 107 | ONLY: g, lv_d_cp |
---|
| 108 | |
---|
[4646] | 109 | USE bulk_cloud_model_mod, & |
---|
| 110 | ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert, microphysics_ice_phase |
---|
[3298] | 111 | |
---|
[4646] | 112 | USE chem_modules, & |
---|
[3298] | 113 | ONLY: max_pr_cs |
---|
| 114 | |
---|
[4646] | 115 | USE control_parameters, & |
---|
| 116 | ONLY: air_chemistry, average_count_pr, cloud_droplets, do_sum, dt_3d, humidity, & |
---|
| 117 | initializing_actions, kolmogorov_length_scale, land_surface, large_scale_forcing, & |
---|
| 118 | large_scale_subsidence, max_pr_salsa, max_pr_user, message_string, neutral, & |
---|
| 119 | ocean_mode, passive_scalar, salsa, simulated_time, simulated_time_at_begin, & |
---|
| 120 | use_subsidence_tendencies, use_surface_fluxes, use_top_fluxes, ws_scheme_mom, & |
---|
| 121 | ws_scheme_sca |
---|
[3298] | 122 | |
---|
[4646] | 123 | USE cpulog, & |
---|
[1551] | 124 | ONLY: cpu_log, log_point |
---|
[3298] | 125 | |
---|
[4646] | 126 | USE grid_variables, & |
---|
[1551] | 127 | ONLY: ddx, ddy |
---|
[4472] | 128 | |
---|
[4646] | 129 | USE indices, & |
---|
| 130 | ONLY: ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, nxl, nxr, nyn, nys, nzb, nzt, & |
---|
| 131 | topo_min_level, wall_flags_total_0 |
---|
[4444] | 132 | |
---|
| 133 | #if defined( __parallel ) |
---|
[4646] | 134 | USE indices, & |
---|
[4444] | 135 | ONLY: ngp_sums, ngp_sums_ls |
---|
| 136 | #endif |
---|
[4472] | 137 | |
---|
[1320] | 138 | USE kinds |
---|
[4472] | 139 | |
---|
[4646] | 140 | USE land_surface_model_mod, & |
---|
[2232] | 141 | ONLY: m_soil_h, nzb_soil, nzt_soil, t_soil_h |
---|
[1551] | 142 | |
---|
[4646] | 143 | USE lsf_nudging_mod, & |
---|
[2320] | 144 | ONLY: td_lsa_lpt, td_lsa_q, td_sub_lpt, td_sub_q, time_vert |
---|
| 145 | |
---|
[4646] | 146 | USE module_interface, & |
---|
[3637] | 147 | ONLY: module_interface_statistics |
---|
| 148 | |
---|
[4646] | 149 | USE netcdf_interface, & |
---|
[2817] | 150 | ONLY: dots_rad, dots_soil, dots_max |
---|
[1783] | 151 | |
---|
[1] | 152 | USE pegrid |
---|
[1551] | 153 | |
---|
[4646] | 154 | USE radiation_model_mod, & |
---|
| 155 | ONLY: radiation, radiation_scheme, & |
---|
| 156 | rad_lw_in, rad_lw_out, rad_lw_cs_hr, rad_lw_hr, & |
---|
[1691] | 157 | rad_sw_in, rad_sw_out, rad_sw_cs_hr, rad_sw_hr |
---|
[1585] | 158 | |
---|
[1] | 159 | USE statistics |
---|
| 160 | |
---|
[4646] | 161 | USE surface_mod, & |
---|
[3828] | 162 | ONLY : surf_def_h, surf_lsm_h, surf_usm_h |
---|
[1691] | 163 | |
---|
[2232] | 164 | |
---|
[1] | 165 | IMPLICIT NONE |
---|
| 166 | |
---|
[1682] | 167 | INTEGER(iwp) :: i !< |
---|
| 168 | INTEGER(iwp) :: j !< |
---|
| 169 | INTEGER(iwp) :: k !< |
---|
[4472] | 170 | INTEGER(iwp) :: ki !< |
---|
[1738] | 171 | INTEGER(iwp) :: k_surface_level !< |
---|
[4472] | 172 | INTEGER(iwp) :: m !< loop variable over all horizontal wall elements |
---|
[2232] | 173 | INTEGER(iwp) :: l !< loop variable over surface facing -- up- or downward-facing |
---|
[1682] | 174 | INTEGER(iwp) :: nt !< |
---|
[3241] | 175 | !$ INTEGER(iwp) :: omp_get_thread_num !< |
---|
[1682] | 176 | INTEGER(iwp) :: sr !< |
---|
| 177 | INTEGER(iwp) :: tn !< |
---|
[2232] | 178 | |
---|
[1682] | 179 | LOGICAL :: first !< |
---|
[4472] | 180 | |
---|
| 181 | REAL(wp) :: dissipation !< dissipation rate |
---|
| 182 | REAL(wp) :: dptdz_threshold !< |
---|
| 183 | REAL(wp) :: du_dx !< Derivative of u fluctuations with respect to x |
---|
| 184 | REAL(wp) :: du_dy !< Derivative of u fluctuations with respect to y |
---|
| 185 | REAL(wp) :: du_dz !< Derivative of u fluctuations with respect to z |
---|
| 186 | REAL(wp) :: dv_dx !< Derivative of v fluctuations with respect to x |
---|
| 187 | REAL(wp) :: dv_dy !< Derivative of v fluctuations with respect to y |
---|
| 188 | REAL(wp) :: dv_dz !< Derivative of v fluctuations with respect to z |
---|
| 189 | REAL(wp) :: dw_dx !< Derivative of w fluctuations with respect to x |
---|
| 190 | REAL(wp) :: dw_dy !< Derivative of w fluctuations with respect to y |
---|
| 191 | REAL(wp) :: dw_dz !< Derivative of w fluctuations with respect to z |
---|
| 192 | REAL(wp) :: eta !< Kolmogorov length scale |
---|
[1682] | 193 | REAL(wp) :: fac !< |
---|
[2232] | 194 | REAL(wp) :: flag !< |
---|
[1682] | 195 | REAL(wp) :: height !< |
---|
| 196 | REAL(wp) :: pts !< |
---|
[4472] | 197 | REAL(wp) :: s11 !< fluctuating rate-of-strain tensor component 11 |
---|
| 198 | REAL(wp) :: s21 !< fluctuating rate-of-strain tensor component 21 |
---|
| 199 | REAL(wp) :: s31 !< fluctuating rate-of-strain tensor component 31 |
---|
| 200 | REAL(wp) :: s12 !< fluctuating rate-of-strain tensor component 12 |
---|
| 201 | REAL(wp) :: s22 !< fluctuating rate-of-strain tensor component 22 |
---|
| 202 | REAL(wp) :: s32 !< fluctuating rate-of-strain tensor component 32 |
---|
| 203 | REAL(wp) :: s13 !< fluctuating rate-of-strain tensor component 13 |
---|
| 204 | REAL(wp) :: s23 !< fluctuating rate-of-strain tensor component 23 |
---|
| 205 | REAL(wp) :: s33 !< fluctuating rate-of-strain tensor component 33 |
---|
[1682] | 206 | REAL(wp) :: sums_l_etot !< |
---|
| 207 | REAL(wp) :: ust !< |
---|
| 208 | REAL(wp) :: ust2 !< |
---|
| 209 | REAL(wp) :: u2 !< |
---|
| 210 | REAL(wp) :: vst !< |
---|
| 211 | REAL(wp) :: vst2 !< |
---|
| 212 | REAL(wp) :: v2 !< |
---|
| 213 | REAL(wp) :: w2 !< |
---|
[4472] | 214 | |
---|
[1682] | 215 | REAL(wp) :: dptdz(nzb+1:nzt+1) !< |
---|
| 216 | REAL(wp) :: sums_ll(nzb:nzt+1,2) !< |
---|
[1] | 217 | |
---|
[4646] | 218 | |
---|
[1] | 219 | CALL cpu_log( log_point(10), 'flow_statistics', 'start' ) |
---|
| 220 | |
---|
[1221] | 221 | |
---|
[1] | 222 | ! |
---|
[4646] | 223 | !-- To be on the safe side, check whether flow_statistics has already been called once after the |
---|
| 224 | !-- current time step. |
---|
[1] | 225 | IF ( flow_statistics_called ) THEN |
---|
[254] | 226 | |
---|
[4646] | 227 | message_string = 'flow_statistics is called two times within one ' // 'timestep' |
---|
[254] | 228 | CALL message( 'flow_statistics', 'PA0190', 1, 2, 0, 6, 0 ) |
---|
[1007] | 229 | |
---|
[1] | 230 | ENDIF |
---|
| 231 | |
---|
| 232 | ! |
---|
| 233 | !-- Compute statistics for each (sub-)region |
---|
| 234 | DO sr = 0, statistic_regions |
---|
| 235 | |
---|
| 236 | ! |
---|
| 237 | !-- Initialize (local) summation array |
---|
[1353] | 238 | sums_l = 0.0_wp |
---|
[3658] | 239 | #ifdef _OPENACC |
---|
| 240 | !$ACC KERNELS PRESENT(sums_l) |
---|
| 241 | sums_l = 0.0_wp |
---|
| 242 | !$ACC END KERNELS |
---|
| 243 | #endif |
---|
[1] | 244 | |
---|
| 245 | ! |
---|
[4646] | 246 | !-- Store sums that have been computed in other subroutines in summation array |
---|
[1] | 247 | sums_l(:,11,:) = sums_l_l(:,sr,:) ! mixing length from diffusivities |
---|
[4472] | 248 | !-- WARNING: next line still has to be adjusted for OpenMP |
---|
[4646] | 249 | sums_l(:,21,0) = sums_wsts_bc_l(:,sr) * & |
---|
[2037] | 250 | heatflux_output_conversion ! heat flux from advec_s_bc |
---|
[87] | 251 | sums_l(nzb+9,pr_palm,0) = sums_divold_l(sr) ! old divergence from pres |
---|
| 252 | sums_l(nzb+10,pr_palm,0) = sums_divnew_l(sr) ! new divergence from pres |
---|
[1] | 253 | |
---|
[667] | 254 | ! |
---|
[4646] | 255 | !-- When calcuating horizontally-averaged total (resolved- plus subgrid-scale) vertical fluxes |
---|
| 256 | !-- and velocity variances by using commonly-applied Reynolds-based methods |
---|
| 257 | !-- ( e.g. <w'pt'> = (w-<w>)*(pt-<pt>) ) in combination with the 5th order advection scheme, |
---|
| 258 | !-- pronounced artificial kinks could be observed in the vertical profiles near the surface. |
---|
| 259 | !-- Please note: these kinks were not related to the model truth, i.e. these kinks are just |
---|
| 260 | !-- related to an evaluation problem. |
---|
| 261 | !-- In order avoid these kinks, vertical fluxes and horizontal as well vertical velocity |
---|
| 262 | !-- variances are calculated directly within the advection routines, according to the numerical |
---|
| 263 | !-- discretization, to evaluate the statistical quantities as they will appear within the |
---|
| 264 | !-- prognostic equations. |
---|
| 265 | !-- Copy the turbulent quantities, evaluated in the advection routines to the local array |
---|
| 266 | !-- sums_l() for further computations. |
---|
[743] | 267 | IF ( ws_scheme_mom .AND. sr == 0 ) THEN |
---|
[696] | 268 | |
---|
[1007] | 269 | ! |
---|
[4646] | 270 | !-- According to the Neumann bc for the horizontal velocity components, the corresponding |
---|
| 271 | !-- fluxes has to satisfiy the same bc. |
---|
[3294] | 272 | IF ( ocean_mode ) THEN |
---|
[801] | 273 | sums_us2_ws_l(nzt+1,:) = sums_us2_ws_l(nzt,:) |
---|
[1007] | 274 | sums_vs2_ws_l(nzt+1,:) = sums_vs2_ws_l(nzt,:) |
---|
[673] | 275 | ENDIF |
---|
[696] | 276 | |
---|
| 277 | DO i = 0, threads_per_task-1 |
---|
[1007] | 278 | ! |
---|
[696] | 279 | !-- Swap the turbulent quantities evaluated in advec_ws. |
---|
[4646] | 280 | sums_l(:,13,i) = sums_wsus_ws_l(:,i) * momentumflux_output_conversion ! w*u* |
---|
| 281 | sums_l(:,15,i) = sums_wsvs_ws_l(:,i) * momentumflux_output_conversion ! w*v* |
---|
| 282 | sums_l(:,30,i) = sums_us2_ws_l(:,i) ! u*2 |
---|
| 283 | sums_l(:,31,i) = sums_vs2_ws_l(:,i) ! v*2 |
---|
| 284 | sums_l(:,32,i) = sums_ws2_ws_l(:,i) ! w*2 |
---|
| 285 | sums_l(:,34,i) = sums_l(:,34,i) + 0.5_wp * & |
---|
| 286 | ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) + sums_ws2_ws_l(:,i) ) ! e* |
---|
[667] | 287 | ENDDO |
---|
[696] | 288 | |
---|
[667] | 289 | ENDIF |
---|
[696] | 290 | |
---|
[1567] | 291 | IF ( ws_scheme_sca .AND. sr == 0 ) THEN |
---|
[696] | 292 | |
---|
| 293 | DO i = 0, threads_per_task-1 |
---|
[4646] | 294 | sums_l(:,17,i) = sums_wspts_ws_l(:,i) & |
---|
| 295 | * heatflux_output_conversion ! w*pt* |
---|
| 296 | IF ( ocean_mode ) sums_l(:,66,i) = sums_wssas_ws_l(:,i) ! w*sa* |
---|
| 297 | IF ( humidity ) sums_l(:,49,i) = sums_wsqs_ws_l(:,i) & |
---|
| 298 | * waterflux_output_conversion ! w*q* |
---|
| 299 | IF ( passive_scalar ) sums_l(:,114,i) = sums_wsss_ws_l(:,i) ! w*s* |
---|
[696] | 300 | ENDDO |
---|
| 301 | |
---|
[667] | 302 | ENDIF |
---|
[4472] | 303 | ! |
---|
[4464] | 304 | !-- Horizontally averaged profiles of horizontal velocities and temperature. |
---|
[4646] | 305 | !-- They must have been computed before, because they are already required for other horizontal |
---|
| 306 | !-- averages. |
---|
[1] | 307 | tn = 0 |
---|
[2232] | 308 | !$OMP PARALLEL PRIVATE( i, j, k, tn, flag ) |
---|
| 309 | !$ tn = omp_get_thread_num() |
---|
[1] | 310 | !$OMP DO |
---|
[3658] | 311 | !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) & |
---|
[4346] | 312 | !$ACC PRESENT(wall_flags_total_0, u, v, pt, rmask, sums_l) |
---|
[1] | 313 | DO i = nxl, nxr |
---|
| 314 | DO j = nys, nyn |
---|
[2232] | 315 | DO k = nzb, nzt+1 |
---|
[4346] | 316 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[3658] | 317 | !$ACC ATOMIC |
---|
[4646] | 318 | sums_l(k,1,tn) = sums_l(k,1,tn) + u(k,j,i) * rmask(j,i,sr) * flag |
---|
[3658] | 319 | !$ACC ATOMIC |
---|
[4646] | 320 | sums_l(k,2,tn) = sums_l(k,2,tn) + v(k,j,i) * rmask(j,i,sr) * flag |
---|
[3658] | 321 | !$ACC ATOMIC |
---|
[4646] | 322 | sums_l(k,4,tn) = sums_l(k,4,tn) + pt(k,j,i) * rmask(j,i,sr) * flag |
---|
[1] | 323 | ENDDO |
---|
| 324 | ENDDO |
---|
| 325 | ENDDO |
---|
[4464] | 326 | !$ACC UPDATE HOST(sums_l(:,1,tn), sums_l(:,2,tn), sums_l(:,4,tn)) |
---|
[1] | 327 | |
---|
| 328 | ! |
---|
[96] | 329 | !-- Horizontally averaged profile of salinity |
---|
[3294] | 330 | IF ( ocean_mode ) THEN |
---|
[96] | 331 | !$OMP DO |
---|
| 332 | DO i = nxl, nxr |
---|
| 333 | DO j = nys, nyn |
---|
[2232] | 334 | DO k = nzb, nzt+1 |
---|
[4646] | 335 | sums_l(k,23,tn) = sums_l(k,23,tn) + sa(k,j,i) & |
---|
| 336 | * rmask(j,i,sr) & |
---|
| 337 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 338 | BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[96] | 339 | ENDDO |
---|
| 340 | ENDDO |
---|
| 341 | ENDDO |
---|
| 342 | ENDIF |
---|
| 343 | |
---|
| 344 | ! |
---|
[4646] | 345 | !-- Horizontally averaged profiles of virtual potential temperature, total water content, water |
---|
| 346 | !-- vapor mixing ratio and liquid water potential temperature |
---|
[75] | 347 | IF ( humidity ) THEN |
---|
[1] | 348 | !$OMP DO |
---|
| 349 | DO i = nxl, nxr |
---|
| 350 | DO j = nys, nyn |
---|
[2232] | 351 | DO k = nzb, nzt+1 |
---|
[4346] | 352 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[4646] | 353 | sums_l(k,44,tn) = sums_l(k,44,tn) + vpt(k,j,i) * rmask(j,i,sr) * flag |
---|
| 354 | sums_l(k,41,tn) = sums_l(k,41,tn) + q(k,j,i) * rmask(j,i,sr) * flag |
---|
[1] | 355 | ENDDO |
---|
| 356 | ENDDO |
---|
| 357 | ENDDO |
---|
[3274] | 358 | IF ( bulk_cloud_model ) THEN |
---|
[1] | 359 | !$OMP DO |
---|
| 360 | DO i = nxl, nxr |
---|
| 361 | DO j = nys, nyn |
---|
[2232] | 362 | DO k = nzb, nzt+1 |
---|
[4346] | 363 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[2232] | 364 | sums_l(k,42,tn) = sums_l(k,42,tn) + & |
---|
[4646] | 365 | ( q(k,j,i) - ql(k,j,i) ) * rmask(j,i,sr) * flag |
---|
| 366 | sums_l(k,43,tn) = sums_l(k,43,tn) + ( & |
---|
| 367 | pt(k,j,i) + lv_d_cp * d_exner(k) * ql(k,j,i) & |
---|
| 368 | ) * rmask(j,i,sr) * flag |
---|
[1] | 369 | ENDDO |
---|
| 370 | ENDDO |
---|
| 371 | ENDDO |
---|
| 372 | ENDIF |
---|
| 373 | ENDIF |
---|
| 374 | |
---|
| 375 | ! |
---|
| 376 | !-- Horizontally averaged profiles of passive scalar |
---|
| 377 | IF ( passive_scalar ) THEN |
---|
| 378 | !$OMP DO |
---|
| 379 | DO i = nxl, nxr |
---|
| 380 | DO j = nys, nyn |
---|
[2232] | 381 | DO k = nzb, nzt+1 |
---|
[4646] | 382 | sums_l(k,115,tn) = sums_l(k,115,tn) + s(k,j,i) & |
---|
| 383 | * rmask(j,i,sr) & |
---|
| 384 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 385 | BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[1] | 386 | ENDDO |
---|
| 387 | ENDDO |
---|
| 388 | ENDDO |
---|
| 389 | ENDIF |
---|
| 390 | !$OMP END PARALLEL |
---|
| 391 | ! |
---|
| 392 | !-- Summation of thread sums |
---|
| 393 | IF ( threads_per_task > 1 ) THEN |
---|
| 394 | DO i = 1, threads_per_task-1 |
---|
| 395 | sums_l(:,1,0) = sums_l(:,1,0) + sums_l(:,1,i) |
---|
| 396 | sums_l(:,2,0) = sums_l(:,2,0) + sums_l(:,2,i) |
---|
| 397 | sums_l(:,4,0) = sums_l(:,4,0) + sums_l(:,4,i) |
---|
[3294] | 398 | IF ( ocean_mode ) THEN |
---|
[96] | 399 | sums_l(:,23,0) = sums_l(:,23,0) + sums_l(:,23,i) |
---|
| 400 | ENDIF |
---|
[75] | 401 | IF ( humidity ) THEN |
---|
[1] | 402 | sums_l(:,41,0) = sums_l(:,41,0) + sums_l(:,41,i) |
---|
| 403 | sums_l(:,44,0) = sums_l(:,44,0) + sums_l(:,44,i) |
---|
[3274] | 404 | IF ( bulk_cloud_model ) THEN |
---|
[1] | 405 | sums_l(:,42,0) = sums_l(:,42,0) + sums_l(:,42,i) |
---|
| 406 | sums_l(:,43,0) = sums_l(:,43,0) + sums_l(:,43,i) |
---|
| 407 | ENDIF |
---|
| 408 | ENDIF |
---|
| 409 | IF ( passive_scalar ) THEN |
---|
[2270] | 410 | sums_l(:,115,0) = sums_l(:,115,0) + sums_l(:,115,i) |
---|
[1] | 411 | ENDIF |
---|
| 412 | ENDDO |
---|
| 413 | ENDIF |
---|
| 414 | |
---|
| 415 | #if defined( __parallel ) |
---|
| 416 | ! |
---|
| 417 | !-- Compute total sum from local sums |
---|
[622] | 418 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 419 | CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d, & |
---|
| 420 | ierr ) |
---|
[622] | 421 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 422 | CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d, & |
---|
| 423 | ierr ) |
---|
[622] | 424 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 425 | CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d, & |
---|
| 426 | ierr ) |
---|
[3294] | 427 | IF ( ocean_mode ) THEN |
---|
[622] | 428 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 429 | CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d,& |
---|
| 430 | ierr ) |
---|
[96] | 431 | ENDIF |
---|
[75] | 432 | IF ( humidity ) THEN |
---|
[622] | 433 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 434 | CALL MPI_ALLREDUCE( sums_l(nzb,44,0), sums(nzb,44), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d,& |
---|
| 435 | ierr ) |
---|
[622] | 436 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 437 | CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d,& |
---|
| 438 | ierr ) |
---|
[3274] | 439 | IF ( bulk_cloud_model ) THEN |
---|
[622] | 440 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 441 | CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb, MPI_REAL, MPI_SUM, & |
---|
| 442 | comm2d, ierr ) |
---|
[622] | 443 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 444 | CALL MPI_ALLREDUCE( sums_l(nzb,43,0), sums(nzb,43), nzt+2-nzb, MPI_REAL, MPI_SUM, & |
---|
| 445 | comm2d, ierr ) |
---|
[1] | 446 | ENDIF |
---|
| 447 | ENDIF |
---|
| 448 | |
---|
| 449 | IF ( passive_scalar ) THEN |
---|
[622] | 450 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 451 | CALL MPI_ALLREDUCE( sums_l(nzb,115,0), sums(nzb,115), nzt+2-nzb, MPI_REAL, MPI_SUM, & |
---|
| 452 | comm2d, ierr ) |
---|
[1] | 453 | ENDIF |
---|
| 454 | #else |
---|
| 455 | sums(:,1) = sums_l(:,1,0) |
---|
| 456 | sums(:,2) = sums_l(:,2,0) |
---|
| 457 | sums(:,4) = sums_l(:,4,0) |
---|
[3294] | 458 | IF ( ocean_mode ) sums(:,23) = sums_l(:,23,0) |
---|
[75] | 459 | IF ( humidity ) THEN |
---|
[1] | 460 | sums(:,44) = sums_l(:,44,0) |
---|
| 461 | sums(:,41) = sums_l(:,41,0) |
---|
[3274] | 462 | IF ( bulk_cloud_model ) THEN |
---|
[1] | 463 | sums(:,42) = sums_l(:,42,0) |
---|
| 464 | sums(:,43) = sums_l(:,43,0) |
---|
| 465 | ENDIF |
---|
| 466 | ENDIF |
---|
[2270] | 467 | IF ( passive_scalar ) sums(:,115) = sums_l(:,115,0) |
---|
[1] | 468 | #endif |
---|
| 469 | |
---|
| 470 | ! |
---|
[4646] | 471 | !-- Final values are obtained by division by the total number of grid points used for summation. |
---|
| 472 | !-- After that store profiles. |
---|
[132] | 473 | sums(:,1) = sums(:,1) / ngp_2dh(sr) |
---|
| 474 | sums(:,2) = sums(:,2) / ngp_2dh(sr) |
---|
| 475 | sums(:,4) = sums(:,4) / ngp_2dh_s_inner(:,sr) |
---|
[1] | 476 | hom(:,1,1,sr) = sums(:,1) ! u |
---|
| 477 | hom(:,1,2,sr) = sums(:,2) ! v |
---|
| 478 | hom(:,1,4,sr) = sums(:,4) ! pt |
---|
[4464] | 479 | !$ACC UPDATE DEVICE(hom(:,1,1,sr), hom(:,1,2,sr), hom(:,1,4,sr)) |
---|
| 480 | |
---|
| 481 | |
---|
[1] | 482 | ! |
---|
[96] | 483 | !-- Salinity |
---|
[3294] | 484 | IF ( ocean_mode ) THEN |
---|
[132] | 485 | sums(:,23) = sums(:,23) / ngp_2dh_s_inner(:,sr) |
---|
[96] | 486 | hom(:,1,23,sr) = sums(:,23) ! sa |
---|
| 487 | ENDIF |
---|
| 488 | |
---|
| 489 | ! |
---|
[1] | 490 | !-- Humidity and cloud parameters |
---|
[75] | 491 | IF ( humidity ) THEN |
---|
[132] | 492 | sums(:,44) = sums(:,44) / ngp_2dh_s_inner(:,sr) |
---|
| 493 | sums(:,41) = sums(:,41) / ngp_2dh_s_inner(:,sr) |
---|
[1] | 494 | hom(:,1,44,sr) = sums(:,44) ! vpt |
---|
| 495 | hom(:,1,41,sr) = sums(:,41) ! qv (q) |
---|
[3274] | 496 | IF ( bulk_cloud_model ) THEN |
---|
[132] | 497 | sums(:,42) = sums(:,42) / ngp_2dh_s_inner(:,sr) |
---|
| 498 | sums(:,43) = sums(:,43) / ngp_2dh_s_inner(:,sr) |
---|
[1] | 499 | hom(:,1,42,sr) = sums(:,42) ! qv |
---|
| 500 | hom(:,1,43,sr) = sums(:,43) ! pt |
---|
| 501 | ENDIF |
---|
| 502 | ENDIF |
---|
| 503 | |
---|
| 504 | ! |
---|
| 505 | !-- Passive scalar |
---|
[4646] | 506 | IF ( passive_scalar ) hom(:,1,115,sr) = sums(:,115) / ngp_2dh_s_inner(:,sr) ! s |
---|
[1] | 507 | |
---|
| 508 | ! |
---|
[4646] | 509 | !-- Horizontally averaged profiles of the remaining prognostic variables, variances, the total |
---|
| 510 | !-- and the perturbation energy (single values in last column of sums_l) and some diagnostic |
---|
| 511 | !-- quantities. |
---|
| 512 | !-- NOTE: for simplicity, nzb_s_inner is used below, although strictly speaking the following |
---|
| 513 | !-- ---- k-loop would have to be split up and rearranged according to the staggered grid. |
---|
| 514 | !-- However, this implies no error since staggered velocity components are zero at the |
---|
| 515 | !-- walls and inside buildings. |
---|
[1] | 516 | tn = 0 |
---|
[3241] | 517 | !$OMP PARALLEL PRIVATE( i, j, k, pts, sums_ll, & |
---|
[1815] | 518 | !$OMP sums_l_etot, tn, ust, ust2, u2, vst, vst2, v2, & |
---|
[2232] | 519 | !$OMP w2, flag, m, ki, l ) |
---|
| 520 | !$ tn = omp_get_thread_num() |
---|
[1] | 521 | !$OMP DO |
---|
[3658] | 522 | !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k, m) & |
---|
[4472] | 523 | !$ACC PRIVATE(sums_l_etot, flag, du_dx, du_dy, du_dz) & |
---|
| 524 | !$ACC PRIVATE(dv_dx, dv_dy, dv_dz, dw_dx, dw_dy, dw_dz) & |
---|
| 525 | !$ACC PRIVATE(s11, s21, s31, s12, s22, s32, s13, s23, s33) & |
---|
| 526 | !$ACC PRIVATE(dissipation, eta) & |
---|
[4346] | 527 | !$ACC PRESENT(wall_flags_total_0, rmask, momentumflux_output_conversion) & |
---|
[4472] | 528 | !$ACC PRESENT(hom(:,1,1:2,sr), hom(:,1,4,sr)) & |
---|
[3658] | 529 | !$ACC PRESENT(e, u, v, w, km, kh, p, pt) & |
---|
[4472] | 530 | !$ACC PRESENT(ddx, ddy, ddzu, ddzw) & |
---|
[4671] | 531 | !$ACC PRESENT(surf_def_h(0), surf_lsm_h(0), surf_usm_h(0)) & |
---|
[3658] | 532 | !$ACC PRESENT(sums_l) |
---|
[1] | 533 | DO i = nxl, nxr |
---|
| 534 | DO j = nys, nyn |
---|
[1353] | 535 | sums_l_etot = 0.0_wp |
---|
[2232] | 536 | DO k = nzb, nzt+1 |
---|
[4346] | 537 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[1] | 538 | ! |
---|
| 539 | !-- Prognostic and diagnostic variables |
---|
[3658] | 540 | !$ACC ATOMIC |
---|
[4646] | 541 | sums_l(k,3,tn) = sums_l(k,3,tn) + w(k,j,i) * rmask(j,i,sr) * flag |
---|
[4464] | 542 | !$ACC ATOMIC |
---|
[4646] | 543 | sums_l(k,8,tn) = sums_l(k,8,tn) + e(k,j,i) * rmask(j,i,sr) * flag |
---|
[3658] | 544 | !$ACC ATOMIC |
---|
[4646] | 545 | sums_l(k,9,tn) = sums_l(k,9,tn) + km(k,j,i) * rmask(j,i,sr) * flag |
---|
[3658] | 546 | !$ACC ATOMIC |
---|
[4646] | 547 | sums_l(k,10,tn) = sums_l(k,10,tn) + kh(k,j,i) * rmask(j,i,sr) * flag |
---|
[3658] | 548 | !$ACC ATOMIC |
---|
[4646] | 549 | sums_l(k,40,tn) = sums_l(k,40,tn) + ( p(k,j,i) & |
---|
| 550 | / momentumflux_output_conversion(k) ) * flag |
---|
[1] | 551 | |
---|
[3658] | 552 | !$ACC ATOMIC |
---|
[1] | 553 | sums_l(k,33,tn) = sums_l(k,33,tn) + & |
---|
[4646] | 554 | ( pt(k,j,i)-hom(k,1,4,sr) )**2 * rmask(j,i,sr) * flag |
---|
[3658] | 555 | #ifndef _OPENACC |
---|
[624] | 556 | IF ( humidity ) THEN |
---|
[4646] | 557 | sums_l(k,70,tn) = sums_l(k,70,tn) + & |
---|
| 558 | ( q(k,j,i)-hom(k,1,41,sr) )**2 * rmask(j,i,sr) * flag |
---|
[624] | 559 | ENDIF |
---|
[1960] | 560 | IF ( passive_scalar ) THEN |
---|
[4646] | 561 | sums_l(k,116,tn) = sums_l(k,116,tn) + & |
---|
| 562 | ( s(k,j,i)-hom(k,1,115,sr) )**2 * rmask(j,i,sr) * flag |
---|
[1960] | 563 | ENDIF |
---|
[3658] | 564 | #endif |
---|
[699] | 565 | ! |
---|
| 566 | !-- Higher moments |
---|
| 567 | !-- (Computation of the skewness of w further below) |
---|
[3658] | 568 | !$ACC ATOMIC |
---|
[4646] | 569 | sums_l(k,38,tn) = sums_l(k,38,tn) + w(k,j,i)**3 * rmask(j,i,sr) * flag |
---|
[667] | 570 | |
---|
[4646] | 571 | sums_l_etot = sums_l_etot + 0.5_wp * ( u(k,j,i)**2 + v(k,j,i)**2 + w(k,j,i)**2 ) & |
---|
| 572 | * rmask(j,i,sr) * flag |
---|
[4472] | 573 | |
---|
[1] | 574 | ! |
---|
[4646] | 575 | !-- Computation of the Kolmogorov length scale. Calculation is based on gradients of the |
---|
| 576 | !-- deviations from the horizontal mean. |
---|
[4472] | 577 | !-- Kolmogorov scale at the boundaries (k=0/z=0m and k=nzt+1) is set to zero. |
---|
| 578 | IF ( kolmogorov_length_scale .AND. k /= nzb .AND. k /= nzt+1) THEN |
---|
| 579 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
| 580 | |
---|
| 581 | ! |
---|
| 582 | !-- Calculate components of the fluctuating rate-of-strain tensor |
---|
[4646] | 583 | !-- (0.5*(del u'_i/del x_j + del u'_j/del x_i)) defined in the center of each grid |
---|
| 584 | !-- box. |
---|
| 585 | du_dx = ( ( u(k,j,i+1) - hom(k,1,1,sr) ) - & |
---|
[4472] | 586 | ( u(k,j,i) - hom(k,1,1,sr) ) ) * ddx |
---|
[4646] | 587 | du_dy = 0.25_wp * ddy * & |
---|
| 588 | ( ( u(k,j+1,i) - hom(k,1,1,sr) ) - & |
---|
| 589 | ( u(k,j-1,i) - hom(k,1,1,sr) ) + & |
---|
| 590 | ( u(k,j+1,i+1) - hom(k,1,1,sr) ) - & |
---|
[4472] | 591 | ( u(k,j-1,i+1) - hom(k,1,1,sr) ) ) |
---|
[4646] | 592 | du_dz = 0.25_wp * ( ( ( u(k+1,j,i) - hom(k+1,1,1,sr) ) - & |
---|
| 593 | ( u(k,j,i) - hom(k,1,1,sr) ) ) * & |
---|
| 594 | ddzu(k+1) + & |
---|
| 595 | ( ( u(k,j,i) - hom(k,1,1,sr) ) - & |
---|
| 596 | ( u(k-1,j,i) - hom(k-1,1,1,sr) ) ) * & |
---|
| 597 | ddzu(k) + & |
---|
| 598 | ( ( u(k+1,j,i+1) - hom(k+1,1,1,sr) ) - & |
---|
| 599 | ( u(k,j,i+1) - hom(k,1,1,sr) ) ) * & |
---|
| 600 | ddzu(k+1) + & |
---|
| 601 | ( ( u(k,j,i+1) - hom(k,1,1,sr) ) - & |
---|
| 602 | ( u(k-1,j,i+1) - hom(k-1,1,1,sr) ) ) * & |
---|
| 603 | ddzu(k) ) |
---|
[4472] | 604 | |
---|
[4646] | 605 | dv_dx = 0.25_wp * ddx * & |
---|
| 606 | ( ( v(k,j,i+1) - hom(k,1,2,sr) ) - & |
---|
| 607 | ( v(k,j,i-1) - hom(k,1,2,sr) ) + & |
---|
| 608 | ( v(k,j+1,i+1) - hom(k,1,2,sr) ) - & |
---|
[4472] | 609 | ( v(k,j+1,i-1) - hom(k,1,2,sr) ) ) |
---|
[4646] | 610 | dv_dy = ( ( v(k,j+1,i) - hom(k,1,2,sr) ) - ( v(k,j,i) - hom(k,1,2,sr) ) ) * ddy |
---|
| 611 | dv_dz = 0.25_wp * ( ( ( v(k+1,j,i) - hom(k+1,1,2,sr) ) - & |
---|
| 612 | ( v(k,j,i) - hom(k,1,2,sr) ) ) * & |
---|
| 613 | ddzu(k+1) + & |
---|
| 614 | ( ( v(k,j,i) - hom(k,1,2,sr) ) - & |
---|
| 615 | ( v(k-1,j,i) - hom(k-1,1,2,sr) ) ) * & |
---|
| 616 | ddzu(k) + & |
---|
| 617 | ( ( v(k+1,j+1,i) - hom(k+1,1,2,sr) ) - & |
---|
| 618 | ( v(k,j+1,i) - hom(k,1,2,sr) ) ) * & |
---|
| 619 | ddzu(k+1) + & |
---|
| 620 | ( ( v(k,j+1,i) - hom(k,1,2,sr) ) - & |
---|
| 621 | ( v(k-1,j+1,i) - hom(k-1,1,2,sr) ) ) * & |
---|
| 622 | ddzu(k) ) |
---|
[4472] | 623 | |
---|
[4646] | 624 | dw_dx = 0.25_wp * ddx * ( w(k,j,i+1) - w(k,j,i-1) + w(k-1,j,i+1) - w(k-1,j,i-1) ) |
---|
| 625 | dw_dy = 0.25_wp * ddy * ( w(k,j+1,i) - w(k,j-1,i) + w(k-1,j+1,i) - w(k-1,j-1,i) ) |
---|
[4472] | 626 | dw_dz = ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
| 627 | |
---|
| 628 | s11 = 0.5_wp * ( du_dx + du_dx ) |
---|
| 629 | s21 = 0.5_wp * ( dv_dx + du_dy ) |
---|
| 630 | s31 = 0.5_wp * ( dw_dx + du_dz ) |
---|
| 631 | |
---|
| 632 | s12 = s21 |
---|
| 633 | s22 = 0.5 * ( dv_dy + dv_dy ) |
---|
| 634 | s32 = 0.5 * ( dw_dy + dv_dz ) |
---|
| 635 | |
---|
| 636 | s13 = s31 |
---|
| 637 | s23 = s32 |
---|
| 638 | s33 = 0.5_wp * ( dw_dz + dw_dz ) |
---|
| 639 | |
---|
[4646] | 640 | !-- Calculate 3D instantaneous energy dissipation rate following Pope (2000): |
---|
| 641 | !-- Turbulent flows, p.259. It is defined in the center of each grid volume. |
---|
| 642 | dissipation = 2.0_wp * km(k,j,i) * & |
---|
| 643 | ( s11*s11 + s21*s21 + s31*s31 + & |
---|
| 644 | s12*s12 + s22*s22 + s32*s32 + & |
---|
| 645 | s13*s13 + s23*s23 + s33*s33 ) |
---|
[4472] | 646 | eta = ( km(k,j,i)**3.0_wp / ( dissipation+1.0E-12 ) )**(1.0_wp/4.0_wp) |
---|
| 647 | |
---|
| 648 | !$ACC ATOMIC |
---|
[4646] | 649 | sums_l(k,121,tn) = sums_l(k,121,tn) + eta * rmask(j,i,sr) * flag |
---|
[4472] | 650 | |
---|
| 651 | |
---|
| 652 | ENDIF !Kolmogorov length scale |
---|
| 653 | |
---|
| 654 | ENDDO !k-loop |
---|
| 655 | ! |
---|
[4646] | 656 | !-- Total and perturbation energy for the total domain (being collected in the last column |
---|
| 657 | !-- of sums_l). Summation of these quantities is seperated from the previous loop in order |
---|
| 658 | !-- to allow vectorization of that loop. |
---|
[3658] | 659 | !$ACC ATOMIC |
---|
[87] | 660 | sums_l(nzb+4,pr_palm,tn) = sums_l(nzb+4,pr_palm,tn) + sums_l_etot |
---|
[1] | 661 | ! |
---|
| 662 | !-- 2D-arrays (being collected in the last column of sums_l) |
---|
[4646] | 663 | IF ( surf_def_h(0)%end_index(j,i) >= surf_def_h(0)%start_index(j,i) ) THEN |
---|
[2232] | 664 | m = surf_def_h(0)%start_index(j,i) |
---|
[3658] | 665 | !$ACC ATOMIC |
---|
[4646] | 666 | sums_l(nzb,pr_palm,tn) = sums_l(nzb,pr_palm,tn) + & |
---|
| 667 | surf_def_h(0)%us(m) * rmask(j,i,sr) |
---|
[3658] | 668 | !$ACC ATOMIC |
---|
[4646] | 669 | sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) + & |
---|
| 670 | surf_def_h(0)%usws(m) * rmask(j,i,sr) |
---|
[3658] | 671 | !$ACC ATOMIC |
---|
[4646] | 672 | sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) + & |
---|
| 673 | surf_def_h(0)%vsws(m) * rmask(j,i,sr) |
---|
[3658] | 674 | !$ACC ATOMIC |
---|
[4646] | 675 | sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) + & |
---|
| 676 | surf_def_h(0)%ts(m) * rmask(j,i,sr) |
---|
[3658] | 677 | #ifndef _OPENACC |
---|
[2232] | 678 | IF ( humidity ) THEN |
---|
[4646] | 679 | sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) + & |
---|
| 680 | surf_def_h(0)%qs(m) * rmask(j,i,sr) |
---|
[2232] | 681 | ENDIF |
---|
| 682 | IF ( passive_scalar ) THEN |
---|
[4646] | 683 | sums_l(nzb+13,pr_palm,tn) = sums_l(nzb+13,pr_palm,tn) + & |
---|
| 684 | surf_def_h(0)%ss(m) * rmask(j,i,sr) |
---|
[2232] | 685 | ENDIF |
---|
[3658] | 686 | #endif |
---|
[2773] | 687 | ! |
---|
| 688 | !-- Summation of surface temperature. |
---|
[3658] | 689 | !$ACC ATOMIC |
---|
[4646] | 690 | sums_l(nzb+14,pr_palm,tn) = sums_l(nzb+14,pr_palm,tn) + & |
---|
| 691 | surf_def_h(0)%pt_surface(m) * rmask(j,i,sr) |
---|
[197] | 692 | ENDIF |
---|
[4671] | 693 | IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) ) THEN |
---|
| 694 | m = surf_lsm_h(0)%start_index(j,i) |
---|
[3658] | 695 | !$ACC ATOMIC |
---|
[4646] | 696 | sums_l(nzb,pr_palm,tn) = sums_l(nzb,pr_palm,tn) + & |
---|
[4671] | 697 | surf_lsm_h(0)%us(m) * rmask(j,i,sr) |
---|
[3658] | 698 | !$ACC ATOMIC |
---|
[4646] | 699 | sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) + & |
---|
[4671] | 700 | surf_lsm_h(0)%usws(m) * rmask(j,i,sr) |
---|
[3658] | 701 | !$ACC ATOMIC |
---|
[4646] | 702 | sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) + & |
---|
[4671] | 703 | surf_lsm_h(0)%vsws(m) * rmask(j,i,sr) |
---|
[3658] | 704 | !$ACC ATOMIC |
---|
[4646] | 705 | sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) + & |
---|
[4671] | 706 | surf_lsm_h(0)%ts(m) * rmask(j,i,sr) |
---|
[3658] | 707 | #ifndef _OPENACC |
---|
[2232] | 708 | IF ( humidity ) THEN |
---|
[4646] | 709 | sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) + & |
---|
[4671] | 710 | surf_lsm_h(0)%qs(m) * rmask(j,i,sr) |
---|
[2232] | 711 | ENDIF |
---|
| 712 | IF ( passive_scalar ) THEN |
---|
[4646] | 713 | sums_l(nzb+13,pr_palm,tn) = sums_l(nzb+13,pr_palm,tn) + & |
---|
[4671] | 714 | surf_lsm_h(0)%ss(m) * rmask(j,i,sr) |
---|
[2232] | 715 | ENDIF |
---|
[3658] | 716 | #endif |
---|
[2773] | 717 | ! |
---|
| 718 | !-- Summation of surface temperature. |
---|
[3658] | 719 | !$ACC ATOMIC |
---|
[4646] | 720 | sums_l(nzb+14,pr_palm,tn) = sums_l(nzb+14,pr_palm,tn) + & |
---|
[4671] | 721 | surf_lsm_h(0)%pt_surface(m) * rmask(j,i,sr) |
---|
[1960] | 722 | ENDIF |
---|
[4671] | 723 | IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) ) THEN |
---|
| 724 | m = surf_usm_h(0)%start_index(j,i) |
---|
[3658] | 725 | !$ACC ATOMIC |
---|
[4646] | 726 | sums_l(nzb,pr_palm,tn) = sums_l(nzb,pr_palm,tn) + & |
---|
[4671] | 727 | surf_usm_h(0)%us(m) * rmask(j,i,sr) |
---|
[3658] | 728 | !$ACC ATOMIC |
---|
[4646] | 729 | sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) + & |
---|
[4671] | 730 | surf_usm_h(0)%usws(m) * rmask(j,i,sr) |
---|
[3658] | 731 | !$ACC ATOMIC |
---|
[4646] | 732 | sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) + & |
---|
[4671] | 733 | surf_usm_h(0)%vsws(m) * rmask(j,i,sr) |
---|
[3658] | 734 | !$ACC ATOMIC |
---|
[4646] | 735 | sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) + & |
---|
[4671] | 736 | surf_usm_h(0)%ts(m) * rmask(j,i,sr) |
---|
[3658] | 737 | #ifndef _OPENACC |
---|
[2232] | 738 | IF ( humidity ) THEN |
---|
[4646] | 739 | sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) + & |
---|
[4671] | 740 | surf_usm_h(0)%qs(m) * rmask(j,i,sr) |
---|
[2232] | 741 | ENDIF |
---|
| 742 | IF ( passive_scalar ) THEN |
---|
[4646] | 743 | sums_l(nzb+13,pr_palm,tn) = sums_l(nzb+13,pr_palm,tn) + & |
---|
[4671] | 744 | surf_usm_h(0)%ss(m) * rmask(j,i,sr) |
---|
[2232] | 745 | ENDIF |
---|
[3658] | 746 | #endif |
---|
[2773] | 747 | ! |
---|
| 748 | !-- Summation of surface temperature. |
---|
[3658] | 749 | !$ACC ATOMIC |
---|
[4646] | 750 | sums_l(nzb+14,pr_palm,tn) = sums_l(nzb+14,pr_palm,tn) + & |
---|
[4671] | 751 | surf_usm_h(0)%pt_surface(m) * rmask(j,i,sr) |
---|
[2232] | 752 | ENDIF |
---|
[4472] | 753 | ENDDO !j-loop |
---|
| 754 | ENDDO !i-loop |
---|
[3658] | 755 | !$ACC UPDATE & |
---|
| 756 | !$ACC HOST(sums_l(:,3,tn), sums_l(:,8,tn), sums_l(:,9,tn)) & |
---|
| 757 | !$ACC HOST(sums_l(:,10,tn), sums_l(:,40,tn), sums_l(:,33,tn)) & |
---|
[4472] | 758 | !$ACC HOST(sums_l(:,38,tn), sums_l(:,121,tn)) & |
---|
[3658] | 759 | !$ACC HOST(sums_l(nzb:nzb+4,pr_palm,tn), sums_l(nzb+14:nzb+14,pr_palm,tn)) |
---|
[1] | 760 | |
---|
| 761 | ! |
---|
[4472] | 762 | !-- Computation of statistics when ws-scheme is not used. Else these |
---|
[667] | 763 | !-- quantities are evaluated in the advection routines. |
---|
[4646] | 764 | IF ( .NOT. ws_scheme_mom .OR. sr /= 0 .OR. simulated_time == 0.0_wp ) THEN |
---|
[667] | 765 | !$OMP DO |
---|
| 766 | DO i = nxl, nxr |
---|
| 767 | DO j = nys, nyn |
---|
[2232] | 768 | DO k = nzb, nzt+1 |
---|
[4346] | 769 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[2232] | 770 | |
---|
[667] | 771 | u2 = u(k,j,i)**2 |
---|
| 772 | v2 = v(k,j,i)**2 |
---|
| 773 | w2 = w(k,j,i)**2 |
---|
| 774 | ust2 = ( u(k,j,i) - hom(k,1,1,sr) )**2 |
---|
| 775 | vst2 = ( v(k,j,i) - hom(k,1,2,sr) )**2 |
---|
| 776 | |
---|
[4646] | 777 | sums_l(k,30,tn) = sums_l(k,30,tn) + ust2 * rmask(j,i,sr) * flag |
---|
| 778 | sums_l(k,31,tn) = sums_l(k,31,tn) + vst2 * rmask(j,i,sr) * flag |
---|
| 779 | sums_l(k,32,tn) = sums_l(k,32,tn) + w2 * rmask(j,i,sr) * flag |
---|
[667] | 780 | ! |
---|
[2026] | 781 | !-- Perturbation energy |
---|
[4646] | 782 | sums_l(k,34,tn) = sums_l(k,34,tn) + & |
---|
| 783 | 0.5_wp * ( ust2 + vst2 + w2 ) * rmask(j,i,sr) * flag |
---|
[667] | 784 | ENDDO |
---|
| 785 | ENDDO |
---|
| 786 | ENDDO |
---|
| 787 | ENDIF |
---|
[2026] | 788 | ! |
---|
[4646] | 789 | !-- Computaion of domain-averaged perturbation energy. Please note, to prevent that perturbation |
---|
| 790 | !-- energy is larger (even if only slightly) than the total kinetic energy, calculation is based |
---|
| 791 | !-- on deviations from the horizontal mean, instead of spatial descretization of the advection |
---|
[4472] | 792 | !-- term. |
---|
[2026] | 793 | !$OMP DO |
---|
[3658] | 794 | !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag, w2, ust2, vst2) & |
---|
[4346] | 795 | !$ACC PRESENT(wall_flags_total_0, u, v, w, rmask, hom(:,1,1:2,sr)) & |
---|
[3658] | 796 | !$ACC PRESENT(sums_l) |
---|
[2026] | 797 | DO i = nxl, nxr |
---|
| 798 | DO j = nys, nyn |
---|
[2232] | 799 | DO k = nzb, nzt+1 |
---|
[4346] | 800 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[2232] | 801 | |
---|
[2026] | 802 | w2 = w(k,j,i)**2 |
---|
| 803 | ust2 = ( u(k,j,i) - hom(k,1,1,sr) )**2 |
---|
| 804 | vst2 = ( v(k,j,i) - hom(k,1,2,sr) )**2 |
---|
| 805 | w2 = w(k,j,i)**2 |
---|
[1241] | 806 | |
---|
[3658] | 807 | !$ACC ATOMIC |
---|
[4646] | 808 | sums_l(nzb+5,pr_palm,tn) = sums_l(nzb+5,pr_palm,tn) & |
---|
| 809 | + 0.5_wp * ( ust2 + vst2 + w2 ) * rmask(j,i,sr) * flag |
---|
[4472] | 810 | |
---|
[2026] | 811 | ENDDO |
---|
| 812 | ENDDO |
---|
| 813 | ENDDO |
---|
[3658] | 814 | !$ACC UPDATE HOST(sums_l(nzb+5:nzb+5,pr_palm,tn)) |
---|
[2026] | 815 | |
---|
[667] | 816 | ! |
---|
[1] | 817 | !-- Horizontally averaged profiles of the vertical fluxes |
---|
| 818 | !$OMP DO |
---|
[3658] | 819 | !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k, l, m) & |
---|
| 820 | !$ACC PRIVATE(ki, flag, ust, vst, pts) & |
---|
| 821 | !$ACC PRESENT(kh, km, u, v, w, pt) & |
---|
[4346] | 822 | !$ACC PRESENT(wall_flags_total_0, rmask, ddzu, rho_air_zw, hom(:,1,1:4,sr)) & |
---|
[3658] | 823 | !$ACC PRESENT(heatflux_output_conversion, momentumflux_output_conversion) & |
---|
[4672] | 824 | !$ACC PRESENT(surf_def_h(0:2), surf_lsm_h(0:1), surf_usm_h(0:1)) & |
---|
[3658] | 825 | !$ACC PRESENT(sums_l) |
---|
[1] | 826 | DO i = nxl, nxr |
---|
| 827 | DO j = nys, nyn |
---|
| 828 | ! |
---|
[4646] | 829 | !-- Subgridscale fluxes (without Prandtl layer from k=nzb, oterwise from k=nzb+1) |
---|
| 830 | !-- NOTE: for simplicity, nzb_diff_s_inner is used below, although strictly speaking the |
---|
| 831 | !-- ---- following k-loop would have to be split up according to the staggered grid. |
---|
| 832 | !-- However, this implies no error since staggered velocity components are zero at |
---|
| 833 | !-- the walls and inside buildings. |
---|
| 834 | !-- Flag 23 is used to mask surface fluxes as well as model-top fluxes, which are added |
---|
| 835 | !-- further below. |
---|
[2232] | 836 | DO k = nzb, nzt |
---|
[4646] | 837 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 23 ) ) * & |
---|
| 838 | MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 9 ) ) |
---|
[1] | 839 | ! |
---|
| 840 | !-- Momentum flux w"u" |
---|
[3658] | 841 | !$ACC ATOMIC |
---|
[4646] | 842 | sums_l(k,12,tn) = sums_l(k,12,tn) - 0.25_wp * ( & |
---|
| 843 | km(k,j,i) + km(k+1,j,i) + km(k,j,i-1) + km(k+1,j,i-1) & |
---|
| 844 | ) * ( & |
---|
| 845 | ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 846 | + ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
| 847 | ) * rmask(j,i,sr) & |
---|
| 848 | * rho_air_zw(k) & |
---|
| 849 | * momentumflux_output_conversion(k) & |
---|
| 850 | * flag |
---|
[1] | 851 | ! |
---|
| 852 | !-- Momentum flux w"v" |
---|
[3658] | 853 | !$ACC ATOMIC |
---|
[4646] | 854 | sums_l(k,14,tn) = sums_l(k,14,tn) - 0.25_wp * ( & |
---|
| 855 | km(k,j,i) + km(k+1,j,i) + km(k,j-1,i) + km(k+1,j-1,i) & |
---|
| 856 | ) * ( & |
---|
| 857 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) & |
---|
| 858 | + ( w(k,j,i) - w(k,j-1,i) ) * ddy & |
---|
| 859 | ) * rmask(j,i,sr) & |
---|
| 860 | * rho_air_zw(k) & |
---|
| 861 | * momentumflux_output_conversion(k) & |
---|
| 862 | * flag |
---|
[1] | 863 | ! |
---|
| 864 | !-- Heat flux w"pt" |
---|
[3658] | 865 | !$ACC ATOMIC |
---|
[4646] | 866 | sums_l(k,16,tn) = sums_l(k,16,tn) & |
---|
| 867 | - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) ) & |
---|
| 868 | * ( pt(k+1,j,i) - pt(k,j,i) ) & |
---|
| 869 | * rho_air_zw(k) & |
---|
| 870 | * heatflux_output_conversion(k) & |
---|
| 871 | * ddzu(k+1) * rmask(j,i,sr) & |
---|
[2232] | 872 | * flag |
---|
[1] | 873 | |
---|
| 874 | ! |
---|
[96] | 875 | !-- Salinity flux w"sa" |
---|
[3658] | 876 | #ifndef _OPENACC |
---|
[3294] | 877 | IF ( ocean_mode ) THEN |
---|
[4646] | 878 | sums_l(k,65,tn) = sums_l(k,65,tn) & |
---|
| 879 | - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) ) & |
---|
| 880 | * ( sa(k+1,j,i) - sa(k,j,i) ) & |
---|
| 881 | * ddzu(k+1) * rmask(j,i,sr) & |
---|
[2232] | 882 | * flag |
---|
[96] | 883 | ENDIF |
---|
| 884 | |
---|
| 885 | ! |
---|
[1] | 886 | !-- Buoyancy flux, water flux (humidity flux) w"q" |
---|
[75] | 887 | IF ( humidity ) THEN |
---|
[4646] | 888 | sums_l(k,45,tn) = sums_l(k,45,tn) & |
---|
| 889 | - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) ) & |
---|
| 890 | * ( vpt(k+1,j,i) - vpt(k,j,i) ) & |
---|
| 891 | * rho_air_zw(k) & |
---|
| 892 | * heatflux_output_conversion(k) & |
---|
[2232] | 893 | * ddzu(k+1) * rmask(j,i,sr) * flag |
---|
[4646] | 894 | sums_l(k,48,tn) = sums_l(k,48,tn) & |
---|
| 895 | - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) ) & |
---|
| 896 | * ( q(k+1,j,i) - q(k,j,i) ) & |
---|
| 897 | * rho_air_zw(k) & |
---|
| 898 | * waterflux_output_conversion(k) & |
---|
[2232] | 899 | * ddzu(k+1) * rmask(j,i,sr) * flag |
---|
[1007] | 900 | |
---|
[3274] | 901 | IF ( bulk_cloud_model ) THEN |
---|
[4646] | 902 | sums_l(k,51,tn) = sums_l(k,51,tn) & |
---|
| 903 | - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) ) & |
---|
| 904 | * ( ( q(k+1,j,i) - ql(k+1,j,i) ) & |
---|
| 905 | - ( q(k,j,i) - ql(k,j,i) ) ) & |
---|
| 906 | * rho_air_zw(k) & |
---|
| 907 | * waterflux_output_conversion(k) & |
---|
[2232] | 908 | * ddzu(k+1) * rmask(j,i,sr) * flag |
---|
[1] | 909 | ENDIF |
---|
| 910 | ENDIF |
---|
| 911 | |
---|
| 912 | ! |
---|
| 913 | !-- Passive scalar flux |
---|
| 914 | IF ( passive_scalar ) THEN |
---|
[4646] | 915 | sums_l(k,117,tn) = sums_l(k,117,tn) & |
---|
| 916 | - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) ) & |
---|
| 917 | * ( s(k+1,j,i) - s(k,j,i) ) & |
---|
| 918 | * ddzu(k+1) * rmask(j,i,sr) & |
---|
[2232] | 919 | * flag |
---|
[1] | 920 | ENDIF |
---|
[3658] | 921 | #endif |
---|
[1] | 922 | |
---|
| 923 | ENDDO |
---|
| 924 | |
---|
| 925 | ! |
---|
| 926 | !-- Subgridscale fluxes in the Prandtl layer |
---|
| 927 | IF ( use_surface_fluxes ) THEN |
---|
[2232] | 928 | DO l = 0, 1 |
---|
[3658] | 929 | ! The original code using MERGE doesn't work with the PGI |
---|
| 930 | ! compiler when running on the GPU. |
---|
[3676] | 931 | ! This is submitted as a compiler Bug in PGI ticket TPR#26718 |
---|
[3658] | 932 | ! ki = MERGE( -1, 0, l == 0 ) |
---|
| 933 | ki = -1 + l |
---|
[2232] | 934 | IF ( surf_def_h(l)%ns >= 1 ) THEN |
---|
[4646] | 935 | DO m = surf_def_h(l)%start_index(j,i), & |
---|
[2696] | 936 | surf_def_h(l)%end_index(j,i) |
---|
[2232] | 937 | k = surf_def_h(l)%k(m) |
---|
| 938 | |
---|
[3658] | 939 | !$ACC ATOMIC |
---|
[4646] | 940 | sums_l(k+ki,12,tn) = sums_l(k+ki,12,tn) + & |
---|
| 941 | momentumflux_output_conversion(k+ki) * & |
---|
| 942 | surf_def_h(l)%usws(m) * rmask(j,i,sr) ! w"u" |
---|
[3658] | 943 | !$ACC ATOMIC |
---|
[4646] | 944 | sums_l(k+ki,14,tn) = sums_l(k+ki,14,tn) + & |
---|
| 945 | momentumflux_output_conversion(k+ki) * & |
---|
| 946 | surf_def_h(l)%vsws(m) * rmask(j,i,sr) ! w"v" |
---|
[3658] | 947 | !$ACC ATOMIC |
---|
[4646] | 948 | sums_l(k+ki,16,tn) = sums_l(k+ki,16,tn) + & |
---|
| 949 | heatflux_output_conversion(k+ki) * & |
---|
| 950 | surf_def_h(l)%shf(m) * rmask(j,i,sr) ! w"pt" |
---|
[3658] | 951 | #if 0 |
---|
[4646] | 952 | sums_l(k+ki,58,tn) = sums_l(k+ki,58,tn) + & |
---|
| 953 | 0.0_wp * rmask(j,i,sr) ! u"pt" |
---|
| 954 | sums_l(k+ki,61,tn) = sums_l(k+ki,61,tn) + & |
---|
| 955 | 0.0_wp * rmask(j,i,sr) ! v"pt" |
---|
[3658] | 956 | #endif |
---|
| 957 | #ifndef _OPENACC |
---|
[3294] | 958 | IF ( ocean_mode ) THEN |
---|
[4646] | 959 | sums_l(k+ki,65,tn) = sums_l(k+ki,65,tn) + & |
---|
| 960 | surf_def_h(l)%sasws(m) * rmask(j,i,sr) ! w"sa" |
---|
[2232] | 961 | ENDIF |
---|
| 962 | IF ( humidity ) THEN |
---|
[4646] | 963 | sums_l(k+ki,48,tn) = sums_l(k+ki,48,tn) + & |
---|
| 964 | waterflux_output_conversion(k+ki) * & |
---|
| 965 | surf_def_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
| 966 | sums_l(k+ki,45,tn) = sums_l(k+ki,45,tn) + ( & |
---|
| 967 | ( 1.0_wp + 0.61_wp * q(k+ki,j,i) ) * & |
---|
| 968 | surf_def_h(l)%shf(m) + 0.61_wp * pt(k+ki,j,i) * & |
---|
| 969 | surf_def_h(l)%qsws(m) ) & |
---|
| 970 | * heatflux_output_conversion(k+ki) |
---|
[2232] | 971 | IF ( cloud_droplets ) THEN |
---|
[4646] | 972 | sums_l(k+ki,45,tn) = sums_l(k+ki,45,tn) + ( & |
---|
| 973 | ( 1.0_wp + 0.61_wp * q(k+ki,j,i) - & |
---|
| 974 | ql(k+ki,j,i) ) * surf_def_h(l)%shf(m) + & |
---|
| 975 | 0.61_wp * pt(k+ki,j,i) & |
---|
| 976 | * surf_def_h(l)%qsws(m) ) & |
---|
| 977 | * heatflux_output_conversion(k+ki) |
---|
[2232] | 978 | ENDIF |
---|
[3274] | 979 | IF ( bulk_cloud_model ) THEN |
---|
[2232] | 980 | ! |
---|
| 981 | !-- Formula does not work if ql(k+ki) /= 0.0 |
---|
[4646] | 982 | sums_l(k+ki,51,tn) = sums_l(k+ki,51,tn) + & |
---|
| 983 | waterflux_output_conversion(k+ki) * & |
---|
| 984 | surf_def_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
[2232] | 985 | ENDIF |
---|
| 986 | ENDIF |
---|
| 987 | IF ( passive_scalar ) THEN |
---|
[4646] | 988 | sums_l(k+ki,117,tn) = sums_l(k+ki,117,tn) + & |
---|
| 989 | surf_def_h(l)%ssws(m) * rmask(j,i,sr) ! w"s" |
---|
[2232] | 990 | ENDIF |
---|
[3658] | 991 | #endif |
---|
[2232] | 992 | |
---|
| 993 | ENDDO |
---|
| 994 | |
---|
| 995 | ENDIF |
---|
[4671] | 996 | IF ( surf_lsm_h(l)%end_index(j,i) >= surf_lsm_h(l)%start_index(j,i) ) THEN |
---|
| 997 | m = surf_lsm_h(l)%start_index(j,i) |
---|
| 998 | !$ACC ATOMIC |
---|
| 999 | sums_l(nzb,12,tn) = sums_l(nzb,12,tn) + & |
---|
| 1000 | momentumflux_output_conversion(nzb) * & |
---|
| 1001 | surf_lsm_h(l)%usws(m) * rmask(j,i,sr) ! w"u" |
---|
| 1002 | !$ACC ATOMIC |
---|
| 1003 | sums_l(nzb,14,tn) = sums_l(nzb,14,tn) + & |
---|
| 1004 | momentumflux_output_conversion(nzb) * & |
---|
| 1005 | surf_lsm_h(l)%vsws(m) * rmask(j,i,sr) ! w"v" |
---|
| 1006 | !$ACC ATOMIC |
---|
| 1007 | sums_l(nzb,16,tn) = sums_l(nzb,16,tn) + & |
---|
| 1008 | heatflux_output_conversion(nzb) * & |
---|
| 1009 | surf_lsm_h(l)%shf(m) * rmask(j,i,sr) ! w"pt" |
---|
[3658] | 1010 | #if 0 |
---|
[4671] | 1011 | sums_l(nzb,58,tn) = sums_l(nzb,58,tn) + & |
---|
| 1012 | 0.0_wp * rmask(j,i,sr) ! u"pt" |
---|
| 1013 | sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + & |
---|
| 1014 | 0.0_wp * rmask(j,i,sr) ! v"pt" |
---|
[3658] | 1015 | #endif |
---|
| 1016 | #ifndef _OPENACC |
---|
[4671] | 1017 | IF ( ocean_mode ) THEN |
---|
| 1018 | sums_l(nzb,65,tn) = sums_l(nzb,65,tn) + & |
---|
| 1019 | surf_lsm_h(l)%sasws(m) * rmask(j,i,sr) ! w"sa" |
---|
| 1020 | ENDIF |
---|
| 1021 | IF ( humidity ) THEN |
---|
| 1022 | sums_l(nzb,48,tn) = sums_l(nzb,48,tn) + & |
---|
| 1023 | waterflux_output_conversion(nzb) * & |
---|
| 1024 | surf_lsm_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
| 1025 | sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + ( & |
---|
| 1026 | ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) * surf_lsm_h(l)%shf(m) + & |
---|
| 1027 | 0.61_wp * pt(nzb,j,i) * surf_lsm_h(l)%qsws(m) ) & |
---|
[4646] | 1028 | * heatflux_output_conversion(nzb) |
---|
[4671] | 1029 | IF ( cloud_droplets ) THEN |
---|
| 1030 | sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + ( & |
---|
| 1031 | ( 1.0_wp + 0.61_wp * q(nzb,j,i) - & |
---|
| 1032 | ql(nzb,j,i) ) * surf_lsm_h(l)%shf(m) + & |
---|
| 1033 | 0.61_wp * pt(nzb,j,i) * surf_lsm_h(l)%qsws(m) ) & |
---|
| 1034 | * heatflux_output_conversion(nzb) |
---|
| 1035 | ENDIF |
---|
| 1036 | IF ( bulk_cloud_model ) THEN |
---|
[2232] | 1037 | ! |
---|
[4671] | 1038 | !-- Formula does not work if ql(nzb) /= 0.0 |
---|
| 1039 | sums_l(nzb,51,tn) = sums_l(nzb,51,tn) + & |
---|
| 1040 | waterflux_output_conversion(nzb) * & |
---|
| 1041 | surf_lsm_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
| 1042 | ENDIF |
---|
[2232] | 1043 | ENDIF |
---|
[4671] | 1044 | IF ( passive_scalar ) THEN |
---|
| 1045 | sums_l(nzb,117,tn) = sums_l(nzb,117,tn) + & |
---|
| 1046 | surf_lsm_h(l)%ssws(m) * rmask(j,i,sr) ! w"s" |
---|
| 1047 | ENDIF |
---|
[3658] | 1048 | #endif |
---|
[2232] | 1049 | |
---|
[4671] | 1050 | ENDIF |
---|
| 1051 | IF ( surf_usm_h(l)%end_index(j,i) >= surf_usm_h(l)%start_index(j,i) ) THEN |
---|
| 1052 | m = surf_usm_h(l)%start_index(j,i) |
---|
| 1053 | !$ACC ATOMIC |
---|
| 1054 | sums_l(nzb,12,tn) = sums_l(nzb,12,tn) + & |
---|
| 1055 | momentumflux_output_conversion(nzb) * & |
---|
| 1056 | surf_usm_h(l)%usws(m) * rmask(j,i,sr) ! w"u" |
---|
| 1057 | !$ACC ATOMIC |
---|
| 1058 | sums_l(nzb,14,tn) = sums_l(nzb,14,tn) + & |
---|
| 1059 | momentumflux_output_conversion(nzb) * & |
---|
| 1060 | surf_usm_h(l)%vsws(m) * rmask(j,i,sr) ! w"v" |
---|
| 1061 | !$ACC ATOMIC |
---|
| 1062 | sums_l(nzb,16,tn) = sums_l(nzb,16,tn) + & |
---|
| 1063 | heatflux_output_conversion(nzb) * & |
---|
| 1064 | surf_usm_h(l)%shf(m) * rmask(j,i,sr) ! w"pt" |
---|
[3658] | 1065 | #if 0 |
---|
[4671] | 1066 | sums_l(nzb,58,tn) = sums_l(nzb,58,tn) + 0.0_wp * rmask(j,i,sr) ! u"pt" |
---|
| 1067 | sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + 0.0_wp * rmask(j,i,sr) ! v"pt" |
---|
[3658] | 1068 | #endif |
---|
| 1069 | #ifndef _OPENACC |
---|
[4671] | 1070 | IF ( ocean_mode ) THEN |
---|
| 1071 | sums_l(nzb,65,tn) = sums_l(nzb,65,tn) + & |
---|
| 1072 | surf_usm_h(l)%sasws(m) * rmask(j,i,sr) ! w"sa" |
---|
| 1073 | ENDIF |
---|
| 1074 | IF ( humidity ) THEN |
---|
| 1075 | sums_l(nzb,48,tn) = sums_l(nzb,48,tn) + & |
---|
| 1076 | waterflux_output_conversion(nzb) * & |
---|
| 1077 | surf_usm_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
| 1078 | sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + ( & |
---|
| 1079 | ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) * & |
---|
| 1080 | surf_usm_h(l)%shf(m) + 0.61_wp * pt(nzb,j,i) * & |
---|
| 1081 | surf_usm_h(l)%qsws(m) ) & |
---|
[4646] | 1082 | * heatflux_output_conversion(nzb) |
---|
[4671] | 1083 | IF ( cloud_droplets ) THEN |
---|
| 1084 | sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + ( & |
---|
| 1085 | ( 1.0_wp + 0.61_wp * q(nzb,j,i) - & |
---|
| 1086 | ql(nzb,j,i) ) * surf_usm_h(l)%shf(m) + & |
---|
| 1087 | 0.61_wp * pt(nzb,j,i) * surf_usm_h(l)%qsws(m) ) & |
---|
| 1088 | * heatflux_output_conversion(nzb) |
---|
| 1089 | ENDIF |
---|
| 1090 | IF ( bulk_cloud_model ) THEN |
---|
[1] | 1091 | ! |
---|
[4671] | 1092 | !-- Formula does not work if ql(nzb) /= 0.0 |
---|
| 1093 | sums_l(nzb,51,tn) = sums_l(nzb,51,tn) + & |
---|
| 1094 | waterflux_output_conversion(nzb) * & |
---|
| 1095 | surf_usm_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
| 1096 | ENDIF |
---|
[2232] | 1097 | ENDIF |
---|
[4671] | 1098 | IF ( passive_scalar ) THEN |
---|
| 1099 | sums_l(nzb,117,tn) = sums_l(nzb,117,tn) + & |
---|
| 1100 | surf_usm_h(l)%ssws(m) * rmask(j,i,sr) ! w"s" |
---|
| 1101 | ENDIF |
---|
[3658] | 1102 | #endif |
---|
[2232] | 1103 | |
---|
[4671] | 1104 | ENDIF |
---|
| 1105 | ENDDO |
---|
[1] | 1106 | ENDIF |
---|
| 1107 | |
---|
[3658] | 1108 | #ifndef _OPENACC |
---|
[1691] | 1109 | IF ( .NOT. neutral ) THEN |
---|
[4646] | 1110 | IF ( surf_def_h(0)%end_index(j,i) >= surf_def_h(0)%start_index(j,i) ) THEN |
---|
[2232] | 1111 | m = surf_def_h(0)%start_index(j,i) |
---|
[4646] | 1112 | sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_def_h(0)%ol(m) * rmask(j,i,sr) ! L |
---|
[2232] | 1113 | ENDIF |
---|
[4671] | 1114 | IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) ) THEN |
---|
| 1115 | m = surf_lsm_h(0)%start_index(j,i) |
---|
| 1116 | sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_lsm_h(0)%ol(m) * rmask(j,i,sr) ! L |
---|
[2232] | 1117 | ENDIF |
---|
[4671] | 1118 | IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) ) THEN |
---|
| 1119 | m = surf_usm_h(0)%start_index(j,i) |
---|
| 1120 | sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_usm_h(0)%ol(m) * rmask(j,i,sr) ! L |
---|
[2232] | 1121 | ENDIF |
---|
[1691] | 1122 | ENDIF |
---|
| 1123 | |
---|
[2296] | 1124 | IF ( radiation ) THEN |
---|
[4646] | 1125 | IF ( surf_def_h(0)%end_index(j,i) >= surf_def_h(0)%start_index(j,i) ) THEN |
---|
[2696] | 1126 | m = surf_def_h(0)%start_index(j,i) |
---|
[4646] | 1127 | sums_l(nzb,99,tn) = sums_l(nzb,99,tn) + & |
---|
| 1128 | surf_def_h(0)%rad_net(m) * rmask(j,i,sr) |
---|
| 1129 | sums_l(nzb,100,tn) = sums_l(nzb,100,tn) + & |
---|
| 1130 | surf_def_h(0)%rad_lw_in(m) * rmask(j,i,sr) |
---|
| 1131 | sums_l(nzb,101,tn) = sums_l(nzb,101,tn) + & |
---|
[2696] | 1132 | surf_def_h(0)%rad_lw_out(m) * rmask(j,i,sr) |
---|
[4646] | 1133 | sums_l(nzb,102,tn) = sums_l(nzb,102,tn) + & |
---|
| 1134 | surf_def_h(0)%rad_sw_in(m) * rmask(j,i,sr) |
---|
| 1135 | sums_l(nzb,103,tn) = sums_l(nzb,103,tn) + & |
---|
[2696] | 1136 | surf_def_h(0)%rad_sw_out(m) * rmask(j,i,sr) |
---|
| 1137 | ENDIF |
---|
[4671] | 1138 | IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) ) THEN |
---|
| 1139 | m = surf_lsm_h(0)%start_index(j,i) |
---|
[4646] | 1140 | sums_l(nzb,99,tn) = sums_l(nzb,99,tn) + & |
---|
[4671] | 1141 | surf_lsm_h(0)%rad_net(m) * rmask(j,i,sr) |
---|
[4646] | 1142 | sums_l(nzb,100,tn) = sums_l(nzb,100,tn) + & |
---|
[4671] | 1143 | surf_lsm_h(0)%rad_lw_in(m) * rmask(j,i,sr) |
---|
[4646] | 1144 | sums_l(nzb,101,tn) = sums_l(nzb,101,tn) + & |
---|
[4671] | 1145 | surf_lsm_h(0)%rad_lw_out(m) * rmask(j,i,sr) |
---|
[4646] | 1146 | sums_l(nzb,102,tn) = sums_l(nzb,102,tn) + & |
---|
[4671] | 1147 | surf_lsm_h(0)%rad_sw_in(m) * rmask(j,i,sr) |
---|
[4646] | 1148 | sums_l(nzb,103,tn) = sums_l(nzb,103,tn) + & |
---|
[4671] | 1149 | surf_lsm_h(0)%rad_sw_out(m) * rmask(j,i,sr) |
---|
[2696] | 1150 | ENDIF |
---|
[4671] | 1151 | IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) ) THEN |
---|
| 1152 | m = surf_usm_h(0)%start_index(j,i) |
---|
[4646] | 1153 | sums_l(nzb,99,tn) = sums_l(nzb,99,tn) + & |
---|
[4671] | 1154 | surf_usm_h(0)%rad_net(m) * rmask(j,i,sr) |
---|
[4646] | 1155 | sums_l(nzb,100,tn) = sums_l(nzb,100,tn) + & |
---|
[4671] | 1156 | surf_usm_h(0)%rad_lw_in(m) * rmask(j,i,sr) |
---|
[4646] | 1157 | sums_l(nzb,101,tn) = sums_l(nzb,101,tn) + & |
---|
[4671] | 1158 | surf_usm_h(0)%rad_lw_out(m) * rmask(j,i,sr) |
---|
[4646] | 1159 | sums_l(nzb,102,tn) = sums_l(nzb,102,tn) + & |
---|
[4671] | 1160 | surf_usm_h(0)%rad_sw_in(m) * rmask(j,i,sr) |
---|
[4646] | 1161 | sums_l(nzb,103,tn) = sums_l(nzb,103,tn) + & |
---|
[4671] | 1162 | surf_usm_h(0)%rad_sw_out(m) * rmask(j,i,sr) |
---|
[2696] | 1163 | ENDIF |
---|
[1585] | 1164 | |
---|
| 1165 | #if defined ( __rrtmg ) |
---|
| 1166 | IF ( radiation_scheme == 'rrtmg' ) THEN |
---|
[2696] | 1167 | |
---|
[4646] | 1168 | IF ( surf_def_h(0)%end_index(j,i) >= surf_def_h(0)%start_index(j,i) ) THEN |
---|
[2696] | 1169 | m = surf_def_h(0)%start_index(j,i) |
---|
[4646] | 1170 | sums_l(nzb,108,tn) = sums_l(nzb,108,tn) + & |
---|
| 1171 | surf_def_h(0)%rrtm_aldif(m,0) * rmask(j,i,sr) |
---|
| 1172 | sums_l(nzb,109,tn) = sums_l(nzb,109,tn) + & |
---|
| 1173 | surf_def_h(0)%rrtm_aldir(m,0) * rmask(j,i,sr) |
---|
| 1174 | sums_l(nzb,110,tn) = sums_l(nzb,110,tn) + & |
---|
| 1175 | surf_def_h(0)%rrtm_asdif(m,0) * rmask(j,i,sr) |
---|
| 1176 | sums_l(nzb,111,tn) = sums_l(nzb,111,tn) + & |
---|
| 1177 | surf_def_h(0)%rrtm_asdir(m,0) * rmask(j,i,sr) |
---|
[2696] | 1178 | ENDIF |
---|
[4671] | 1179 | IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) ) THEN |
---|
| 1180 | m = surf_lsm_h(0)%start_index(j,i) |
---|
[4646] | 1181 | sums_l(nzb,108,tn) = sums_l(nzb,108,tn) + & |
---|
[4671] | 1182 | SUM( surf_lsm_h(0)%frac(m,:) * & |
---|
| 1183 | surf_lsm_h(0)%rrtm_aldif(m,:) ) * rmask(j,i,sr) |
---|
[4646] | 1184 | sums_l(nzb,109,tn) = sums_l(nzb,109,tn) + & |
---|
[4671] | 1185 | SUM( surf_lsm_h(0)%frac(m,:) * & |
---|
| 1186 | surf_lsm_h(0)%rrtm_aldir(m,:) ) * rmask(j,i,sr) |
---|
[4646] | 1187 | sums_l(nzb,110,tn) = sums_l(nzb,110,tn) + & |
---|
[4671] | 1188 | SUM( surf_lsm_h(0)%frac(m,:) * & |
---|
| 1189 | surf_lsm_h(0)%rrtm_asdif(m,:) ) * rmask(j,i,sr) |
---|
[4646] | 1190 | sums_l(nzb,111,tn) = sums_l(nzb,111,tn) + & |
---|
[4671] | 1191 | SUM( surf_lsm_h(0)%frac(m,:) * & |
---|
| 1192 | surf_lsm_h(0)%rrtm_asdir(m,:) ) * rmask(j,i,sr) |
---|
[2696] | 1193 | ENDIF |
---|
[4671] | 1194 | IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) ) THEN |
---|
| 1195 | m = surf_usm_h(0)%start_index(j,i) |
---|
[4646] | 1196 | sums_l(nzb,108,tn) = sums_l(nzb,108,tn) + & |
---|
[4671] | 1197 | SUM( surf_usm_h(0)%frac(m,:) * & |
---|
| 1198 | surf_usm_h(0)%rrtm_aldif(m,:) ) * rmask(j,i,sr) |
---|
[4646] | 1199 | sums_l(nzb,109,tn) = sums_l(nzb,109,tn) + & |
---|
[4671] | 1200 | SUM( surf_usm_h(0)%frac(m,:) * & |
---|
| 1201 | surf_usm_h(0)%rrtm_aldir(m,:) ) * rmask(j,i,sr) |
---|
[4646] | 1202 | sums_l(nzb,110,tn) = sums_l(nzb,110,tn) + & |
---|
[4671] | 1203 | SUM( surf_usm_h(0)%frac(m,:) * & |
---|
| 1204 | surf_usm_h(0)%rrtm_asdif(m,:) ) * rmask(j,i,sr) |
---|
[4646] | 1205 | sums_l(nzb,111,tn) = sums_l(nzb,111,tn) + & |
---|
[4671] | 1206 | SUM( surf_usm_h(0)%frac(m,:) * & |
---|
| 1207 | surf_usm_h(0)%rrtm_asdir(m,:) ) * rmask(j,i,sr) |
---|
[2696] | 1208 | ENDIF |
---|
| 1209 | |
---|
[1585] | 1210 | ENDIF |
---|
| 1211 | #endif |
---|
[1551] | 1212 | ENDIF |
---|
[3658] | 1213 | #endif |
---|
[1] | 1214 | ! |
---|
[19] | 1215 | !-- Subgridscale fluxes at the top surface |
---|
| 1216 | IF ( use_top_fluxes ) THEN |
---|
[2232] | 1217 | m = surf_def_h(2)%start_index(j,i) |
---|
[3658] | 1218 | !$ACC ATOMIC |
---|
[4646] | 1219 | sums_l(nzt,12,tn) = sums_l(nzt,12,tn) + & |
---|
| 1220 | momentumflux_output_conversion(nzt) * & |
---|
[2232] | 1221 | surf_def_h(2)%usws(m) * rmask(j,i,sr) ! w"u" |
---|
[3658] | 1222 | !$ACC ATOMIC |
---|
[4646] | 1223 | sums_l(nzt+1,12,tn) = sums_l(nzt+1,12,tn) + & |
---|
| 1224 | momentumflux_output_conversion(nzt+1) * & |
---|
| 1225 | surf_def_h(2)%usws(m) * rmask(j,i,sr) ! w"u" |
---|
[3658] | 1226 | !$ACC ATOMIC |
---|
[4646] | 1227 | sums_l(nzt,14,tn) = sums_l(nzt,14,tn) + & |
---|
| 1228 | momentumflux_output_conversion(nzt) * & |
---|
[2232] | 1229 | surf_def_h(2)%vsws(m) * rmask(j,i,sr) ! w"v" |
---|
[3658] | 1230 | !$ACC ATOMIC |
---|
[4646] | 1231 | sums_l(nzt+1,14,tn) = sums_l(nzt+1,14,tn) + & |
---|
| 1232 | momentumflux_output_conversion(nzt+1) * & |
---|
| 1233 | surf_def_h(2)%vsws(m) * rmask(j,i,sr) ! w"v" |
---|
[3658] | 1234 | !$ACC ATOMIC |
---|
[4646] | 1235 | sums_l(nzt,16,tn) = sums_l(nzt,16,tn) + & |
---|
| 1236 | heatflux_output_conversion(nzt) * & |
---|
| 1237 | surf_def_h(2)%shf(m) * rmask(j,i,sr) ! w"pt" |
---|
[3658] | 1238 | !$ACC ATOMIC |
---|
[4646] | 1239 | sums_l(nzt+1,16,tn) = sums_l(nzt+1,16,tn) + & |
---|
| 1240 | heatflux_output_conversion(nzt+1) * & |
---|
| 1241 | surf_def_h(2)%shf(m) * rmask(j,i,sr) ! w"pt" |
---|
[3658] | 1242 | #if 0 |
---|
[4646] | 1243 | sums_l(nzt:nzt+1,58,tn) = sums_l(nzt:nzt+1,58,tn) + & |
---|
| 1244 | 0.0_wp * rmask(j,i,sr) ! u"pt" |
---|
| 1245 | sums_l(nzt:nzt+1,61,tn) = sums_l(nzt:nzt+1,61,tn) + & |
---|
| 1246 | 0.0_wp * rmask(j,i,sr) ! v"pt" |
---|
[3658] | 1247 | #endif |
---|
| 1248 | #ifndef _OPENACC |
---|
[3294] | 1249 | IF ( ocean_mode ) THEN |
---|
[96] | 1250 | sums_l(nzt,65,tn) = sums_l(nzt,65,tn) + & |
---|
[2232] | 1251 | surf_def_h(2)%sasws(m) * rmask(j,i,sr) ! w"sa" |
---|
[96] | 1252 | ENDIF |
---|
[75] | 1253 | IF ( humidity ) THEN |
---|
[4646] | 1254 | sums_l(nzt,48,tn) = sums_l(nzt,48,tn) + & |
---|
| 1255 | waterflux_output_conversion(nzt) * & |
---|
[2232] | 1256 | surf_def_h(2)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv") |
---|
[4646] | 1257 | sums_l(nzt,45,tn) = sums_l(nzt,45,tn) + ( & |
---|
| 1258 | ( 1.0_wp + 0.61_wp * q(nzt,j,i) ) * & |
---|
| 1259 | surf_def_h(2)%shf(m) + & |
---|
| 1260 | 0.61_wp * pt(nzt,j,i) * & |
---|
| 1261 | surf_def_h(2)%qsws(m) ) & |
---|
[2037] | 1262 | * heatflux_output_conversion(nzt) |
---|
[1007] | 1263 | IF ( cloud_droplets ) THEN |
---|
[4646] | 1264 | sums_l(nzt,45,tn) = sums_l(nzt,45,tn) + ( & |
---|
| 1265 | ( 1.0_wp + 0.61_wp * q(nzt,j,i) - & |
---|
| 1266 | ql(nzt,j,i) ) * & |
---|
| 1267 | surf_def_h(2)%shf(m) + & |
---|
| 1268 | 0.61_wp * pt(nzt,j,i) * & |
---|
| 1269 | surf_def_h(2)%qsws(m) ) & |
---|
[2037] | 1270 | * heatflux_output_conversion(nzt) |
---|
[1007] | 1271 | ENDIF |
---|
[3274] | 1272 | IF ( bulk_cloud_model ) THEN |
---|
[19] | 1273 | ! |
---|
| 1274 | !-- Formula does not work if ql(nzb) /= 0.0 |
---|
[4646] | 1275 | sums_l(nzt,51,tn) = sums_l(nzt,51,tn) + & ! w"q" (w"qv") |
---|
| 1276 | waterflux_output_conversion(nzt) * & |
---|
[2232] | 1277 | surf_def_h(2)%qsws(m) * rmask(j,i,sr) |
---|
[19] | 1278 | ENDIF |
---|
| 1279 | ENDIF |
---|
| 1280 | IF ( passive_scalar ) THEN |
---|
[4646] | 1281 | sums_l(nzt,117,tn) = sums_l(nzt,117,tn) + & |
---|
[2232] | 1282 | surf_def_h(2)%ssws(m) * rmask(j,i,sr) ! w"s" |
---|
[19] | 1283 | ENDIF |
---|
[3658] | 1284 | #endif |
---|
[19] | 1285 | ENDIF |
---|
| 1286 | |
---|
| 1287 | ! |
---|
[1] | 1288 | !-- Resolved fluxes (can be computed for all horizontal points) |
---|
[4646] | 1289 | !-- NOTE: for simplicity, nzb_s_inner is used below, although strictly speaking the |
---|
| 1290 | !-- ---- following k-loop would have to be split up and rearranged according to the |
---|
| 1291 | !-- staggered grid. |
---|
[2232] | 1292 | DO k = nzb, nzt |
---|
[4346] | 1293 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) ) |
---|
[4646] | 1294 | ust = 0.5_wp * ( u(k,j,i) - hom(k,1,1,sr) + & |
---|
[1353] | 1295 | u(k+1,j,i) - hom(k+1,1,1,sr) ) |
---|
[4646] | 1296 | vst = 0.5_wp * ( v(k,j,i) - hom(k,1,2,sr) + & |
---|
[1353] | 1297 | v(k+1,j,i) - hom(k+1,1,2,sr) ) |
---|
[4646] | 1298 | pts = 0.5_wp * ( pt(k,j,i) - hom(k,1,4,sr) + & |
---|
[1353] | 1299 | pt(k+1,j,i) - hom(k+1,1,4,sr) ) |
---|
[4646] | 1300 | ! |
---|
[1] | 1301 | !-- Higher moments |
---|
[3658] | 1302 | !$ACC ATOMIC |
---|
[4646] | 1303 | sums_l(k,35,tn) = sums_l(k,35,tn) + pts * w(k,j,i)**2 * rmask(j,i,sr) * flag |
---|
[3658] | 1304 | !$ACC ATOMIC |
---|
[4646] | 1305 | sums_l(k,36,tn) = sums_l(k,36,tn) + pts**2 * w(k,j,i) * rmask(j,i,sr) * flag |
---|
[1] | 1306 | |
---|
| 1307 | ! |
---|
[4646] | 1308 | !-- Salinity flux and density (density does not belong to here, but so far there is no |
---|
| 1309 | !-- other suitable place to calculate) |
---|
[3658] | 1310 | #ifndef _OPENACC |
---|
[3294] | 1311 | IF ( ocean_mode ) THEN |
---|
[1567] | 1312 | IF( .NOT. ws_scheme_sca .OR. sr /= 0 ) THEN |
---|
[4646] | 1313 | pts = 0.5_wp * ( sa(k,j,i) - hom(k,1,23,sr) + & |
---|
[1353] | 1314 | sa(k+1,j,i) - hom(k+1,1,23,sr) ) |
---|
[4646] | 1315 | sums_l(k,66,tn) = sums_l(k,66,tn) + pts * w(k,j,i) * & |
---|
[2232] | 1316 | rmask(j,i,sr) * flag |
---|
[667] | 1317 | ENDIF |
---|
[4646] | 1318 | sums_l(k,64,tn) = sums_l(k,64,tn) + rho_ocean(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1319 | sums_l(k,71,tn) = sums_l(k,71,tn) + prho(k,j,i) * rmask(j,i,sr) * flag |
---|
[96] | 1320 | ENDIF |
---|
| 1321 | |
---|
| 1322 | ! |
---|
[4646] | 1323 | !-- Buoyancy flux, water flux, humidity flux, liquid water content, rain drop |
---|
| 1324 | !-- concentration and rain water content |
---|
[75] | 1325 | IF ( humidity ) THEN |
---|
[4646] | 1326 | IF ( bulk_cloud_model .OR. cloud_droplets ) THEN |
---|
| 1327 | pts = 0.5_wp * ( vpt(k,j,i) - hom(k,1,44,sr) + & |
---|
| 1328 | vpt(k+1,j,i) - hom(k+1,1,44,sr) ) |
---|
| 1329 | sums_l(k,46,tn) = sums_l(k,46,tn) + pts * w(k,j,i) * & |
---|
| 1330 | rho_air_zw(k) * & |
---|
| 1331 | heatflux_output_conversion(k) * & |
---|
[2232] | 1332 | rmask(j,i,sr) * flag |
---|
[4646] | 1333 | sums_l(k,54,tn) = sums_l(k,54,tn) + ql(k,j,i) * rmask(j,i,sr) * flag |
---|
[1822] | 1334 | |
---|
[1053] | 1335 | IF ( .NOT. cloud_droplets ) THEN |
---|
[4646] | 1336 | pts = 0.5_wp * & |
---|
| 1337 | ( ( q(k,j,i) - ql(k,j,i) ) - & |
---|
| 1338 | hom(k,1,42,sr) + & |
---|
| 1339 | ( q(k+1,j,i) - ql(k+1,j,i) ) - & |
---|
| 1340 | hom(k+1,1,42,sr) ) |
---|
| 1341 | sums_l(k,52,tn) = sums_l(k,52,tn) + pts * w(k,j,i) * & |
---|
| 1342 | rho_air_zw(k) * & |
---|
| 1343 | waterflux_output_conversion(k) * & |
---|
| 1344 | rmask(j,i,sr) * flag |
---|
| 1345 | sums_l(k,75,tn) = sums_l(k,75,tn) + qc(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1346 | sums_l(k,76,tn) = sums_l(k,76,tn) + prr(k,j,i) * rmask(j,i,sr) * flag |
---|
[2292] | 1347 | IF ( microphysics_morrison ) THEN |
---|
[4646] | 1348 | sums_l(k,123,tn) = sums_l(k,123,tn) + nc(k,j,i) * rmask(j,i,sr) * flag |
---|
[2292] | 1349 | ENDIF |
---|
[4521] | 1350 | IF ( microphysics_ice_phase ) THEN |
---|
[4646] | 1351 | sums_l(k,124,tn) = sums_l(k,124,tn) + ni(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1352 | sums_l(k,125,tn) = sums_l(k,125,tn) + qi(k,j,i) * rmask(j,i,sr) * flag |
---|
[4502] | 1353 | ENDIF |
---|
| 1354 | |
---|
[1822] | 1355 | IF ( microphysics_seifert ) THEN |
---|
[4646] | 1356 | sums_l(k,73,tn) = sums_l(k,73,tn) + nr(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1357 | sums_l(k,74,tn) = sums_l(k,74,tn) + qr(k,j,i) * rmask(j,i,sr) * flag |
---|
[1053] | 1358 | ENDIF |
---|
| 1359 | ENDIF |
---|
[1822] | 1360 | |
---|
[1007] | 1361 | ELSE |
---|
[4646] | 1362 | IF( .NOT. ws_scheme_sca .OR. sr /= 0 ) THEN |
---|
| 1363 | pts = 0.5_wp * ( vpt(k,j,i) - hom(k,1,44,sr) + & |
---|
[1353] | 1364 | vpt(k+1,j,i) - hom(k+1,1,44,sr) ) |
---|
[4646] | 1365 | sums_l(k,46,tn) = sums_l(k,46,tn) + pts * w(k,j,i) * & |
---|
| 1366 | rho_air_zw(k) * & |
---|
| 1367 | heatflux_output_conversion(k) * & |
---|
| 1368 | rmask(j,i,sr) * flag |
---|
| 1369 | ELSE IF ( ws_scheme_sca .AND. sr == 0 ) THEN |
---|
| 1370 | sums_l(k,46,tn) = ( ( 1.0_wp + 0.61_wp * & |
---|
| 1371 | hom(k,1,41,sr) ) * & |
---|
| 1372 | sums_l(k,17,tn) + & |
---|
| 1373 | 0.61_wp * hom(k,1,4,sr) * & |
---|
| 1374 | sums_l(k,49,tn) & |
---|
| 1375 | ) * heatflux_output_conversion(k) * flag |
---|
[1007] | 1376 | END IF |
---|
| 1377 | END IF |
---|
[1] | 1378 | ENDIF |
---|
| 1379 | ! |
---|
| 1380 | !-- Passive scalar flux |
---|
[4646] | 1381 | IF ( passive_scalar .AND. ( .NOT. ws_scheme_sca .OR. sr /= 0 ) ) THEN |
---|
| 1382 | pts = 0.5_wp * ( s(k,j,i) - hom(k,1,115,sr) + & |
---|
[2270] | 1383 | s(k+1,j,i) - hom(k+1,1,115,sr) ) |
---|
[4646] | 1384 | sums_l(k,114,tn) = sums_l(k,114,tn) + pts * w(k,j,i) * rmask(j,i,sr) * flag |
---|
[1] | 1385 | ENDIF |
---|
[3658] | 1386 | #endif |
---|
[1] | 1387 | |
---|
| 1388 | ! |
---|
| 1389 | !-- Energy flux w*e* |
---|
[667] | 1390 | !-- has to be adjusted |
---|
[3658] | 1391 | !$ACC ATOMIC |
---|
[4646] | 1392 | sums_l(k,37,tn) = sums_l(k,37,tn) + w(k,j,i) * 0.5_wp * & |
---|
| 1393 | ( ust**2 + vst**2 + w(k,j,i)**2 ) & |
---|
| 1394 | * rho_air_zw(k) & |
---|
| 1395 | * momentumflux_output_conversion(k) & |
---|
| 1396 | * rmask(j,i,sr) * flag |
---|
[1] | 1397 | ENDDO |
---|
| 1398 | ENDDO |
---|
| 1399 | ENDDO |
---|
[2232] | 1400 | !$OMP END PARALLEL |
---|
[3658] | 1401 | |
---|
| 1402 | !$ACC UPDATE & |
---|
| 1403 | !$ACC HOST(sums_l(:,12,tn), sums_l(:,14,tn), sums_l(:,16,tn)) & |
---|
| 1404 | !$ACC HOST(sums_l(:,35,tn), sums_l(:,36,tn), sums_l(:,37,tn)) |
---|
[709] | 1405 | ! |
---|
[4472] | 1406 | !-- Treat land-surface quantities according to new wall model structure. |
---|
[2232] | 1407 | IF ( land_surface ) THEN |
---|
| 1408 | tn = 0 |
---|
| 1409 | !$OMP PARALLEL PRIVATE( i, j, m, tn ) |
---|
| 1410 | !$ tn = omp_get_thread_num() |
---|
| 1411 | !$OMP DO |
---|
[4671] | 1412 | DO m = 1, surf_lsm_h(0)%ns |
---|
| 1413 | i = surf_lsm_h(0)%i(m) |
---|
| 1414 | j = surf_lsm_h(0)%j(m) |
---|
[4472] | 1415 | |
---|
[4646] | 1416 | IF ( i >= nxl .AND. i <= nxr .AND. j >= nys .AND. j <= nyn ) THEN |
---|
[4671] | 1417 | sums_l(nzb,93,tn) = sums_l(nzb,93,tn) + surf_lsm_h(0)%ghf(m) * rmask(j,i,sr) |
---|
| 1418 | sums_l(nzb,94,tn) = sums_l(nzb,94,tn) + surf_lsm_h(0)%qsws_liq(m) * rmask(j,i,sr) |
---|
| 1419 | sums_l(nzb,95,tn) = sums_l(nzb,95,tn) + surf_lsm_h(0)%qsws_soil(m) * rmask(j,i,sr) |
---|
| 1420 | sums_l(nzb,96,tn) = sums_l(nzb,96,tn) + surf_lsm_h(0)%qsws_veg(m) * rmask(j,i,sr) |
---|
| 1421 | sums_l(nzb,97,tn) = sums_l(nzb,97,tn) + surf_lsm_h(0)%r_a(m) * rmask(j,i,sr) |
---|
| 1422 | sums_l(nzb,98,tn) = sums_l(nzb,98,tn) + surf_lsm_h(0)%r_s(m) * rmask(j,i,sr) |
---|
[2232] | 1423 | ENDIF |
---|
| 1424 | ENDDO |
---|
| 1425 | !$OMP END PARALLEL |
---|
| 1426 | |
---|
| 1427 | tn = 0 |
---|
| 1428 | !$OMP PARALLEL PRIVATE( i, j, k, m, tn ) |
---|
| 1429 | !$ tn = omp_get_thread_num() |
---|
| 1430 | !$OMP DO |
---|
[4671] | 1431 | DO m = 1, surf_lsm_h(0)%ns |
---|
[2232] | 1432 | |
---|
[4671] | 1433 | i = surf_lsm_h(0)%i(m) |
---|
| 1434 | j = surf_lsm_h(0)%j(m) |
---|
[2232] | 1435 | |
---|
[4646] | 1436 | IF ( i >= nxl .AND. i <= nxr .AND. j >= nys .AND. j <= nyn ) THEN |
---|
[2232] | 1437 | |
---|
| 1438 | DO k = nzb_soil, nzt_soil |
---|
[4671] | 1439 | sums_l(k,89,tn) = sums_l(k,89,tn) + t_soil_h(0)%var_2d(k,m) * rmask(j,i,sr) |
---|
| 1440 | sums_l(k,91,tn) = sums_l(k,91,tn) + m_soil_h(0)%var_2d(k,m) * rmask(j,i,sr) |
---|
[2232] | 1441 | ENDDO |
---|
| 1442 | ENDIF |
---|
| 1443 | ENDDO |
---|
| 1444 | !$OMP END PARALLEL |
---|
| 1445 | ENDIF |
---|
| 1446 | ! |
---|
[4646] | 1447 | !-- For speed optimization fluxes which have been computed in part directly inside the WS |
---|
| 1448 | !-- advection routines are treated seperatly. |
---|
[709] | 1449 | !-- Momentum fluxes first: |
---|
[2232] | 1450 | |
---|
| 1451 | tn = 0 |
---|
| 1452 | !$OMP PARALLEL PRIVATE( i, j, k, tn, flag ) |
---|
| 1453 | !$ tn = omp_get_thread_num() |
---|
[743] | 1454 | IF ( .NOT. ws_scheme_mom .OR. sr /= 0 ) THEN |
---|
[2232] | 1455 | !$OMP DO |
---|
| 1456 | DO i = nxl, nxr |
---|
| 1457 | DO j = nys, nyn |
---|
| 1458 | DO k = nzb, nzt |
---|
[1007] | 1459 | ! |
---|
[4646] | 1460 | !-- Flag 23 is used to mask surface fluxes as well as model-top fluxes, which are |
---|
| 1461 | !-- added further below. |
---|
| 1462 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 23 ) ) * & |
---|
| 1463 | MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 9 ) ) |
---|
[2232] | 1464 | |
---|
[4646] | 1465 | ust = 0.5_wp * ( u(k,j,i) - hom(k,1,1,sr) + & |
---|
[2232] | 1466 | u(k+1,j,i) - hom(k+1,1,1,sr) ) |
---|
[4646] | 1467 | vst = 0.5_wp * ( v(k,j,i) - hom(k,1,2,sr) + & |
---|
[2232] | 1468 | v(k+1,j,i) - hom(k+1,1,2,sr) ) |
---|
[667] | 1469 | ! |
---|
[2232] | 1470 | !-- Momentum flux w*u* |
---|
[4646] | 1471 | sums_l(k,13,tn) = sums_l(k,13,tn) + 0.5_wp * & |
---|
| 1472 | ( w(k,j,i-1) + w(k,j,i) ) & |
---|
| 1473 | * rho_air_zw(k) & |
---|
| 1474 | * momentumflux_output_conversion(k) & |
---|
| 1475 | * ust * rmask(j,i,sr) & |
---|
[2232] | 1476 | * flag |
---|
| 1477 | ! |
---|
| 1478 | !-- Momentum flux w*v* |
---|
[4646] | 1479 | sums_l(k,15,tn) = sums_l(k,15,tn) + 0.5_wp * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
| 1480 | * rho_air_zw(k) & |
---|
| 1481 | * momentumflux_output_conversion(k) & |
---|
| 1482 | * vst * rmask(j,i,sr) & |
---|
[2232] | 1483 | * flag |
---|
| 1484 | ENDDO |
---|
| 1485 | ENDDO |
---|
| 1486 | ENDDO |
---|
[1] | 1487 | |
---|
[667] | 1488 | ENDIF |
---|
[1567] | 1489 | IF ( .NOT. ws_scheme_sca .OR. sr /= 0 ) THEN |
---|
[2232] | 1490 | !$OMP DO |
---|
| 1491 | DO i = nxl, nxr |
---|
| 1492 | DO j = nys, nyn |
---|
| 1493 | DO k = nzb, nzt |
---|
[4646] | 1494 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 23 ) ) * & |
---|
| 1495 | MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 9 ) ) |
---|
[709] | 1496 | ! |
---|
[2232] | 1497 | !-- Vertical heat flux |
---|
[4646] | 1498 | sums_l(k,17,tn) = sums_l(k,17,tn) + 0.5_wp * & |
---|
| 1499 | ( pt(k,j,i) - hom(k,1,4,sr) + & |
---|
| 1500 | pt(k+1,j,i) - hom(k+1,1,4,sr) ) & |
---|
| 1501 | * rho_air_zw(k) & |
---|
| 1502 | * heatflux_output_conversion(k) & |
---|
| 1503 | * w(k,j,i) * rmask(j,i,sr) * flag |
---|
[2232] | 1504 | IF ( humidity ) THEN |
---|
[4646] | 1505 | pts = 0.5_wp * ( q(k,j,i) - hom(k,1,41,sr) + & |
---|
| 1506 | q(k+1,j,i) - hom(k+1,1,41,sr) ) |
---|
| 1507 | sums_l(k,49,tn) = sums_l(k,49,tn) + pts * w(k,j,i) * & |
---|
| 1508 | rho_air_zw(k) * & |
---|
| 1509 | waterflux_output_conversion(k) * & |
---|
| 1510 | rmask(j,i,sr) * flag |
---|
[2232] | 1511 | ENDIF |
---|
| 1512 | IF ( passive_scalar ) THEN |
---|
[4646] | 1513 | pts = 0.5_wp * ( s(k,j,i) - hom(k,1,115,sr) + & |
---|
| 1514 | s(k+1,j,i) - hom(k+1,1,115,sr) ) |
---|
| 1515 | sums_l(k,114,tn) = sums_l(k,114,tn) + pts * w(k,j,i) * rmask(j,i,sr) * flag |
---|
[2232] | 1516 | ENDIF |
---|
| 1517 | ENDDO |
---|
| 1518 | ENDDO |
---|
| 1519 | ENDDO |
---|
[667] | 1520 | |
---|
| 1521 | ENDIF |
---|
| 1522 | |
---|
[1] | 1523 | ! |
---|
[97] | 1524 | !-- Density at top follows Neumann condition |
---|
[3294] | 1525 | IF ( ocean_mode ) THEN |
---|
[388] | 1526 | sums_l(nzt+1,64,tn) = sums_l(nzt,64,tn) |
---|
| 1527 | sums_l(nzt+1,71,tn) = sums_l(nzt,71,tn) |
---|
| 1528 | ENDIF |
---|
[97] | 1529 | |
---|
| 1530 | ! |
---|
[4646] | 1531 | !-- Divergence of vertical flux of resolved scale energy and pressure fluctuations as well as |
---|
| 1532 | !-- flux of pressure fluctuation itself (68). |
---|
[106] | 1533 | !-- First calculate the products, then the divergence. |
---|
[1] | 1534 | !-- Calculation is time consuming. Do it only, if profiles shall be plotted. |
---|
[4646] | 1535 | IF ( hom(nzb+1,2,55,0) /= 0.0_wp .OR. hom(nzb+1,2,68,0) /= 0.0_wp ) THEN |
---|
[1353] | 1536 | sums_ll = 0.0_wp ! local array |
---|
[1] | 1537 | |
---|
| 1538 | !$OMP DO |
---|
| 1539 | DO i = nxl, nxr |
---|
| 1540 | DO j = nys, nyn |
---|
[2232] | 1541 | DO k = nzb+1, nzt |
---|
[4346] | 1542 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[1] | 1543 | |
---|
[4646] | 1544 | sums_ll(k,1) = sums_ll(k,1) + 0.5_wp * w(k,j,i) * ( & |
---|
| 1545 | ( 0.25_wp * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1) ) & |
---|
| 1546 | - 0.5_wp * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) ) )**2 & |
---|
| 1547 | + ( 0.25_wp * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i) ) & |
---|
| 1548 | - 0.5_wp * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) ) )**2 & |
---|
| 1549 | + w(k,j,i)**2 ) * flag * rmask(j,i,sr) |
---|
[1] | 1550 | |
---|
[4646] | 1551 | sums_ll(k,2) = sums_ll(k,2) + 0.5_wp * w(k,j,i) & |
---|
| 1552 | * ( ( p(k,j,i) + p(k+1,j,i) ) & |
---|
| 1553 | / momentumflux_output_conversion(k) ) & |
---|
[4551] | 1554 | * flag * rmask(j,i,sr) |
---|
[1] | 1555 | |
---|
| 1556 | ENDDO |
---|
| 1557 | ENDDO |
---|
| 1558 | ENDDO |
---|
[1353] | 1559 | sums_ll(0,1) = 0.0_wp ! because w is zero at the bottom |
---|
| 1560 | sums_ll(nzt+1,1) = 0.0_wp |
---|
| 1561 | sums_ll(0,2) = 0.0_wp |
---|
| 1562 | sums_ll(nzt+1,2) = 0.0_wp |
---|
[1] | 1563 | |
---|
[678] | 1564 | DO k = nzb+1, nzt |
---|
[1] | 1565 | sums_l(k,55,tn) = ( sums_ll(k,1) - sums_ll(k-1,1) ) * ddzw(k) |
---|
| 1566 | sums_l(k,56,tn) = ( sums_ll(k,2) - sums_ll(k-1,2) ) * ddzw(k) |
---|
[106] | 1567 | sums_l(k,68,tn) = sums_ll(k,2) |
---|
[1] | 1568 | ENDDO |
---|
| 1569 | sums_l(nzb,55,tn) = sums_l(nzb+1,55,tn) |
---|
| 1570 | sums_l(nzb,56,tn) = sums_l(nzb+1,56,tn) |
---|
[1353] | 1571 | sums_l(nzb,68,tn) = 0.0_wp ! because w* = 0 at nzb |
---|
[1] | 1572 | |
---|
| 1573 | ENDIF |
---|
| 1574 | |
---|
| 1575 | ! |
---|
[106] | 1576 | !-- Divergence of vertical flux of SGS TKE and the flux itself (69) |
---|
[4646] | 1577 | IF ( hom(nzb+1,2,57,0) /= 0.0_wp .OR. hom(nzb+1,2,69,0) /= 0.0_wp ) THEN |
---|
[1] | 1578 | !$OMP DO |
---|
| 1579 | DO i = nxl, nxr |
---|
| 1580 | DO j = nys, nyn |
---|
[2232] | 1581 | DO k = nzb+1, nzt |
---|
[1] | 1582 | |
---|
[4346] | 1583 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[2232] | 1584 | |
---|
[4646] | 1585 | sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5_wp * ( & |
---|
| 1586 | (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) & |
---|
| 1587 | - (km(k-1,j,i)+km(k,j,i)) * (e(k,j,i)-e(k-1,j,i)) * ddzu(k) & |
---|
| 1588 | ) * ddzw(k) & |
---|
[4551] | 1589 | * flag * rmask(j,i,sr) |
---|
[1] | 1590 | |
---|
[4646] | 1591 | sums_l(k,69,tn) = sums_l(k,69,tn) - 0.5_wp * ( & |
---|
| 1592 | ( km(k,j,i) + km(k+1,j,i) ) * & |
---|
| 1593 | ( e(k+1,j,i) - e(k,j,i) ) * ddzu(k+1) & |
---|
| 1594 | ) * flag * rmask(j,i,sr) |
---|
[106] | 1595 | |
---|
[1] | 1596 | ENDDO |
---|
| 1597 | ENDDO |
---|
| 1598 | ENDDO |
---|
| 1599 | sums_l(nzb,57,tn) = sums_l(nzb+1,57,tn) |
---|
[106] | 1600 | sums_l(nzb,69,tn) = sums_l(nzb+1,69,tn) |
---|
[1] | 1601 | |
---|
| 1602 | ENDIF |
---|
| 1603 | |
---|
| 1604 | ! |
---|
[4472] | 1605 | !-- Horizontal heat fluxes (subgrid, resolved, total). |
---|
| 1606 | !-- Do it only, if profiles shall be plotted. |
---|
[1353] | 1607 | IF ( hom(nzb+1,2,58,0) /= 0.0_wp ) THEN |
---|
[1] | 1608 | |
---|
| 1609 | !$OMP DO |
---|
| 1610 | DO i = nxl, nxr |
---|
| 1611 | DO j = nys, nyn |
---|
[2232] | 1612 | DO k = nzb+1, nzt |
---|
[4346] | 1613 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[1] | 1614 | ! |
---|
| 1615 | !-- Subgrid horizontal heat fluxes u"pt", v"pt" |
---|
[4646] | 1616 | sums_l(k,58,tn) = sums_l(k,58,tn) - 0.5_wp * & |
---|
| 1617 | ( kh(k,j,i) + kh(k,j,i-1) ) & |
---|
| 1618 | * ( pt(k,j,i-1) - pt(k,j,i) ) & |
---|
| 1619 | * rho_air_zw(k) & |
---|
| 1620 | * heatflux_output_conversion(k) & |
---|
| 1621 | * ddx * rmask(j,i,sr) * flag |
---|
| 1622 | sums_l(k,61,tn) = sums_l(k,61,tn) - 0.5_wp * & |
---|
| 1623 | ( kh(k,j,i) + kh(k,j-1,i) ) & |
---|
| 1624 | * ( pt(k,j-1,i) - pt(k,j,i) ) & |
---|
| 1625 | * rho_air_zw(k) & |
---|
| 1626 | * heatflux_output_conversion(k) & |
---|
| 1627 | * ddy * rmask(j,i,sr) * flag |
---|
[1] | 1628 | ! |
---|
| 1629 | !-- Resolved horizontal heat fluxes u*pt*, v*pt* |
---|
[4646] | 1630 | sums_l(k,59,tn) = sums_l(k,59,tn) + ( u(k,j,i) - hom(k,1,1,sr) ) & |
---|
| 1631 | * 0.5_wp * ( pt(k,j,i-1) - hom(k,1,4,sr) + & |
---|
| 1632 | pt(k,j,i) - hom(k,1,4,sr) ) & |
---|
| 1633 | * heatflux_output_conversion(k) & |
---|
| 1634 | * flag |
---|
| 1635 | pts = 0.5_wp * ( pt(k,j-1,i) - hom(k,1,4,sr) + & |
---|
[1353] | 1636 | pt(k,j,i) - hom(k,1,4,sr) ) |
---|
[4646] | 1637 | sums_l(k,62,tn) = sums_l(k,62,tn) + ( v(k,j,i) - hom(k,1,2,sr) ) & |
---|
| 1638 | * 0.5_wp * ( pt(k,j-1,i) - hom(k,1,4,sr) + & |
---|
| 1639 | pt(k,j,i) - hom(k,1,4,sr) ) & |
---|
| 1640 | * heatflux_output_conversion(k) & |
---|
| 1641 | * flag |
---|
[1] | 1642 | ENDDO |
---|
| 1643 | ENDDO |
---|
| 1644 | ENDDO |
---|
| 1645 | ! |
---|
| 1646 | !-- Fluxes at the surface must be zero (e.g. due to the Prandtl-layer) |
---|
[1353] | 1647 | sums_l(nzb,58,tn) = 0.0_wp |
---|
| 1648 | sums_l(nzb,59,tn) = 0.0_wp |
---|
| 1649 | sums_l(nzb,60,tn) = 0.0_wp |
---|
| 1650 | sums_l(nzb,61,tn) = 0.0_wp |
---|
| 1651 | sums_l(nzb,62,tn) = 0.0_wp |
---|
| 1652 | sums_l(nzb,63,tn) = 0.0_wp |
---|
[1] | 1653 | |
---|
| 1654 | ENDIF |
---|
[2073] | 1655 | !$OMP END PARALLEL |
---|
[87] | 1656 | |
---|
| 1657 | ! |
---|
[1365] | 1658 | !-- Collect current large scale advection and subsidence tendencies for |
---|
| 1659 | !-- data output |
---|
[1691] | 1660 | IF ( large_scale_forcing .AND. ( simulated_time > 0.0_wp ) ) THEN |
---|
[1365] | 1661 | ! |
---|
[4472] | 1662 | !-- Interpolation in time of LSF_DATA |
---|
[1365] | 1663 | nt = 1 |
---|
[1386] | 1664 | DO WHILE ( simulated_time - dt_3d > time_vert(nt) ) |
---|
[1365] | 1665 | nt = nt + 1 |
---|
| 1666 | ENDDO |
---|
[1386] | 1667 | IF ( simulated_time - dt_3d /= time_vert(nt) ) THEN |
---|
[1365] | 1668 | nt = nt - 1 |
---|
| 1669 | ENDIF |
---|
| 1670 | |
---|
[4646] | 1671 | fac = ( simulated_time - dt_3d - time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) ) |
---|
[1365] | 1672 | |
---|
| 1673 | |
---|
| 1674 | DO k = nzb, nzt |
---|
[4646] | 1675 | sums_ls_l(k,0) = td_lsa_lpt(k,nt) + fac * ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) ) |
---|
| 1676 | sums_ls_l(k,1) = td_lsa_q(k,nt) + fac * ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) ) |
---|
[1365] | 1677 | ENDDO |
---|
| 1678 | |
---|
[1382] | 1679 | sums_ls_l(nzt+1,0) = sums_ls_l(nzt,0) |
---|
| 1680 | sums_ls_l(nzt+1,1) = sums_ls_l(nzt,1) |
---|
| 1681 | |
---|
[4646] | 1682 | IF ( large_scale_subsidence .AND. use_subsidence_tendencies ) THEN |
---|
[1365] | 1683 | |
---|
| 1684 | DO k = nzb, nzt |
---|
[4646] | 1685 | sums_ls_l(k,2) = td_sub_lpt(k,nt) + fac * ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) ) |
---|
| 1686 | sums_ls_l(k,3) = td_sub_q(k,nt) + fac * ( td_sub_q(k,nt+1) - td_sub_q(k,nt) ) |
---|
[1365] | 1687 | ENDDO |
---|
| 1688 | |
---|
[1382] | 1689 | sums_ls_l(nzt+1,2) = sums_ls_l(nzt,2) |
---|
| 1690 | sums_ls_l(nzt+1,3) = sums_ls_l(nzt,3) |
---|
| 1691 | |
---|
[1365] | 1692 | ENDIF |
---|
| 1693 | |
---|
| 1694 | ENDIF |
---|
| 1695 | |
---|
[2232] | 1696 | tn = 0 |
---|
[2073] | 1697 | !$OMP PARALLEL PRIVATE( i, j, k, tn ) |
---|
[4472] | 1698 | !$ tn = omp_get_thread_num() |
---|
[4646] | 1699 | IF ( radiation .AND. radiation_scheme == 'rrtmg' ) THEN |
---|
[1585] | 1700 | !$OMP DO |
---|
| 1701 | DO i = nxl, nxr |
---|
| 1702 | DO j = nys, nyn |
---|
[2232] | 1703 | DO k = nzb+1, nzt+1 |
---|
[4346] | 1704 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[2232] | 1705 | |
---|
[4646] | 1706 | sums_l(k,100,tn) = sums_l(k,100,tn) + rad_lw_in(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1707 | sums_l(k,101,tn) = sums_l(k,101,tn) + rad_lw_out(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1708 | sums_l(k,102,tn) = sums_l(k,102,tn) + rad_sw_in(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1709 | sums_l(k,103,tn) = sums_l(k,103,tn) + rad_sw_out(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1710 | sums_l(k,104,tn) = sums_l(k,104,tn) + rad_lw_cs_hr(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1711 | sums_l(k,105,tn) = sums_l(k,105,tn) + rad_lw_hr(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1712 | sums_l(k,106,tn) = sums_l(k,106,tn) + rad_sw_cs_hr(k,j,i) * rmask(j,i,sr) * flag |
---|
| 1713 | sums_l(k,107,tn) = sums_l(k,107,tn) + rad_sw_hr(k,j,i) * rmask(j,i,sr) * flag |
---|
[1585] | 1714 | ENDDO |
---|
| 1715 | ENDDO |
---|
| 1716 | ENDDO |
---|
| 1717 | ENDIF |
---|
[3637] | 1718 | |
---|
[1365] | 1719 | ! |
---|
[3637] | 1720 | !-- Calculate the profiles for all other modules |
---|
| 1721 | CALL module_interface_statistics( 'profiles', sr, tn, dots_max ) |
---|
[3651] | 1722 | !$OMP END PARALLEL |
---|
[1] | 1723 | |
---|
| 1724 | ! |
---|
| 1725 | !-- Summation of thread sums |
---|
| 1726 | IF ( threads_per_task > 1 ) THEN |
---|
| 1727 | DO i = 1, threads_per_task-1 |
---|
[4464] | 1728 | sums_l(:,3,0) = sums_l(:,3,0) + sums_l(:,3,i) |
---|
[1] | 1729 | sums_l(:,4:40,0) = sums_l(:,4:40,0) + sums_l(:,4:40,i) |
---|
[87] | 1730 | sums_l(:,45:pr_palm,0) = sums_l(:,45:pr_palm,0) + & |
---|
| 1731 | sums_l(:,45:pr_palm,i) |
---|
| 1732 | IF ( max_pr_user > 0 ) THEN |
---|
[4646] | 1733 | sums_l(:,pr_palm+1:pr_palm+max_pr_user,0) = & |
---|
| 1734 | sums_l(:,pr_palm+1:pr_palm+max_pr_user,0) + & |
---|
| 1735 | sums_l(:,pr_palm+1:pr_palm+max_pr_user,i) |
---|
[87] | 1736 | ENDIF |
---|
[3298] | 1737 | |
---|
| 1738 | IF ( air_chemistry ) THEN |
---|
[4472] | 1739 | IF ( max_pr_cs > 0 ) THEN |
---|
[3298] | 1740 | sums_l(:,pr_palm+max_pr_user+1:pr_palm + max_pr_user+ max_pr_cs,0) = & |
---|
| 1741 | sums_l(:,pr_palm+max_pr_user+1:pr_palm + max_pr_user+max_pr_cs,0) + & |
---|
| 1742 | sums_l(:,pr_palm+max_pr_user+1:pr_palm + max_pr_user+max_pr_cs,i) |
---|
| 1743 | |
---|
| 1744 | ENDIF |
---|
| 1745 | ENDIF |
---|
[4131] | 1746 | IF ( salsa ) THEN |
---|
| 1747 | IF ( max_pr_cs > 0 ) THEN |
---|
| 1748 | sums_l(:,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0) = & |
---|
| 1749 | sums_l(:,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0) + & |
---|
| 1750 | sums_l(:,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,i) |
---|
| 1751 | |
---|
| 1752 | ENDIF |
---|
| 1753 | ENDIF |
---|
[1] | 1754 | ENDDO |
---|
| 1755 | ENDIF |
---|
| 1756 | |
---|
| 1757 | #if defined( __parallel ) |
---|
[667] | 1758 | |
---|
[1] | 1759 | ! |
---|
| 1760 | !-- Compute total sum from local sums |
---|
[622] | 1761 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4646] | 1762 | CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), ngp_sums, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
[1365] | 1763 | IF ( large_scale_forcing ) THEN |
---|
[4646] | 1764 | CALL MPI_ALLREDUCE( sums_ls_l(nzb,2), sums(nzb,83), ngp_sums_ls, MPI_REAL, MPI_SUM, & |
---|
| 1765 | comm2d, ierr ) |
---|
[1365] | 1766 | ENDIF |
---|
[3298] | 1767 | |
---|
[3458] | 1768 | IF ( air_chemistry .AND. max_pr_cs > 0 ) THEN |
---|
[3298] | 1769 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4581] | 1770 | DO i = 1, max_pr_cs |
---|
[4646] | 1771 | CALL MPI_ALLREDUCE( sums_l(nzb,pr_palm+max_pr_user+i,0), & |
---|
| 1772 | sums(nzb,pr_palm+max_pr_user+i), & |
---|
[4581] | 1773 | nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1774 | ENDDO |
---|
[3298] | 1775 | ENDIF |
---|
| 1776 | |
---|
[4131] | 1777 | IF ( salsa .AND. max_pr_salsa > 0 ) THEN |
---|
| 1778 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4581] | 1779 | DO i = 1, max_pr_salsa |
---|
| 1780 | CALL MPI_ALLREDUCE( sums_l(nzb,pr_palm+max_pr_user+max_pr_cs+i,0), & |
---|
| 1781 | sums(nzb,pr_palm+max_pr_user+max_pr_user+i), & |
---|
| 1782 | nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1783 | ENDDO |
---|
[4131] | 1784 | ENDIF |
---|
| 1785 | |
---|
[1] | 1786 | #else |
---|
| 1787 | sums = sums_l(:,:,0) |
---|
[1365] | 1788 | IF ( large_scale_forcing ) THEN |
---|
| 1789 | sums(:,81:88) = sums_ls_l |
---|
| 1790 | ENDIF |
---|
[1] | 1791 | #endif |
---|
| 1792 | |
---|
| 1793 | ! |
---|
[4646] | 1794 | !-- Final values are obtained by division by the total number of grid points used for summation. |
---|
| 1795 | !-- After that store profiles. |
---|
| 1796 | !-- Check, if statistical regions do contain at least one grid point at the respective k-level, |
---|
| 1797 | !-- otherwise division by zero will lead to undefined values, which may cause e.g. problems with |
---|
| 1798 | !-- NetCDF output. |
---|
[1] | 1799 | !-- Profiles: |
---|
| 1800 | DO k = nzb, nzt+1 |
---|
[4464] | 1801 | sums(k,3) = sums(k,3) / ngp_2dh(sr) |
---|
[1738] | 1802 | sums(k,12:22) = sums(k,12:22) / ngp_2dh(sr) |
---|
| 1803 | sums(k,30:32) = sums(k,30:32) / ngp_2dh(sr) |
---|
| 1804 | sums(k,35:39) = sums(k,35:39) / ngp_2dh(sr) |
---|
| 1805 | sums(k,45:53) = sums(k,45:53) / ngp_2dh(sr) |
---|
| 1806 | sums(k,55:63) = sums(k,55:63) / ngp_2dh(sr) |
---|
| 1807 | sums(k,81:88) = sums(k,81:88) / ngp_2dh(sr) |
---|
[2270] | 1808 | sums(k,89:112) = sums(k,89:112) / ngp_2dh(sr) |
---|
| 1809 | sums(k,114) = sums(k,114) / ngp_2dh(sr) |
---|
| 1810 | sums(k,117) = sums(k,117) / ngp_2dh(sr) |
---|
[1738] | 1811 | IF ( ngp_2dh_s_inner(k,sr) /= 0 ) THEN |
---|
| 1812 | sums(k,8:11) = sums(k,8:11) / ngp_2dh_s_inner(k,sr) |
---|
| 1813 | sums(k,23:29) = sums(k,23:29) / ngp_2dh_s_inner(k,sr) |
---|
| 1814 | sums(k,33:34) = sums(k,33:34) / ngp_2dh_s_inner(k,sr) |
---|
| 1815 | sums(k,40) = sums(k,40) / ngp_2dh_s_inner(k,sr) |
---|
| 1816 | sums(k,54) = sums(k,54) / ngp_2dh_s_inner(k,sr) |
---|
| 1817 | sums(k,64) = sums(k,64) / ngp_2dh_s_inner(k,sr) |
---|
| 1818 | sums(k,70:80) = sums(k,70:80) / ngp_2dh_s_inner(k,sr) |
---|
[2270] | 1819 | sums(k,116) = sums(k,116) / ngp_2dh_s_inner(k,sr) |
---|
| 1820 | sums(k,118:pr_palm-2) = sums(k,118:pr_palm-2) / ngp_2dh_s_inner(k,sr) |
---|
[4502] | 1821 | sums(k,123:125) = sums(k,123:125) * ngp_2dh_s_inner(k,sr) / ngp_2dh(sr) |
---|
[1738] | 1822 | ENDIF |
---|
[1] | 1823 | ENDDO |
---|
[667] | 1824 | |
---|
[1] | 1825 | !-- u* and so on |
---|
[4646] | 1826 | !-- As sums(nzb:nzb+3,pr_palm) are full 2D arrays (us, usws, vsws, ts) whose size is always |
---|
| 1827 | !-- ( nx + 1 ) * ( ny + 1 ), defined at the first grid layer above the topography, they are |
---|
| 1828 | !-- divided by ngp_2dh(sr) |
---|
| 1829 | sums(nzb:nzb+3,pr_palm) = sums(nzb:nzb+3,pr_palm) / ngp_2dh(sr) |
---|
| 1830 | sums(nzb+12,pr_palm) = sums(nzb+12,pr_palm) / ngp_2dh(sr) ! qs |
---|
| 1831 | sums(nzb+13,pr_palm) = sums(nzb+13,pr_palm) / ngp_2dh(sr) ! ss |
---|
| 1832 | sums(nzb+14,pr_palm) = sums(nzb+14,pr_palm) / ngp_2dh(sr) ! surface temperature |
---|
| 1833 | |
---|
[1] | 1834 | !-- eges, e* |
---|
[4646] | 1835 | sums(nzb+4:nzb+5,pr_palm) = sums(nzb+4:nzb+5,pr_palm) / ngp_3d(sr) |
---|
[1] | 1836 | !-- Old and new divergence |
---|
[4646] | 1837 | sums(nzb+9:nzb+10,pr_palm) = sums(nzb+9:nzb+10,pr_palm) / ngp_3d_inner(sr) |
---|
[1] | 1838 | |
---|
[87] | 1839 | !-- User-defined profiles |
---|
| 1840 | IF ( max_pr_user > 0 ) THEN |
---|
| 1841 | DO k = nzb, nzt+1 |
---|
[4646] | 1842 | sums(k,pr_palm+1:pr_palm+max_pr_user) = sums(k,pr_palm+1:pr_palm+max_pr_user) / & |
---|
| 1843 | ngp_2dh_s_inner(k,sr) |
---|
[87] | 1844 | ENDDO |
---|
| 1845 | ENDIF |
---|
[1007] | 1846 | |
---|
[4646] | 1847 | IF ( air_chemistry ) THEN |
---|
[4472] | 1848 | IF ( max_pr_cs > 0 ) THEN |
---|
[3298] | 1849 | DO k = nzb, nzt+1 |
---|
[4646] | 1850 | sums(k, pr_palm+1:pr_palm+max_pr_user+max_pr_cs) = & |
---|
| 1851 | sums(k, pr_palm+1:pr_palm+max_pr_user+max_pr_cs) / & |
---|
| 1852 | ngp_2dh_s_inner(k,sr) |
---|
[3298] | 1853 | ENDDO |
---|
[4472] | 1854 | ENDIF |
---|
[3298] | 1855 | ENDIF |
---|
| 1856 | |
---|
[4646] | 1857 | IF ( salsa ) THEN |
---|
[4131] | 1858 | IF ( max_pr_salsa > 0 ) THEN |
---|
| 1859 | DO k = nzb, nzt+1 |
---|
| 1860 | sums(k,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa) = & |
---|
| 1861 | sums(k,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa) & |
---|
| 1862 | / ngp_2dh_s_inner(k,sr) |
---|
| 1863 | ENDDO |
---|
[4472] | 1864 | ENDIF |
---|
[4131] | 1865 | ENDIF |
---|
| 1866 | |
---|
[1] | 1867 | ! |
---|
| 1868 | !-- Collect horizontal average in hom. |
---|
| 1869 | !-- Compute deduced averages (e.g. total heat flux) |
---|
[4464] | 1870 | hom(:,1,3,sr) = sums(:,3) ! w |
---|
[1] | 1871 | hom(:,1,8,sr) = sums(:,8) ! e profiles 5-7 are initial profiles |
---|
| 1872 | hom(:,1,9,sr) = sums(:,9) ! km |
---|
| 1873 | hom(:,1,10,sr) = sums(:,10) ! kh |
---|
| 1874 | hom(:,1,11,sr) = sums(:,11) ! l |
---|
| 1875 | hom(:,1,12,sr) = sums(:,12) ! w"u" |
---|
| 1876 | hom(:,1,13,sr) = sums(:,13) ! w*u* |
---|
| 1877 | hom(:,1,14,sr) = sums(:,14) ! w"v" |
---|
| 1878 | hom(:,1,15,sr) = sums(:,15) ! w*v* |
---|
| 1879 | hom(:,1,16,sr) = sums(:,16) ! w"pt" |
---|
| 1880 | hom(:,1,17,sr) = sums(:,17) ! w*pt* |
---|
| 1881 | hom(:,1,18,sr) = sums(:,16) + sums(:,17) ! wpt |
---|
| 1882 | hom(:,1,19,sr) = sums(:,12) + sums(:,13) ! wu |
---|
| 1883 | hom(:,1,20,sr) = sums(:,14) + sums(:,15) ! wv |
---|
| 1884 | hom(:,1,21,sr) = sums(:,21) ! w*pt*BC |
---|
| 1885 | hom(:,1,22,sr) = sums(:,16) + sums(:,21) ! wptBC |
---|
[96] | 1886 | ! profile 24 is initial profile (sa) |
---|
[4472] | 1887 | ! profiles 25-29 left empty for initial |
---|
[1] | 1888 | ! profiles |
---|
| 1889 | hom(:,1,30,sr) = sums(:,30) ! u*2 |
---|
| 1890 | hom(:,1,31,sr) = sums(:,31) ! v*2 |
---|
| 1891 | hom(:,1,32,sr) = sums(:,32) ! w*2 |
---|
| 1892 | hom(:,1,33,sr) = sums(:,33) ! pt*2 |
---|
| 1893 | hom(:,1,34,sr) = sums(:,34) ! e* |
---|
| 1894 | hom(:,1,35,sr) = sums(:,35) ! w*2pt* |
---|
| 1895 | hom(:,1,36,sr) = sums(:,36) ! w*pt*2 |
---|
| 1896 | hom(:,1,37,sr) = sums(:,37) ! w*e* |
---|
| 1897 | hom(:,1,38,sr) = sums(:,38) ! w*3 |
---|
[4646] | 1898 | hom(:,1,39,sr) = sums(:,38) / ( ABS( sums(:,32) ) + 1E-20_wp )**1.5_wp ! Sw |
---|
[1] | 1899 | hom(:,1,40,sr) = sums(:,40) ! p |
---|
[531] | 1900 | hom(:,1,45,sr) = sums(:,45) ! w"vpt" |
---|
[4472] | 1901 | hom(:,1,46,sr) = sums(:,46) ! w*vpt* |
---|
[1] | 1902 | hom(:,1,47,sr) = sums(:,45) + sums(:,46) ! wvpt |
---|
| 1903 | hom(:,1,48,sr) = sums(:,48) ! w"q" (w"qv") |
---|
| 1904 | hom(:,1,49,sr) = sums(:,49) ! w*q* (w*qv*) |
---|
| 1905 | hom(:,1,50,sr) = sums(:,48) + sums(:,49) ! wq (wqv) |
---|
| 1906 | hom(:,1,51,sr) = sums(:,51) ! w"qv" |
---|
[4472] | 1907 | hom(:,1,52,sr) = sums(:,52) ! w*qv* |
---|
[1] | 1908 | hom(:,1,53,sr) = sums(:,52) + sums(:,51) ! wq (wqv) |
---|
| 1909 | hom(:,1,54,sr) = sums(:,54) ! ql |
---|
| 1910 | hom(:,1,55,sr) = sums(:,55) ! w*u*u*/dz |
---|
| 1911 | hom(:,1,56,sr) = sums(:,56) ! w*p*/dz |
---|
[2031] | 1912 | hom(:,1,57,sr) = sums(:,57) ! ( w"e + w"p"/rho_ocean )/dz |
---|
[1] | 1913 | hom(:,1,58,sr) = sums(:,58) ! u"pt" |
---|
| 1914 | hom(:,1,59,sr) = sums(:,59) ! u*pt* |
---|
| 1915 | hom(:,1,60,sr) = sums(:,58) + sums(:,59) ! upt_t |
---|
| 1916 | hom(:,1,61,sr) = sums(:,61) ! v"pt" |
---|
| 1917 | hom(:,1,62,sr) = sums(:,62) ! v*pt* |
---|
| 1918 | hom(:,1,63,sr) = sums(:,61) + sums(:,62) ! vpt_t |
---|
[2031] | 1919 | hom(:,1,64,sr) = sums(:,64) ! rho_ocean |
---|
[96] | 1920 | hom(:,1,65,sr) = sums(:,65) ! w"sa" |
---|
| 1921 | hom(:,1,66,sr) = sums(:,66) ! w*sa* |
---|
| 1922 | hom(:,1,67,sr) = sums(:,65) + sums(:,66) ! wsa |
---|
[106] | 1923 | hom(:,1,68,sr) = sums(:,68) ! w*p* |
---|
[2031] | 1924 | hom(:,1,69,sr) = sums(:,69) ! w"e + w"p"/rho_ocean |
---|
[197] | 1925 | hom(:,1,70,sr) = sums(:,70) ! q*2 |
---|
[388] | 1926 | hom(:,1,71,sr) = sums(:,71) ! prho |
---|
[2252] | 1927 | hom(:,1,72,sr) = hyp * 1E-2_wp ! hyp in hPa |
---|
[2292] | 1928 | hom(:,1,123,sr) = sums(:,123) ! nc |
---|
[4502] | 1929 | hom(:,1,124,sr) = sums(:,124) ! ni |
---|
| 1930 | hom(:,1,125,sr) = sums(:,125) ! qi |
---|
[1053] | 1931 | hom(:,1,73,sr) = sums(:,73) ! nr |
---|
| 1932 | hom(:,1,74,sr) = sums(:,74) ! qr |
---|
| 1933 | hom(:,1,75,sr) = sums(:,75) ! qc |
---|
| 1934 | hom(:,1,76,sr) = sums(:,76) ! prr (precipitation rate) |
---|
[1179] | 1935 | ! 77 is initial density profile |
---|
[1241] | 1936 | hom(:,1,78,sr) = ug ! ug |
---|
| 1937 | hom(:,1,79,sr) = vg ! vg |
---|
[1299] | 1938 | hom(:,1,80,sr) = w_subs ! w_subs |
---|
[1] | 1939 | |
---|
[1365] | 1940 | IF ( large_scale_forcing ) THEN |
---|
[1382] | 1941 | hom(:,1,81,sr) = sums_ls_l(:,0) ! td_lsa_lpt |
---|
| 1942 | hom(:,1,82,sr) = sums_ls_l(:,1) ! td_lsa_q |
---|
[1365] | 1943 | IF ( use_subsidence_tendencies ) THEN |
---|
[1382] | 1944 | hom(:,1,83,sr) = sums_ls_l(:,2) ! td_sub_lpt |
---|
| 1945 | hom(:,1,84,sr) = sums_ls_l(:,3) ! td_sub_q |
---|
[1365] | 1946 | ELSE |
---|
[1382] | 1947 | hom(:,1,83,sr) = sums(:,83) ! td_sub_lpt |
---|
| 1948 | hom(:,1,84,sr) = sums(:,84) ! td_sub_q |
---|
[1365] | 1949 | ENDIF |
---|
[1382] | 1950 | hom(:,1,85,sr) = sums(:,85) ! td_nud_lpt |
---|
| 1951 | hom(:,1,86,sr) = sums(:,86) ! td_nud_q |
---|
| 1952 | hom(:,1,87,sr) = sums(:,87) ! td_nud_u |
---|
| 1953 | hom(:,1,88,sr) = sums(:,88) ! td_nud_v |
---|
[1365] | 1954 | ENDIF |
---|
| 1955 | |
---|
[1551] | 1956 | IF ( land_surface ) THEN |
---|
| 1957 | hom(:,1,89,sr) = sums(:,89) ! t_soil |
---|
| 1958 | ! 90 is initial t_soil profile |
---|
| 1959 | hom(:,1,91,sr) = sums(:,91) ! m_soil |
---|
| 1960 | ! 92 is initial m_soil profile |
---|
[2270] | 1961 | hom(:,1,93,sr) = sums(:,93) ! ghf |
---|
| 1962 | hom(:,1,94,sr) = sums(:,94) ! qsws_liq |
---|
| 1963 | hom(:,1,95,sr) = sums(:,95) ! qsws_soil |
---|
| 1964 | hom(:,1,96,sr) = sums(:,96) ! qsws_veg |
---|
| 1965 | hom(:,1,97,sr) = sums(:,97) ! r_a |
---|
[4551] | 1966 | hom(:,1,98,sr) = sums(:,98) ! r_s |
---|
[1555] | 1967 | |
---|
[1551] | 1968 | ENDIF |
---|
| 1969 | |
---|
| 1970 | IF ( radiation ) THEN |
---|
[2270] | 1971 | hom(:,1,99,sr) = sums(:,99) ! rad_net |
---|
| 1972 | hom(:,1,100,sr) = sums(:,100) ! rad_lw_in |
---|
| 1973 | hom(:,1,101,sr) = sums(:,101) ! rad_lw_out |
---|
| 1974 | hom(:,1,102,sr) = sums(:,102) ! rad_sw_in |
---|
| 1975 | hom(:,1,103,sr) = sums(:,103) ! rad_sw_out |
---|
[1585] | 1976 | |
---|
[1691] | 1977 | IF ( radiation_scheme == 'rrtmg' ) THEN |
---|
[2270] | 1978 | hom(:,1,104,sr) = sums(:,104) ! rad_lw_cs_hr |
---|
| 1979 | hom(:,1,105,sr) = sums(:,105) ! rad_lw_hr |
---|
| 1980 | hom(:,1,106,sr) = sums(:,106) ! rad_sw_cs_hr |
---|
| 1981 | hom(:,1,107,sr) = sums(:,107) ! rad_sw_hr |
---|
[1691] | 1982 | |
---|
[2270] | 1983 | hom(:,1,108,sr) = sums(:,108) ! rrtm_aldif |
---|
| 1984 | hom(:,1,109,sr) = sums(:,109) ! rrtm_aldir |
---|
| 1985 | hom(:,1,110,sr) = sums(:,110) ! rrtm_asdif |
---|
| 1986 | hom(:,1,111,sr) = sums(:,111) ! rrtm_asdir |
---|
[1585] | 1987 | ENDIF |
---|
[1551] | 1988 | ENDIF |
---|
| 1989 | |
---|
[2270] | 1990 | hom(:,1,112,sr) = sums(:,112) !: L |
---|
[1691] | 1991 | |
---|
[1960] | 1992 | IF ( passive_scalar ) THEN |
---|
[2270] | 1993 | hom(:,1,117,sr) = sums(:,117) ! w"s" |
---|
| 1994 | hom(:,1,114,sr) = sums(:,114) ! w*s* |
---|
[4472] | 1995 | hom(:,1,118,sr) = sums(:,117) + sums(:,114) ! ws |
---|
[2270] | 1996 | hom(:,1,116,sr) = sums(:,116) ! s*2 |
---|
[1960] | 1997 | ENDIF |
---|
| 1998 | |
---|
[2270] | 1999 | hom(:,1,119,sr) = rho_air ! rho_air in Kg/m^3 |
---|
| 2000 | hom(:,1,120,sr) = rho_air_zw ! rho_air_zw in Kg/m^3 |
---|
[2037] | 2001 | |
---|
[4646] | 2002 | IF ( kolmogorov_length_scale ) THEN |
---|
[4472] | 2003 | hom(:,1,121,sr) = sums(:,121) * 1E3_wp ! eta in mm |
---|
| 2004 | ENDIF |
---|
| 2005 | |
---|
| 2006 | |
---|
[667] | 2007 | hom(:,1,pr_palm,sr) = sums(:,pr_palm) |
---|
[1] | 2008 | ! u*, w'u', w'v', t* (in last profile) |
---|
| 2009 | |
---|
[87] | 2010 | IF ( max_pr_user > 0 ) THEN ! user-defined profiles |
---|
| 2011 | hom(:,1,pr_palm+1:pr_palm+max_pr_user,sr) = & |
---|
| 2012 | sums(:,pr_palm+1:pr_palm+max_pr_user) |
---|
| 2013 | ENDIF |
---|
| 2014 | |
---|
[3298] | 2015 | IF ( air_chemistry ) THEN |
---|
[4472] | 2016 | IF ( max_pr_cs > 0 ) THEN ! chem_spcs profiles |
---|
[3298] | 2017 | hom(:, 1, pr_palm+max_pr_user+1:pr_palm + max_pr_user+max_pr_cs, sr) = & |
---|
| 2018 | sums(:, pr_palm+max_pr_user+1:pr_palm+max_pr_user+max_pr_cs) |
---|
| 2019 | ENDIF |
---|
| 2020 | ENDIF |
---|
[4131] | 2021 | |
---|
| 2022 | IF ( salsa ) THEN |
---|
| 2023 | IF ( max_pr_salsa > 0 ) THEN ! salsa profiles |
---|
| 2024 | hom(:,1,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa, sr) = & |
---|
| 2025 | sums(:,pr_palm+max_pr_user+max_pr_cs+1:pr_palm+max_pr_user+max_pr_cs+max_pr_salsa) |
---|
| 2026 | ENDIF |
---|
| 2027 | ENDIF |
---|
[1] | 2028 | ! |
---|
| 2029 | !-- Determine the boundary layer height using two different schemes. |
---|
[4646] | 2030 | !-- First scheme: Starting from the Earth's (Ocean's) surface, look for the first relative |
---|
| 2031 | !-- minimum (maximum) of the total heat flux. |
---|
| 2032 | !-- The corresponding height is assumed as the boundary layer height, if it is less than 1.5 |
---|
| 2033 | !-- times the height where the heat flux becomes negative (positive) for the first time. |
---|
| 2034 | !-- Attention: the resolved vertical sensible heat flux (hom(:,1,17,sr) = w*pt*) is not known at |
---|
| 2035 | !-- the beginning because the calculation happens in advec_s_ws which is called after |
---|
| 2036 | !-- flow_statistics. Therefore z_i is directly taken from restart data at the beginning of |
---|
| 2037 | !-- restart runs. |
---|
| 2038 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' .OR. & |
---|
[3003] | 2039 | simulated_time_at_begin /= simulated_time ) THEN |
---|
[667] | 2040 | |
---|
[3003] | 2041 | z_i(1) = 0.0_wp |
---|
| 2042 | first = .TRUE. |
---|
| 2043 | |
---|
[3294] | 2044 | IF ( ocean_mode ) THEN |
---|
[3003] | 2045 | DO k = nzt, nzb+1, -1 |
---|
| 2046 | IF ( first .AND. hom(k,1,18,sr) < -1.0E-8_wp ) THEN |
---|
| 2047 | first = .FALSE. |
---|
| 2048 | height = zw(k) |
---|
[97] | 2049 | ENDIF |
---|
[4646] | 2050 | IF ( hom(k,1,18,sr) < -1.0E-8_wp .AND. hom(k-1,1,18,sr) > hom(k,1,18,sr) ) THEN |
---|
[3003] | 2051 | IF ( zw(k) < 1.5_wp * height ) THEN |
---|
| 2052 | z_i(1) = zw(k) |
---|
| 2053 | ELSE |
---|
| 2054 | z_i(1) = height |
---|
| 2055 | ENDIF |
---|
| 2056 | EXIT |
---|
[94] | 2057 | ENDIF |
---|
[3003] | 2058 | ENDDO |
---|
| 2059 | ELSE |
---|
| 2060 | DO k = nzb, nzt-1 |
---|
| 2061 | IF ( first .AND. hom(k,1,18,sr) < -1.0E-8_wp ) THEN |
---|
| 2062 | first = .FALSE. |
---|
| 2063 | height = zw(k) |
---|
| 2064 | ENDIF |
---|
[4646] | 2065 | IF ( hom(k,1,18,sr) < -1.0E-8_wp .AND. hom(k+1,1,18,sr) > hom(k,1,18,sr) ) THEN |
---|
[3003] | 2066 | IF ( zw(k) < 1.5_wp * height ) THEN |
---|
| 2067 | z_i(1) = zw(k) |
---|
| 2068 | ELSE |
---|
| 2069 | z_i(1) = height |
---|
| 2070 | ENDIF |
---|
| 2071 | EXIT |
---|
| 2072 | ENDIF |
---|
| 2073 | ENDDO |
---|
| 2074 | ENDIF |
---|
[1] | 2075 | |
---|
| 2076 | ! |
---|
[4646] | 2077 | !-- Second scheme: Gradient scheme from Sullivan et al. (1998), modified by Uhlenbrock(2006). |
---|
| 2078 | !-- The boundary layer height is the height with the maximal local temperature gradient: |
---|
| 2079 | !-- starting from the second (the last but one) vertical gridpoint, the local gradient must be |
---|
| 2080 | !-- at least 0.2K/100m and greater than the next four gradients. |
---|
[3003] | 2081 | !-- WARNING: The threshold value of 0.2K/100m must be adjusted for the |
---|
[4472] | 2082 | !-- ocean case! |
---|
[3003] | 2083 | z_i(2) = 0.0_wp |
---|
| 2084 | DO k = nzb+1, nzt+1 |
---|
| 2085 | dptdz(k) = ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) * ddzu(k) |
---|
| 2086 | ENDDO |
---|
| 2087 | dptdz_threshold = 0.2_wp / 100.0_wp |
---|
[291] | 2088 | |
---|
[3294] | 2089 | IF ( ocean_mode ) THEN |
---|
[3003] | 2090 | DO k = nzt+1, nzb+5, -1 |
---|
[4646] | 2091 | IF ( dptdz(k) > dptdz_threshold .AND. & |
---|
| 2092 | dptdz(k) > dptdz(k-1) .AND. dptdz(k) > dptdz(k-2) .AND. & |
---|
[3003] | 2093 | dptdz(k) > dptdz(k-3) .AND. dptdz(k) > dptdz(k-4) ) THEN |
---|
| 2094 | z_i(2) = zw(k-1) |
---|
| 2095 | EXIT |
---|
| 2096 | ENDIF |
---|
| 2097 | ENDDO |
---|
| 2098 | ELSE |
---|
| 2099 | DO k = nzb+1, nzt-3 |
---|
[4646] | 2100 | IF ( dptdz(k) > dptdz_threshold .AND. & |
---|
| 2101 | dptdz(k) > dptdz(k+1) .AND. dptdz(k) > dptdz(k+2) .AND. & |
---|
[3003] | 2102 | dptdz(k) > dptdz(k+3) .AND. dptdz(k) > dptdz(k+4) ) THEN |
---|
| 2103 | z_i(2) = zw(k-1) |
---|
| 2104 | EXIT |
---|
| 2105 | ENDIF |
---|
| 2106 | ENDDO |
---|
| 2107 | ENDIF |
---|
| 2108 | |
---|
[97] | 2109 | ENDIF |
---|
[1] | 2110 | |
---|
[87] | 2111 | hom(nzb+6,1,pr_palm,sr) = z_i(1) |
---|
| 2112 | hom(nzb+7,1,pr_palm,sr) = z_i(2) |
---|
[1] | 2113 | |
---|
| 2114 | ! |
---|
[4646] | 2115 | !-- Determine vertical index which is nearest to the mean surface level height of the respective |
---|
| 2116 | !-- statistic region |
---|
[1738] | 2117 | DO k = nzb, nzt |
---|
| 2118 | IF ( zw(k) >= mean_surface_level_height(sr) ) THEN |
---|
| 2119 | k_surface_level = k |
---|
| 2120 | EXIT |
---|
| 2121 | ENDIF |
---|
| 2122 | ENDDO |
---|
[3003] | 2123 | |
---|
[1738] | 2124 | ! |
---|
[4646] | 2125 | !-- Computation of both the characteristic vertical velocity and the characteristic convective |
---|
| 2126 | !-- boundary layer temperature. |
---|
| 2127 | !-- The inversion height entering into the equation is defined with respect to the mean surface |
---|
| 2128 | !-- level height of the respective statistic region. |
---|
| 2129 | !-- The horizontal average at surface level index + 1 is input for the average temperature. |
---|
| 2130 | IF ( hom(k_surface_level,1,18,sr) > 1.0E-8_wp .AND. z_i(1) /= 0.0_wp ) THEN |
---|
| 2131 | hom(nzb+8,1,pr_palm,sr) = & |
---|
| 2132 | ( g / hom(k_surface_level+1,1,4,sr) * & |
---|
| 2133 | ( hom(k_surface_level,1,18,sr) / & |
---|
| 2134 | ( heatflux_output_conversion(nzb) * rho_air(nzb) ) ) & |
---|
| 2135 | * ABS( z_i(1) - mean_surface_level_height(sr) ) )**0.333333333_wp |
---|
[1] | 2136 | ELSE |
---|
[1353] | 2137 | hom(nzb+8,1,pr_palm,sr) = 0.0_wp |
---|
[1] | 2138 | ENDIF |
---|
| 2139 | |
---|
[48] | 2140 | ! |
---|
[4646] | 2141 | !-- Collect the time series quantities. Please note, timeseries quantities which are collected |
---|
| 2142 | !-- from horizontally averaged profiles, e.g. wpt or pt(zp), are treated specially. In case of |
---|
| 2143 | !-- elevated model surfaces, index nzb+1 might be within topography and data will be zero. |
---|
| 2144 | !-- Therefore, take value for the first atmosphere index, which is topo_min_level+1. |
---|
[2968] | 2145 | ts_value(1,sr) = hom(nzb+4,1,pr_palm,sr) ! E |
---|
| 2146 | ts_value(2,sr) = hom(nzb+5,1,pr_palm,sr) ! E* |
---|
[48] | 2147 | ts_value(3,sr) = dt_3d |
---|
[2968] | 2148 | ts_value(4,sr) = hom(nzb,1,pr_palm,sr) ! u* |
---|
| 2149 | ts_value(5,sr) = hom(nzb+3,1,pr_palm,sr) ! th* |
---|
[48] | 2150 | ts_value(6,sr) = u_max |
---|
| 2151 | ts_value(7,sr) = v_max |
---|
| 2152 | ts_value(8,sr) = w_max |
---|
[2968] | 2153 | ts_value(9,sr) = hom(nzb+10,1,pr_palm,sr) ! new divergence |
---|
| 2154 | ts_value(10,sr) = hom(nzb+9,1,pr_palm,sr) ! old Divergence |
---|
| 2155 | ts_value(11,sr) = hom(nzb+6,1,pr_palm,sr) ! z_i(1) |
---|
| 2156 | ts_value(12,sr) = hom(nzb+7,1,pr_palm,sr) ! z_i(2) |
---|
| 2157 | ts_value(13,sr) = hom(nzb+8,1,pr_palm,sr) ! w* |
---|
| 2158 | ts_value(14,sr) = hom(nzb,1,16,sr) ! w'pt' at k=0 |
---|
| 2159 | ts_value(15,sr) = hom(topo_min_level+1,1,16,sr) ! w'pt' at k=1 |
---|
| 2160 | ts_value(16,sr) = hom(topo_min_level+1,1,18,sr) ! wpt at k=1 |
---|
| 2161 | ts_value(17,sr) = hom(nzb+14,1,pr_palm,sr) ! pt(0) |
---|
| 2162 | ts_value(18,sr) = hom(topo_min_level+1,1,4,sr) ! pt(zp) |
---|
| 2163 | ts_value(19,sr) = hom(nzb+1,1,pr_palm,sr) ! u'w' at k=0 |
---|
| 2164 | ts_value(20,sr) = hom(nzb+2,1,pr_palm,sr) ! v'w' at k=0 |
---|
| 2165 | ts_value(21,sr) = hom(nzb,1,48,sr) ! w"q" at k=0 |
---|
[1709] | 2166 | |
---|
| 2167 | IF ( .NOT. neutral ) THEN |
---|
[2270] | 2168 | ts_value(22,sr) = hom(nzb,1,112,sr) ! L |
---|
[48] | 2169 | ELSE |
---|
[1709] | 2170 | ts_value(22,sr) = 1.0E10_wp |
---|
[48] | 2171 | ENDIF |
---|
[1] | 2172 | |
---|
[343] | 2173 | ts_value(23,sr) = hom(nzb+12,1,pr_palm,sr) ! q* |
---|
[1551] | 2174 | |
---|
[1960] | 2175 | IF ( passive_scalar ) THEN |
---|
[2270] | 2176 | ts_value(24,sr) = hom(nzb+13,1,117,sr) ! w"s" ( to do ! ) |
---|
[1960] | 2177 | ts_value(25,sr) = hom(nzb+13,1,pr_palm,sr) ! s* |
---|
| 2178 | ENDIF |
---|
| 2179 | |
---|
[1] | 2180 | ! |
---|
[1551] | 2181 | !-- Collect land surface model timeseries |
---|
| 2182 | IF ( land_surface ) THEN |
---|
[2270] | 2183 | ts_value(dots_soil ,sr) = hom(nzb,1,93,sr) ! ghf |
---|
| 2184 | ts_value(dots_soil+1,sr) = hom(nzb,1,94,sr) ! qsws_liq |
---|
| 2185 | ts_value(dots_soil+2,sr) = hom(nzb,1,95,sr) ! qsws_soil |
---|
| 2186 | ts_value(dots_soil+3,sr) = hom(nzb,1,96,sr) ! qsws_veg |
---|
| 2187 | ts_value(dots_soil+4,sr) = hom(nzb,1,97,sr) ! r_a |
---|
| 2188 | ts_value(dots_soil+5,sr) = hom(nzb,1,98,sr) ! r_s |
---|
[1551] | 2189 | ENDIF |
---|
| 2190 | ! |
---|
| 2191 | !-- Collect radiation model timeseries |
---|
| 2192 | IF ( radiation ) THEN |
---|
[2270] | 2193 | ts_value(dots_rad,sr) = hom(nzb,1,99,sr) ! rad_net |
---|
| 2194 | ts_value(dots_rad+1,sr) = hom(nzb,1,100,sr) ! rad_lw_in |
---|
| 2195 | ts_value(dots_rad+2,sr) = hom(nzb,1,101,sr) ! rad_lw_out |
---|
| 2196 | ts_value(dots_rad+3,sr) = hom(nzb,1,102,sr) ! rad_sw_in |
---|
| 2197 | ts_value(dots_rad+4,sr) = hom(nzb,1,103,sr) ! rad_sw_out |
---|
[1585] | 2198 | |
---|
| 2199 | IF ( radiation_scheme == 'rrtmg' ) THEN |
---|
[2270] | 2200 | ts_value(dots_rad+5,sr) = hom(nzb,1,108,sr) ! rrtm_aldif |
---|
| 2201 | ts_value(dots_rad+6,sr) = hom(nzb,1,109,sr) ! rrtm_aldir |
---|
| 2202 | ts_value(dots_rad+7,sr) = hom(nzb,1,110,sr) ! rrtm_asdif |
---|
| 2203 | ts_value(dots_rad+8,sr) = hom(nzb,1,111,sr) ! rrtm_asdir |
---|
[1585] | 2204 | ENDIF |
---|
| 2205 | |
---|
[1551] | 2206 | ENDIF |
---|
| 2207 | |
---|
| 2208 | ! |
---|
[3637] | 2209 | !-- Calculate additional statistics provided by other modules |
---|
| 2210 | CALL module_interface_statistics( 'time_series', sr, 0, dots_max ) |
---|
[2817] | 2211 | |
---|
[48] | 2212 | ENDDO ! loop of the subregions |
---|
| 2213 | |
---|
[1] | 2214 | ! |
---|
[1918] | 2215 | !-- If required, sum up horizontal averages for subsequent time averaging. |
---|
| 2216 | !-- Do not sum, if flow statistics is called before the first initial time step. |
---|
| 2217 | IF ( do_sum .AND. simulated_time /= 0.0_wp ) THEN |
---|
[1353] | 2218 | IF ( average_count_pr == 0 ) hom_sum = 0.0_wp |
---|
[1] | 2219 | hom_sum = hom_sum + hom(:,1,:,:) |
---|
| 2220 | average_count_pr = average_count_pr + 1 |
---|
| 2221 | do_sum = .FALSE. |
---|
| 2222 | ENDIF |
---|
| 2223 | |
---|
| 2224 | ! |
---|
| 2225 | !-- Set flag for other UPs (e.g. output routines, but also buoyancy). |
---|
| 2226 | !-- This flag is reset after each time step in time_integration. |
---|
| 2227 | flow_statistics_called = .TRUE. |
---|
| 2228 | |
---|
| 2229 | CALL cpu_log( log_point(10), 'flow_statistics', 'stop' ) |
---|
| 2230 | |
---|
| 2231 | |
---|
[4672] | 2232 | END SUBROUTINE flow_statistics |
---|