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