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