[1] | 1 | SUBROUTINE prandtl_fluxes |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1341] | 22 | ! |
---|
[1497] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: prandtl_fluxes.f90 1497 2014-12-02 17:28:07Z kanani $ |
---|
| 27 | ! |
---|
[1497] | 28 | ! 1496 2014-12-02 17:25:50Z maronga |
---|
| 29 | ! Adapted for land surface model |
---|
| 30 | ! |
---|
[1495] | 31 | ! 1494 2014-11-21 17:14:03Z maronga |
---|
| 32 | ! Bugfixes: qs is now calculated before calculation of Rif. Ccalculation of |
---|
| 33 | ! buoyancy flux in Rif corrected (added missing humidity term), allow use of |
---|
| 34 | ! topography for coupled runs (not tested) |
---|
| 35 | ! |
---|
[1362] | 36 | ! 1361 2014-04-16 15:17:48Z hoffmann |
---|
| 37 | ! Bugfix: calculation of turbulent fluxes of rain water content (qrsws) and rain |
---|
| 38 | ! drop concentration (nrsws) added |
---|
| 39 | ! |
---|
[1341] | 40 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 41 | ! REAL constants defined as wp-kind |
---|
| 42 | ! |
---|
[1321] | 43 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 44 | ! ONLY-attribute added to USE-statements, |
---|
| 45 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 46 | ! kinds are defined in new module kinds, |
---|
| 47 | ! old module precision_kind is removed, |
---|
| 48 | ! revision history before 2012 removed, |
---|
| 49 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 50 | ! all variable declaration statements |
---|
[1] | 51 | ! |
---|
[1277] | 52 | ! 1276 2014-01-15 13:40:41Z heinze |
---|
| 53 | ! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars |
---|
| 54 | ! |
---|
[1258] | 55 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 56 | ! openACC "kernels do" replaced by "kernels loop", "loop independent" added |
---|
| 57 | ! |
---|
[1037] | 58 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 59 | ! code put under GPL (PALM 3.9) |
---|
| 60 | ! |
---|
[1017] | 61 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 62 | ! OpenACC statements added |
---|
| 63 | ! |
---|
[979] | 64 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 65 | ! roughness length for scalar quantities z0h added |
---|
| 66 | ! |
---|
[1] | 67 | ! Revision 1.1 1998/01/23 10:06:06 raasch |
---|
| 68 | ! Initial revision |
---|
| 69 | ! |
---|
| 70 | ! |
---|
| 71 | ! Description: |
---|
| 72 | ! ------------ |
---|
| 73 | ! Diagnostic computation of vertical fluxes in the Prandtl layer from the |
---|
| 74 | ! values of the variables at grid point k=1 |
---|
| 75 | !------------------------------------------------------------------------------! |
---|
| 76 | |
---|
[1320] | 77 | USE arrays_3d, & |
---|
[1361] | 78 | ONLY: e, nr, nrs, nrsws, pt, q, qr, qrs, qrsws, qs, qsws, rif, shf, & |
---|
| 79 | ts, u, us, usws, v, vpt, vsws, zu, zw, z0, z0h |
---|
[1] | 80 | |
---|
[1320] | 81 | USE control_parameters, & |
---|
[1361] | 82 | ONLY: cloud_physics, constant_heatflux, constant_waterflux, & |
---|
| 83 | coupling_mode, g, humidity, ibc_e_b, icloud_scheme, kappa, & |
---|
| 84 | large_scale_forcing, lsf_surf, passive_scalar, precipitation, & |
---|
| 85 | pt_surface, q_surface, rif_max, rif_min, run_coupled, & |
---|
| 86 | surface_pressure |
---|
[1320] | 87 | |
---|
| 88 | USE indices, & |
---|
| 89 | ONLY: nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb_s_inner, & |
---|
| 90 | nzb_u_inner, nzb_v_inner |
---|
| 91 | |
---|
| 92 | USE kinds |
---|
| 93 | |
---|
[1496] | 94 | USE land_surface_model_mod, & |
---|
| 95 | ONLY: land_surface |
---|
| 96 | |
---|
[1] | 97 | IMPLICIT NONE |
---|
| 98 | |
---|
[1320] | 99 | INTEGER(iwp) :: i !: |
---|
| 100 | INTEGER(iwp) :: j !: |
---|
| 101 | INTEGER(iwp) :: k !: |
---|
[1] | 102 | |
---|
[1320] | 103 | LOGICAL :: coupled_run !: |
---|
| 104 | |
---|
| 105 | REAL(wp) :: a !: |
---|
| 106 | REAL(wp) :: b !: |
---|
| 107 | REAL(wp) :: e_q !: |
---|
| 108 | REAL(wp) :: rifm !: |
---|
| 109 | REAL(wp) :: uv_total !: |
---|
| 110 | REAL(wp) :: z_p !: |
---|
| 111 | |
---|
[1015] | 112 | ! |
---|
| 113 | !-- Data information for accelerators |
---|
[1361] | 114 | !$acc data present( e, nrsws, nzb_u_inner, nzb_v_inner, nzb_s_inner, pt ) & |
---|
| 115 | !$acc present( q, qs, qsws, qrsws, rif, shf, ts, u, us, usws, v ) & |
---|
| 116 | !$acc present( vpt, vsws, zu, zw, z0, z0h ) |
---|
[667] | 117 | ! |
---|
[1] | 118 | !-- Compute theta* |
---|
| 119 | IF ( constant_heatflux ) THEN |
---|
[1496] | 120 | |
---|
[1] | 121 | ! |
---|
| 122 | !-- For a given heat flux in the Prandtl layer: |
---|
| 123 | !-- for u* use the value from the previous time step |
---|
| 124 | !$OMP PARALLEL DO |
---|
[1257] | 125 | !$acc kernels loop |
---|
[667] | 126 | DO i = nxlg, nxrg |
---|
| 127 | DO j = nysg, nyng |
---|
[1340] | 128 | ts(j,i) = -shf(j,i) / ( us(j,i) + 1E-30_wp ) |
---|
[1] | 129 | ! |
---|
| 130 | !-- ts must be limited, because otherwise overflow may occur in case of |
---|
| 131 | !-- us=0 when computing rif further below |
---|
[1340] | 132 | IF ( ts(j,i) < -1.05E5_wp ) ts(j,i) = -1.0E5_wp |
---|
| 133 | IF ( ts(j,i) > 1.0E5_wp ) ts(j,i) = 1.0E5_wp |
---|
[1] | 134 | ENDDO |
---|
| 135 | ENDDO |
---|
| 136 | |
---|
| 137 | ELSE |
---|
| 138 | ! |
---|
| 139 | !-- For a given surface temperature: |
---|
[1496] | 140 | !-- (the Richardson number is still the one from the previous time step) |
---|
[1276] | 141 | IF ( large_scale_forcing .AND. lsf_surf ) THEN |
---|
[1496] | 142 | !$OMP PARALLEL DO |
---|
| 143 | !$acc kernels loop |
---|
| 144 | DO i = nxlg, nxrg |
---|
| 145 | DO j = nysg, nyng |
---|
| 146 | k = nzb_s_inner(j,i) |
---|
| 147 | pt(k,j,i) = pt_surface |
---|
| 148 | ENDDO |
---|
| 149 | ENDDO |
---|
[1276] | 150 | ENDIF |
---|
| 151 | |
---|
[1] | 152 | !$OMP PARALLEL DO PRIVATE( a, b, k, z_p ) |
---|
[1257] | 153 | !$acc kernels loop |
---|
[667] | 154 | DO i = nxlg, nxrg |
---|
| 155 | DO j = nysg, nyng |
---|
[1] | 156 | |
---|
| 157 | k = nzb_s_inner(j,i) |
---|
| 158 | z_p = zu(k+1) - zw(k) |
---|
| 159 | |
---|
[1340] | 160 | IF ( rif(j,i) >= 0.0_wp ) THEN |
---|
[1] | 161 | ! |
---|
| 162 | !-- Stable stratification |
---|
[978] | 163 | ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) ) / ( & |
---|
| 164 | LOG( z_p / z0h(j,i) ) + & |
---|
[1340] | 165 | 5.0_wp * rif(j,i) * ( z_p - z0h(j,i) ) / z_p & |
---|
[1] | 166 | ) |
---|
| 167 | ELSE |
---|
| 168 | ! |
---|
| 169 | !-- Unstable stratification |
---|
[1340] | 170 | a = SQRT( 1.0_wp - 16.0_wp * rif(j,i) ) |
---|
| 171 | b = SQRT( 1.0_wp - 16.0_wp * rif(j,i) * z0h(j,i) / z_p ) |
---|
[187] | 172 | |
---|
[1494] | 173 | ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) ) / ( & |
---|
| 174 | LOG( z_p / z0h(j,i) ) - & |
---|
[1340] | 175 | 2.0_wp * LOG( ( 1.0_wp + a ) / ( 1.0_wp + b ) ) ) |
---|
[1] | 176 | ENDIF |
---|
| 177 | |
---|
| 178 | ENDDO |
---|
| 179 | ENDDO |
---|
| 180 | ENDIF |
---|
| 181 | |
---|
| 182 | ! |
---|
[1494] | 183 | !-- If required compute q* |
---|
| 184 | IF ( humidity .OR. passive_scalar ) THEN |
---|
| 185 | IF ( constant_waterflux ) THEN |
---|
| 186 | ! |
---|
| 187 | !-- For a given water flux in the Prandtl layer: |
---|
| 188 | !$OMP PARALLEL DO |
---|
| 189 | !$acc kernels loop |
---|
| 190 | DO i = nxlg, nxrg |
---|
| 191 | DO j = nysg, nyng |
---|
| 192 | qs(j,i) = -qsws(j,i) / ( us(j,i) + 1E-30_wp ) |
---|
| 193 | ENDDO |
---|
| 194 | ENDDO |
---|
| 195 | |
---|
| 196 | ELSE |
---|
| 197 | coupled_run = ( coupling_mode == 'atmosphere_to_ocean' .AND. run_coupled ) |
---|
| 198 | |
---|
| 199 | IF ( large_scale_forcing .AND. lsf_surf ) THEN |
---|
[1496] | 200 | !$OMP PARALLEL DO |
---|
| 201 | !$acc kernels loop |
---|
| 202 | DO i = nxlg, nxrg |
---|
| 203 | DO j = nysg, nyng |
---|
| 204 | k = nzb_s_inner(j,i) |
---|
| 205 | q(k,j,i) = q_surface |
---|
| 206 | ENDDO |
---|
| 207 | ENDDO |
---|
[1494] | 208 | ENDIF |
---|
| 209 | |
---|
| 210 | !$OMP PARALLEL DO PRIVATE( a, b, k, z_p ) |
---|
| 211 | !$acc kernels loop independent |
---|
| 212 | DO i = nxlg, nxrg |
---|
| 213 | !$acc loop independent |
---|
| 214 | DO j = nysg, nyng |
---|
| 215 | |
---|
| 216 | k = nzb_s_inner(j,i) |
---|
| 217 | z_p = zu(k+1) - zw(k) |
---|
| 218 | |
---|
| 219 | ! |
---|
| 220 | !-- Assume saturation for atmosphere coupled to ocean (but not |
---|
| 221 | !-- in case of precursor runs) |
---|
| 222 | IF ( coupled_run ) THEN |
---|
| 223 | e_q = 6.1_wp * & |
---|
| 224 | EXP( 0.07_wp * ( MIN(pt(k,j,i),pt(k+1,j,i)) - 273.15_wp ) ) |
---|
| 225 | q(k,j,i) = 0.622_wp * e_q / ( surface_pressure - e_q ) |
---|
| 226 | ENDIF |
---|
| 227 | IF ( rif(j,i) >= 0.0_wp ) THEN |
---|
| 228 | ! |
---|
| 229 | !-- Stable stratification |
---|
| 230 | qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) ) / ( & |
---|
| 231 | LOG( z_p / z0h(j,i) ) + & |
---|
| 232 | 5.0_wp * rif(j,i) * ( z_p - z0h(j,i) ) / z_p & |
---|
| 233 | ) |
---|
| 234 | ELSE |
---|
| 235 | ! |
---|
| 236 | !-- Unstable stratification |
---|
| 237 | a = SQRT( 1.0_wp - 16.0_wp * rif(j,i) ) |
---|
| 238 | b = SQRT( 1.0_wp - 16.0_wp * rif(j,i) * z0h(j,i) / z_p ) |
---|
| 239 | |
---|
| 240 | qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) ) / ( & |
---|
| 241 | LOG( z_p / z0h(j,i) ) - & |
---|
| 242 | 2.0_wp * LOG( (1.0_wp + a ) / ( 1.0_wp + b ) ) ) |
---|
| 243 | ENDIF |
---|
| 244 | |
---|
| 245 | ENDDO |
---|
| 246 | ENDDO |
---|
| 247 | ENDIF |
---|
| 248 | ENDIF |
---|
| 249 | |
---|
| 250 | ! |
---|
[1] | 251 | !-- Compute z_p/L (corresponds to the Richardson-flux number) |
---|
[75] | 252 | IF ( .NOT. humidity ) THEN |
---|
[1] | 253 | !$OMP PARALLEL DO PRIVATE( k, z_p ) |
---|
[1257] | 254 | !$acc kernels loop |
---|
[667] | 255 | DO i = nxlg, nxrg |
---|
| 256 | DO j = nysg, nyng |
---|
[1] | 257 | k = nzb_s_inner(j,i) |
---|
| 258 | z_p = zu(k+1) - zw(k) |
---|
| 259 | rif(j,i) = z_p * kappa * g * ts(j,i) / & |
---|
[1340] | 260 | ( pt(k+1,j,i) * ( us(j,i)**2 + 1E-30_wp ) ) |
---|
[1] | 261 | ! |
---|
| 262 | !-- Limit the value range of the Richardson numbers. |
---|
| 263 | !-- This is necessary for very small velocities (u,v --> 0), because |
---|
| 264 | !-- the absolute value of rif can then become very large, which in |
---|
| 265 | !-- consequence would result in very large shear stresses and very |
---|
| 266 | !-- small momentum fluxes (both are generally unrealistic). |
---|
| 267 | IF ( rif(j,i) < rif_min ) rif(j,i) = rif_min |
---|
| 268 | IF ( rif(j,i) > rif_max ) rif(j,i) = rif_max |
---|
| 269 | ENDDO |
---|
| 270 | ENDDO |
---|
| 271 | ELSE |
---|
| 272 | !$OMP PARALLEL DO PRIVATE( k, z_p ) |
---|
[1257] | 273 | !$acc kernels loop |
---|
[667] | 274 | DO i = nxlg, nxrg |
---|
| 275 | DO j = nysg, nyng |
---|
[1] | 276 | k = nzb_s_inner(j,i) |
---|
| 277 | z_p = zu(k+1) - zw(k) |
---|
[1494] | 278 | rif(j,i) = z_p * kappa * g * & |
---|
| 279 | ( ts(j,i) + 0.61_wp * pt(k+1,j,i) * qs(j,i) + 0.61_wp & |
---|
| 280 | * q(k+1,j,i) * ts(j,i)) / & |
---|
[1340] | 281 | ( vpt(k+1,j,i) * ( us(j,i)**2 + 1E-30_wp ) ) |
---|
[1] | 282 | ! |
---|
| 283 | !-- Limit the value range of the Richardson numbers. |
---|
| 284 | !-- This is necessary for very small velocities (u,v --> 0), because |
---|
| 285 | !-- the absolute value of rif can then become very large, which in |
---|
| 286 | !-- consequence would result in very large shear stresses and very |
---|
| 287 | !-- small momentum fluxes (both are generally unrealistic). |
---|
| 288 | IF ( rif(j,i) < rif_min ) rif(j,i) = rif_min |
---|
| 289 | IF ( rif(j,i) > rif_max ) rif(j,i) = rif_max |
---|
| 290 | ENDDO |
---|
| 291 | ENDDO |
---|
| 292 | ENDIF |
---|
| 293 | |
---|
| 294 | ! |
---|
| 295 | !-- Compute u* at the scalars' grid points |
---|
| 296 | !$OMP PARALLEL DO PRIVATE( a, b, k, uv_total, z_p ) |
---|
[1257] | 297 | !$acc kernels loop |
---|
[1] | 298 | DO i = nxl, nxr |
---|
| 299 | DO j = nys, nyn |
---|
| 300 | |
---|
| 301 | k = nzb_s_inner(j,i) |
---|
| 302 | z_p = zu(k+1) - zw(k) |
---|
| 303 | |
---|
| 304 | ! |
---|
[667] | 305 | !-- Compute the absolute value of the horizontal velocity |
---|
| 306 | !-- (relative to the surface) |
---|
[1494] | 307 | uv_total = SQRT( ( 0.5_wp * ( u(k+1,j,i) + u(k+1,j,i+1) & |
---|
| 308 | - u(k,j,i) - u(k,j,i+1) ) )**2 + & |
---|
| 309 | ( 0.5_wp * ( v(k+1,j,i) + v(k+1,j+1,i) & |
---|
[1340] | 310 | - v(k,j,i) - v(k,j+1,i) ) )**2 ) |
---|
[1] | 311 | |
---|
[667] | 312 | |
---|
[1340] | 313 | IF ( rif(j,i) >= 0.0_wp ) THEN |
---|
[1] | 314 | ! |
---|
| 315 | !-- Stable stratification |
---|
[1494] | 316 | us(j,i) = kappa * uv_total / ( & |
---|
| 317 | LOG( z_p / z0(j,i) ) + & |
---|
| 318 | 5.0_wp * rif(j,i) * ( z_p - z0(j,i) ) / z_p & |
---|
[1] | 319 | ) |
---|
| 320 | ELSE |
---|
| 321 | ! |
---|
| 322 | !-- Unstable stratification |
---|
[1340] | 323 | a = SQRT( SQRT( 1.0_wp - 16.0_wp * rif(j,i) ) ) |
---|
| 324 | b = SQRT( SQRT( 1.0_wp - 16.0_wp * rif(j,i) / z_p * z0(j,i) ) ) |
---|
[187] | 325 | |
---|
[1494] | 326 | us(j,i) = kappa * uv_total / ( & |
---|
| 327 | LOG( z_p / z0(j,i) ) - & |
---|
| 328 | LOG( ( 1.0_wp + a )**2 * ( 1.0_wp + a**2 ) / ( & |
---|
| 329 | ( 1.0_wp + b )**2 * ( 1.0_wp + b**2 ) ) ) + & |
---|
| 330 | 2.0_wp * ( ATAN( a ) - ATAN( b ) ) & |
---|
[187] | 331 | ) |
---|
[1] | 332 | ENDIF |
---|
| 333 | ENDDO |
---|
| 334 | ENDDO |
---|
| 335 | |
---|
| 336 | ! |
---|
[187] | 337 | !-- Values of us at ghost point locations are needed for the evaluation of usws |
---|
| 338 | !-- and vsws. |
---|
[1015] | 339 | !$acc update host( us ) |
---|
[187] | 340 | CALL exchange_horiz_2d( us ) |
---|
[1015] | 341 | !$acc update device( us ) |
---|
| 342 | |
---|
[187] | 343 | ! |
---|
[1] | 344 | !-- Compute u'w' for the total model domain. |
---|
| 345 | !-- First compute the corresponding component of u* and square it. |
---|
| 346 | !$OMP PARALLEL DO PRIVATE( a, b, k, rifm, z_p ) |
---|
[1257] | 347 | !$acc kernels loop |
---|
[1] | 348 | DO i = nxl, nxr |
---|
| 349 | DO j = nys, nyn |
---|
| 350 | |
---|
| 351 | k = nzb_u_inner(j,i) |
---|
| 352 | z_p = zu(k+1) - zw(k) |
---|
| 353 | |
---|
| 354 | ! |
---|
| 355 | !-- Compute Richardson-flux number for this point |
---|
[1340] | 356 | rifm = 0.5_wp * ( rif(j,i-1) + rif(j,i) ) |
---|
| 357 | IF ( rifm >= 0.0_wp ) THEN |
---|
[1] | 358 | ! |
---|
| 359 | !-- Stable stratification |
---|
[1494] | 360 | usws(j,i) = kappa * ( u(k+1,j,i) - u(k,j,i) )/ ( & |
---|
| 361 | LOG( z_p / z0(j,i) ) + & |
---|
| 362 | 5.0_wp * rifm * ( z_p - z0(j,i) ) / z_p & |
---|
[1340] | 363 | ) |
---|
[1] | 364 | ELSE |
---|
| 365 | ! |
---|
| 366 | !-- Unstable stratification |
---|
[1340] | 367 | a = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm ) ) |
---|
| 368 | b = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm / z_p * z0(j,i) ) ) |
---|
[187] | 369 | |
---|
[1494] | 370 | usws(j,i) = kappa * ( u(k+1,j,i) - u(k,j,i) ) / ( & |
---|
| 371 | LOG( z_p / z0(j,i) ) - & |
---|
| 372 | LOG( (1.0_wp + a )**2 * ( 1.0_wp + a**2 ) / ( & |
---|
| 373 | (1.0_wp + b )**2 * ( 1.0_wp + b**2 ) ) ) + & |
---|
| 374 | 2.0_wp * ( ATAN( a ) - ATAN( b ) ) & |
---|
[1] | 375 | ) |
---|
| 376 | ENDIF |
---|
[1340] | 377 | usws(j,i) = -usws(j,i) * 0.5_wp * ( us(j,i-1) + us(j,i) ) |
---|
[1] | 378 | ENDDO |
---|
| 379 | ENDDO |
---|
| 380 | |
---|
| 381 | ! |
---|
| 382 | !-- Compute v'w' for the total model domain. |
---|
| 383 | !-- First compute the corresponding component of u* and square it. |
---|
| 384 | !$OMP PARALLEL DO PRIVATE( a, b, k, rifm, z_p ) |
---|
[1257] | 385 | !$acc kernels loop |
---|
[1] | 386 | DO i = nxl, nxr |
---|
| 387 | DO j = nys, nyn |
---|
| 388 | |
---|
| 389 | k = nzb_v_inner(j,i) |
---|
| 390 | z_p = zu(k+1) - zw(k) |
---|
| 391 | |
---|
| 392 | ! |
---|
| 393 | !-- Compute Richardson-flux number for this point |
---|
[1340] | 394 | rifm = 0.5_wp * ( rif(j-1,i) + rif(j,i) ) |
---|
| 395 | IF ( rifm >= 0.0_wp ) THEN |
---|
[1] | 396 | ! |
---|
| 397 | !-- Stable stratification |
---|
[1494] | 398 | vsws(j,i) = kappa * ( v(k+1,j,i) - v(k,j,i) ) / ( & |
---|
| 399 | LOG( z_p / z0(j,i) ) + & |
---|
| 400 | 5.0_wp * rifm * ( z_p - z0(j,i) ) / z_p & |
---|
[1340] | 401 | ) |
---|
[1] | 402 | ELSE |
---|
| 403 | ! |
---|
| 404 | !-- Unstable stratification |
---|
[1340] | 405 | a = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm ) ) |
---|
| 406 | b = SQRT( SQRT( 1.0_wp - 16.0_wp * rifm / z_p * z0(j,i) ) ) |
---|
[187] | 407 | |
---|
[1494] | 408 | vsws(j,i) = kappa * ( v(k+1,j,i) - v(k,j,i) ) / ( & |
---|
| 409 | LOG( z_p / z0(j,i) ) - & |
---|
| 410 | LOG( (1.0_wp + a )**2 * ( 1.0_wp + a**2 ) / ( & |
---|
| 411 | (1.0_wp + b )**2 * ( 1.0_wp + b**2 ) ) ) + & |
---|
| 412 | 2.0_wp * ( ATAN( a ) - ATAN( b ) ) & |
---|
[1] | 413 | ) |
---|
| 414 | ENDIF |
---|
[1340] | 415 | vsws(j,i) = -vsws(j,i) * 0.5_wp * ( us(j-1,i) + us(j,i) ) |
---|
[1] | 416 | ENDDO |
---|
| 417 | ENDDO |
---|
| 418 | |
---|
| 419 | ! |
---|
[1494] | 420 | !-- If required compute qr* and nr* |
---|
| 421 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. precipitation ) THEN |
---|
[1276] | 422 | |
---|
[1494] | 423 | !$OMP PARALLEL DO PRIVATE( a, b, k, z_p ) |
---|
| 424 | !$acc kernels loop independent |
---|
| 425 | DO i = nxlg, nxrg |
---|
| 426 | !$acc loop independent |
---|
| 427 | DO j = nysg, nyng |
---|
[1276] | 428 | |
---|
[1494] | 429 | k = nzb_s_inner(j,i) |
---|
| 430 | z_p = zu(k+1) - zw(k) |
---|
[1] | 431 | |
---|
[1494] | 432 | IF ( rif(j,i) >= 0.0 ) THEN |
---|
[108] | 433 | ! |
---|
[1494] | 434 | !-- Stable stratification |
---|
| 435 | qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) ) / ( & |
---|
| 436 | LOG( z_p / z0h(j,i) ) + & |
---|
| 437 | 5.0 * rif(j,i) * ( z_p - z0h(j,i) ) / z_p ) |
---|
| 438 | nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) ) / ( & |
---|
| 439 | LOG( z_p / z0h(j,i) ) + & |
---|
| 440 | 5.0 * rif(j,i) * ( z_p - z0h(j,i) ) / z_p ) |
---|
[1] | 441 | |
---|
[1494] | 442 | ELSE |
---|
[1361] | 443 | ! |
---|
[1494] | 444 | !-- Unstable stratification |
---|
| 445 | a = SQRT( 1.0 - 16.0 * rif(j,i) ) |
---|
| 446 | b = SQRT( 1.0 - 16.0 * rif(j,i) * z0h(j,i) / z_p ) |
---|
[1361] | 447 | |
---|
[1494] | 448 | qrs(j,i) = kappa * ( qr(k+1,j,i) - qr(k,j,i) ) / ( & |
---|
| 449 | LOG( z_p / z0h(j,i) ) - & |
---|
| 450 | 2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) ) |
---|
| 451 | nrs(j,i) = kappa * ( nr(k+1,j,i) - nr(k,j,i) ) / ( & |
---|
| 452 | LOG( z_p / z0h(j,i) ) - & |
---|
| 453 | 2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) ) |
---|
[1361] | 454 | |
---|
[1494] | 455 | ENDIF |
---|
[1361] | 456 | |
---|
| 457 | ENDDO |
---|
[1494] | 458 | ENDDO |
---|
[1361] | 459 | |
---|
[1] | 460 | ENDIF |
---|
| 461 | |
---|
| 462 | ! |
---|
[187] | 463 | !-- Exchange the boundaries for the momentum fluxes (only for sake of |
---|
| 464 | !-- completeness) |
---|
[1015] | 465 | !$acc update host( usws, vsws ) |
---|
[1] | 466 | CALL exchange_horiz_2d( usws ) |
---|
| 467 | CALL exchange_horiz_2d( vsws ) |
---|
[1015] | 468 | !$acc update device( usws, vsws ) |
---|
| 469 | IF ( humidity .OR. passive_scalar ) THEN |
---|
| 470 | !$acc update host( qsws ) |
---|
| 471 | CALL exchange_horiz_2d( qsws ) |
---|
| 472 | !$acc update device( qsws ) |
---|
[1361] | 473 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. & |
---|
| 474 | precipitation ) THEN |
---|
| 475 | !$acc update host( qrsws, nrsws ) |
---|
| 476 | CALL exchange_horiz_2d( qrsws ) |
---|
| 477 | CALL exchange_horiz_2d( nrsws ) |
---|
| 478 | !$acc update device( qrsws, nrsws ) |
---|
| 479 | ENDIF |
---|
[1015] | 480 | ENDIF |
---|
[1] | 481 | |
---|
| 482 | ! |
---|
| 483 | !-- Compute the vertical kinematic heat flux |
---|
[1496] | 484 | IF ( .NOT. constant_heatflux .AND. .NOT. land_surface ) THEN |
---|
[1] | 485 | !$OMP PARALLEL DO |
---|
[1257] | 486 | !$acc kernels loop independent |
---|
[667] | 487 | DO i = nxlg, nxrg |
---|
[1257] | 488 | !$acc loop independent |
---|
[667] | 489 | DO j = nysg, nyng |
---|
[1] | 490 | shf(j,i) = -ts(j,i) * us(j,i) |
---|
| 491 | ENDDO |
---|
| 492 | ENDDO |
---|
| 493 | ENDIF |
---|
| 494 | |
---|
| 495 | ! |
---|
| 496 | !-- Compute the vertical water/scalar flux |
---|
[1496] | 497 | IF ( .NOT. constant_waterflux .AND. ( humidity .OR. passive_scalar ) & |
---|
| 498 | .AND. .NOT. land_surface ) THEN |
---|
[1] | 499 | !$OMP PARALLEL DO |
---|
[1257] | 500 | !$acc kernels loop independent |
---|
[667] | 501 | DO i = nxlg, nxrg |
---|
[1257] | 502 | !$acc loop independent |
---|
[667] | 503 | DO j = nysg, nyng |
---|
[1] | 504 | qsws(j,i) = -qs(j,i) * us(j,i) |
---|
| 505 | ENDDO |
---|
| 506 | ENDDO |
---|
| 507 | ENDIF |
---|
| 508 | |
---|
| 509 | ! |
---|
[1361] | 510 | !-- Compute (turbulent) fluxes of rain water content and rain drop concentartion |
---|
| 511 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. precipitation ) THEN |
---|
| 512 | !$OMP PARALLEL DO |
---|
| 513 | !$acc kernels loop independent |
---|
| 514 | DO i = nxlg, nxrg |
---|
| 515 | !$acc loop independent |
---|
| 516 | DO j = nysg, nyng |
---|
| 517 | qrsws(j,i) = -qrs(j,i) * us(j,i) |
---|
| 518 | nrsws(j,i) = -nrs(j,i) * us(j,i) |
---|
| 519 | ENDDO |
---|
| 520 | ENDDO |
---|
| 521 | ENDIF |
---|
| 522 | |
---|
| 523 | ! |
---|
[1] | 524 | !-- Bottom boundary condition for the TKE |
---|
| 525 | IF ( ibc_e_b == 2 ) THEN |
---|
| 526 | !$OMP PARALLEL DO |
---|
[1257] | 527 | !$acc kernels loop independent |
---|
[667] | 528 | DO i = nxlg, nxrg |
---|
[1257] | 529 | !$acc loop independent |
---|
[667] | 530 | DO j = nysg, nyng |
---|
[1340] | 531 | e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.1_wp )**2 |
---|
[1] | 532 | ! |
---|
| 533 | !-- As a test: cm = 0.4 |
---|
[1340] | 534 | ! e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.4_wp )**2 |
---|
[1] | 535 | e(nzb_s_inner(j,i),j,i) = e(nzb_s_inner(j,i)+1,j,i) |
---|
| 536 | ENDDO |
---|
| 537 | ENDDO |
---|
| 538 | ENDIF |
---|
| 539 | |
---|
[1015] | 540 | !$acc end data |
---|
[1] | 541 | |
---|
| 542 | END SUBROUTINE prandtl_fluxes |
---|