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