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