[56] | 1 | MODULE wall_fluxes_mod |
---|
[52] | 2 | !------------------------------------------------------------------------------! |
---|
[484] | 3 | ! Current revisions: |
---|
[52] | 4 | ! ----------------- |
---|
[198] | 5 | ! |
---|
[1017] | 6 | ! |
---|
[198] | 7 | ! Former revisions: |
---|
| 8 | ! ----------------- |
---|
| 9 | ! $Id: wall_fluxes.f90 1017 2012-09-27 11:28:50Z raasch $ |
---|
| 10 | ! |
---|
[1017] | 11 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 12 | ! accelerator version (*_acc) added |
---|
| 13 | ! |
---|
[198] | 14 | ! 187 2008-08-06 16:25:09Z letzel |
---|
| 15 | ! Bugfix: Modification of the evaluation of the vertical turbulent momentum |
---|
| 16 | ! fluxes u'w' and v'w (see prandtl_fluxes), this requires the calculation of |
---|
| 17 | ! us_wall (and vel_total, u_i, v_i, ws) also in wall_fluxes_e. |
---|
| 18 | ! Bugfix: change definition of us_wall from 1D to 2D |
---|
[187] | 19 | ! Bugfix: storage of rifs to rifs_wall in wall_fluxes_e removed |
---|
| 20 | ! Change: add 'minus' sign to fluxes produced by subroutine wall_fluxes_e for |
---|
[198] | 21 | ! consistency with subroutine wall_fluxes |
---|
[187] | 22 | ! Change: Modification of the integrated version of the profile function for |
---|
[198] | 23 | ! momentum for unstable stratification |
---|
[52] | 24 | ! |
---|
| 25 | ! Initial version (2007/03/07) |
---|
| 26 | ! |
---|
| 27 | ! Description: |
---|
| 28 | ! ------------ |
---|
| 29 | ! Calculates momentum fluxes at vertical walls assuming Monin-Obukhov |
---|
| 30 | ! similarity. |
---|
| 31 | ! Indices: usvs a=1, vsus b=1, wsvs c1=1, wsus c2=1 (other=0). |
---|
[56] | 32 | ! The all-gridpoint version of wall_fluxes_e is not used so far, because |
---|
| 33 | ! it gives slightly different results from the ij-version for some unknown |
---|
| 34 | ! reason. |
---|
[52] | 35 | !------------------------------------------------------------------------------! |
---|
[56] | 36 | PRIVATE |
---|
[1015] | 37 | PUBLIC wall_fluxes, wall_fluxes_acc, wall_fluxes_e, wall_fluxes_e_acc |
---|
[56] | 38 | |
---|
| 39 | INTERFACE wall_fluxes |
---|
| 40 | MODULE PROCEDURE wall_fluxes |
---|
| 41 | MODULE PROCEDURE wall_fluxes_ij |
---|
| 42 | END INTERFACE wall_fluxes |
---|
| 43 | |
---|
[1015] | 44 | INTERFACE wall_fluxes_acc |
---|
| 45 | MODULE PROCEDURE wall_fluxes_acc |
---|
| 46 | END INTERFACE wall_fluxes_acc |
---|
| 47 | |
---|
[56] | 48 | INTERFACE wall_fluxes_e |
---|
| 49 | MODULE PROCEDURE wall_fluxes_e |
---|
| 50 | MODULE PROCEDURE wall_fluxes_e_ij |
---|
| 51 | END INTERFACE wall_fluxes_e |
---|
| 52 | |
---|
[1015] | 53 | INTERFACE wall_fluxes_e_acc |
---|
| 54 | MODULE PROCEDURE wall_fluxes_e_acc |
---|
| 55 | END INTERFACE wall_fluxes_e_acc |
---|
| 56 | |
---|
[56] | 57 | CONTAINS |
---|
[52] | 58 | |
---|
[56] | 59 | !------------------------------------------------------------------------------! |
---|
| 60 | ! Call for all grid points |
---|
| 61 | !------------------------------------------------------------------------------! |
---|
[75] | 62 | SUBROUTINE wall_fluxes( wall_flux, a, b, c1, c2, nzb_uvw_inner, & |
---|
[56] | 63 | nzb_uvw_outer, wall ) |
---|
[52] | 64 | |
---|
[56] | 65 | USE arrays_3d |
---|
| 66 | USE control_parameters |
---|
| 67 | USE grid_variables |
---|
| 68 | USE indices |
---|
| 69 | USE statistics |
---|
[52] | 70 | |
---|
[56] | 71 | IMPLICIT NONE |
---|
[52] | 72 | |
---|
[75] | 73 | INTEGER :: i, j, k, wall_index |
---|
[52] | 74 | |
---|
[667] | 75 | INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg) :: nzb_uvw_inner, & |
---|
[56] | 76 | nzb_uvw_outer |
---|
| 77 | REAL :: a, b, c1, c2, h1, h2, zp |
---|
| 78 | REAL :: pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts |
---|
[52] | 79 | |
---|
[667] | 80 | REAL, DIMENSION(nysg:nyng,nxlg:nxrg) :: wall |
---|
[75] | 81 | REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: wall_flux |
---|
[52] | 82 | |
---|
| 83 | |
---|
[56] | 84 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 85 | wall_flux = 0.0 |
---|
| 86 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 87 | |
---|
[75] | 88 | DO i = nxl, nxr |
---|
| 89 | DO j = nys, nyn |
---|
[56] | 90 | |
---|
| 91 | IF ( wall(j,i) /= 0.0 ) THEN |
---|
[52] | 92 | ! |
---|
[56] | 93 | !-- All subsequent variables are computed for the respective |
---|
[187] | 94 | !-- location where the respective flux is defined. |
---|
[56] | 95 | DO k = nzb_uvw_inner(j,i)+1, nzb_uvw_outer(j,i) |
---|
[53] | 96 | |
---|
[52] | 97 | ! |
---|
[56] | 98 | !-- (1) Compute rifs, u_i, v_i, ws, pt' and w'pt' |
---|
| 99 | rifs = rif_wall(k,j,i,wall_index) |
---|
[53] | 100 | |
---|
[56] | 101 | u_i = a * u(k,j,i) + c1 * 0.25 * & |
---|
| 102 | ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) ) |
---|
[53] | 103 | |
---|
[56] | 104 | v_i = b * v(k,j,i) + c2 * 0.25 * & |
---|
| 105 | ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) ) |
---|
[53] | 106 | |
---|
[56] | 107 | ws = ( c1 + c2 ) * w(k,j,i) + 0.25 * ( & |
---|
| 108 | a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) & |
---|
| 109 | + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) & |
---|
| 110 | ) |
---|
| 111 | pt_i = 0.5 * ( pt(k,j,i) + a * pt(k,j,i-1) + & |
---|
| 112 | b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) ) |
---|
[53] | 113 | |
---|
[56] | 114 | pts = pt_i - hom(k,1,4,0) |
---|
| 115 | wspts = ws * pts |
---|
[53] | 116 | |
---|
[52] | 117 | ! |
---|
[56] | 118 | !-- (2) Compute wall-parallel absolute velocity vel_total |
---|
| 119 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
[53] | 120 | |
---|
[52] | 121 | ! |
---|
[56] | 122 | !-- (3) Compute wall friction velocity us_wall |
---|
| 123 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 124 | |
---|
[52] | 125 | ! |
---|
[56] | 126 | !-- Stable stratification (and neutral) |
---|
| 127 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 128 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 129 | ) |
---|
| 130 | ELSE |
---|
[53] | 131 | |
---|
[52] | 132 | ! |
---|
[56] | 133 | !-- Unstable stratification |
---|
[187] | 134 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 135 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[53] | 136 | |
---|
[187] | 137 | us_wall = kappa * vel_total / ( & |
---|
| 138 | LOG( zp / z0(j,i) ) - & |
---|
| 139 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 140 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 141 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 142 | ) |
---|
[56] | 143 | ENDIF |
---|
[53] | 144 | |
---|
[52] | 145 | ! |
---|
[56] | 146 | !-- (4) Compute zp/L (corresponds to neutral Richardson flux |
---|
| 147 | !-- number rifs) |
---|
| 148 | rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * & |
---|
| 149 | ( us_wall**3 + 1E-30 ) ) |
---|
[53] | 150 | |
---|
[52] | 151 | ! |
---|
[56] | 152 | !-- Limit the value range of the Richardson numbers. |
---|
| 153 | !-- This is necessary for very small velocities (u,w --> 0), |
---|
| 154 | !-- because the absolute value of rif can then become very |
---|
| 155 | !-- large, which in consequence would result in very large |
---|
| 156 | !-- shear stresses and very small momentum fluxes (both are |
---|
| 157 | !-- generally unrealistic). |
---|
| 158 | IF ( rifs < rif_min ) rifs = rif_min |
---|
| 159 | IF ( rifs > rif_max ) rifs = rif_max |
---|
[53] | 160 | |
---|
[52] | 161 | ! |
---|
[56] | 162 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
| 163 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 164 | |
---|
[52] | 165 | ! |
---|
[56] | 166 | !-- Stable stratification (and neutral) |
---|
| 167 | wall_flux(k,j,i) = kappa * & |
---|
| 168 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / & |
---|
| 169 | ( LOG( zp / z0(j,i) ) + & |
---|
| 170 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 171 | ) |
---|
| 172 | ELSE |
---|
[53] | 173 | |
---|
[52] | 174 | ! |
---|
[56] | 175 | !-- Unstable stratification |
---|
[187] | 176 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 177 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[53] | 178 | |
---|
[187] | 179 | wall_flux(k,j,i) = kappa * & |
---|
| 180 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / ( & |
---|
| 181 | LOG( zp / z0(j,i) ) - & |
---|
| 182 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 183 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 184 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 185 | ) |
---|
[56] | 186 | ENDIF |
---|
[187] | 187 | wall_flux(k,j,i) = -wall_flux(k,j,i) * us_wall |
---|
[56] | 188 | |
---|
| 189 | ! |
---|
| 190 | !-- store rifs for next time step |
---|
| 191 | rif_wall(k,j,i,wall_index) = rifs |
---|
| 192 | |
---|
| 193 | ENDDO |
---|
| 194 | |
---|
| 195 | ENDIF |
---|
| 196 | |
---|
| 197 | ENDDO |
---|
| 198 | ENDDO |
---|
| 199 | |
---|
| 200 | END SUBROUTINE wall_fluxes |
---|
| 201 | |
---|
| 202 | |
---|
[1015] | 203 | !------------------------------------------------------------------------------! |
---|
| 204 | ! Call for all grid points - accelerator version |
---|
| 205 | !------------------------------------------------------------------------------! |
---|
| 206 | SUBROUTINE wall_fluxes_acc( wall_flux, a, b, c1, c2, nzb_uvw_inner, & |
---|
| 207 | nzb_uvw_outer, wall ) |
---|
[56] | 208 | |
---|
[1015] | 209 | USE arrays_3d |
---|
| 210 | USE control_parameters |
---|
| 211 | USE grid_variables |
---|
| 212 | USE indices |
---|
| 213 | USE statistics |
---|
| 214 | |
---|
| 215 | IMPLICIT NONE |
---|
| 216 | |
---|
| 217 | INTEGER :: i, j, k, max_outer, min_inner, wall_index |
---|
| 218 | |
---|
| 219 | INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg) :: nzb_uvw_inner, & |
---|
| 220 | nzb_uvw_outer |
---|
| 221 | REAL :: a, b, c1, c2, h1, h2, zp |
---|
| 222 | REAL :: pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts |
---|
| 223 | |
---|
| 224 | REAL, DIMENSION(nysg:nyng,nxlg:nxrg) :: wall |
---|
| 225 | REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: wall_flux |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 229 | wall_flux = 0.0 |
---|
| 230 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 231 | |
---|
| 232 | min_inner = MINVAL( nzb_uvw_inner(nys:nyn,nxl:nxr) ) + 1 |
---|
| 233 | max_outer = MINVAL( nzb_uvw_outer(nys:nyn,nxl:nxr) ) |
---|
| 234 | |
---|
| 235 | !$acc kernels present( hom, nzb_uvw_inner, nzb_uvw_outer, pt, rif_wall ) & |
---|
| 236 | !$acc present( u, v, w, wall, wall_flux, z0 ) |
---|
| 237 | !$acc loop |
---|
| 238 | DO i = nxl, nxr |
---|
| 239 | DO j = nys, nyn |
---|
| 240 | !$acc loop vector( 32 ) |
---|
| 241 | DO k = min_inner, max_outer |
---|
| 242 | ! |
---|
| 243 | !-- All subsequent variables are computed for the respective |
---|
| 244 | !-- location where the respective flux is defined. |
---|
| 245 | IF ( k >= nzb_uvw_inner(j,i)+1 .AND. & |
---|
| 246 | k <= nzb_uvw_outer(j,i) .AND. wall(j,i) /= 0.0 ) THEN |
---|
| 247 | ! |
---|
| 248 | !-- (1) Compute rifs, u_i, v_i, ws, pt' and w'pt' |
---|
| 249 | rifs = rif_wall(k,j,i,wall_index) |
---|
| 250 | |
---|
| 251 | u_i = a * u(k,j,i) + c1 * 0.25 * & |
---|
| 252 | ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) ) |
---|
| 253 | |
---|
| 254 | v_i = b * v(k,j,i) + c2 * 0.25 * & |
---|
| 255 | ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) ) |
---|
| 256 | |
---|
| 257 | ws = ( c1 + c2 ) * w(k,j,i) + 0.25 * ( & |
---|
| 258 | a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) & |
---|
| 259 | + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) & |
---|
| 260 | ) |
---|
| 261 | pt_i = 0.5 * ( pt(k,j,i) + a * pt(k,j,i-1) + & |
---|
| 262 | b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) ) |
---|
| 263 | |
---|
| 264 | pts = pt_i - hom(k,1,4,0) |
---|
| 265 | wspts = ws * pts |
---|
| 266 | |
---|
| 267 | ! |
---|
| 268 | !-- (2) Compute wall-parallel absolute velocity vel_total |
---|
| 269 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
| 270 | |
---|
| 271 | ! |
---|
| 272 | !-- (3) Compute wall friction velocity us_wall |
---|
| 273 | IF ( rifs >= 0.0 ) THEN |
---|
| 274 | |
---|
| 275 | ! |
---|
| 276 | !-- Stable stratification (and neutral) |
---|
| 277 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 278 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 279 | ) |
---|
| 280 | ELSE |
---|
| 281 | |
---|
| 282 | ! |
---|
| 283 | !-- Unstable stratification |
---|
| 284 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 285 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 286 | |
---|
| 287 | us_wall = kappa * vel_total / ( & |
---|
| 288 | LOG( zp / z0(j,i) ) - & |
---|
| 289 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 290 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 291 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 292 | ) |
---|
| 293 | ENDIF |
---|
| 294 | |
---|
| 295 | ! |
---|
| 296 | !-- (4) Compute zp/L (corresponds to neutral Richardson flux |
---|
| 297 | !-- number rifs) |
---|
| 298 | rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * & |
---|
| 299 | ( us_wall**3 + 1E-30 ) ) |
---|
| 300 | |
---|
| 301 | ! |
---|
| 302 | !-- Limit the value range of the Richardson numbers. |
---|
| 303 | !-- This is necessary for very small velocities (u,w --> 0), |
---|
| 304 | !-- because the absolute value of rif can then become very |
---|
| 305 | !-- large, which in consequence would result in very large |
---|
| 306 | !-- shear stresses and very small momentum fluxes (both are |
---|
| 307 | !-- generally unrealistic). |
---|
| 308 | IF ( rifs < rif_min ) rifs = rif_min |
---|
| 309 | IF ( rifs > rif_max ) rifs = rif_max |
---|
| 310 | |
---|
| 311 | ! |
---|
| 312 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
| 313 | IF ( rifs >= 0.0 ) THEN |
---|
| 314 | |
---|
| 315 | ! |
---|
| 316 | !-- Stable stratification (and neutral) |
---|
| 317 | wall_flux(k,j,i) = kappa * & |
---|
| 318 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / & |
---|
| 319 | ( LOG( zp / z0(j,i) ) + & |
---|
| 320 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 321 | ) |
---|
| 322 | ELSE |
---|
| 323 | |
---|
| 324 | ! |
---|
| 325 | !-- Unstable stratification |
---|
| 326 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 327 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 328 | |
---|
| 329 | wall_flux(k,j,i) = kappa * & |
---|
| 330 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / ( & |
---|
| 331 | LOG( zp / z0(j,i) ) - & |
---|
| 332 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 333 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 334 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 335 | ) |
---|
| 336 | ENDIF |
---|
| 337 | wall_flux(k,j,i) = -wall_flux(k,j,i) * us_wall |
---|
| 338 | |
---|
| 339 | ! |
---|
| 340 | !-- store rifs for next time step |
---|
| 341 | rif_wall(k,j,i,wall_index) = rifs |
---|
| 342 | |
---|
| 343 | ENDIF |
---|
| 344 | |
---|
| 345 | ENDDO |
---|
| 346 | ENDDO |
---|
| 347 | ENDDO |
---|
| 348 | !$acc end kernels |
---|
| 349 | |
---|
| 350 | END SUBROUTINE wall_fluxes_acc |
---|
| 351 | |
---|
| 352 | |
---|
[56] | 353 | !------------------------------------------------------------------------------! |
---|
| 354 | ! Call for all grid point i,j |
---|
| 355 | !------------------------------------------------------------------------------! |
---|
| 356 | SUBROUTINE wall_fluxes_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 ) |
---|
| 357 | |
---|
| 358 | USE arrays_3d |
---|
| 359 | USE control_parameters |
---|
| 360 | USE grid_variables |
---|
| 361 | USE indices |
---|
| 362 | USE statistics |
---|
| 363 | |
---|
| 364 | IMPLICIT NONE |
---|
| 365 | |
---|
| 366 | INTEGER :: i, j, k, nzb_w, nzt_w, wall_index |
---|
| 367 | REAL :: a, b, c1, c2, h1, h2, zp |
---|
| 368 | |
---|
| 369 | REAL :: pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts |
---|
| 370 | |
---|
| 371 | REAL, DIMENSION(nzb:nzt+1) :: wall_flux |
---|
| 372 | |
---|
| 373 | |
---|
| 374 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 375 | wall_flux = 0.0 |
---|
| 376 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 377 | |
---|
| 378 | ! |
---|
| 379 | !-- All subsequent variables are computed for the respective location where |
---|
[187] | 380 | !-- the respective flux is defined. |
---|
[56] | 381 | DO k = nzb_w, nzt_w |
---|
| 382 | |
---|
| 383 | ! |
---|
| 384 | !-- (1) Compute rifs, u_i, v_i, ws, pt' and w'pt' |
---|
| 385 | rifs = rif_wall(k,j,i,wall_index) |
---|
| 386 | |
---|
| 387 | u_i = a * u(k,j,i) + c1 * 0.25 * & |
---|
| 388 | ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) ) |
---|
| 389 | |
---|
| 390 | v_i = b * v(k,j,i) + c2 * 0.25 * & |
---|
| 391 | ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) ) |
---|
| 392 | |
---|
| 393 | ws = ( c1 + c2 ) * w(k,j,i) + 0.25 * ( & |
---|
| 394 | a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) & |
---|
| 395 | + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) & |
---|
| 396 | ) |
---|
| 397 | pt_i = 0.5 * ( pt(k,j,i) + a * pt(k,j,i-1) + b * pt(k,j-1,i) & |
---|
| 398 | + ( c1 + c2 ) * pt(k+1,j,i) ) |
---|
| 399 | |
---|
| 400 | pts = pt_i - hom(k,1,4,0) |
---|
| 401 | wspts = ws * pts |
---|
| 402 | |
---|
| 403 | ! |
---|
| 404 | !-- (2) Compute wall-parallel absolute velocity vel_total |
---|
| 405 | vel_total = SQRT( ws**2 + ( a+c1 ) * u_i**2 + ( b+c2 ) * v_i**2 ) |
---|
| 406 | |
---|
| 407 | ! |
---|
| 408 | !-- (3) Compute wall friction velocity us_wall |
---|
| 409 | IF ( rifs >= 0.0 ) THEN |
---|
| 410 | |
---|
| 411 | ! |
---|
| 412 | !-- Stable stratification (and neutral) |
---|
| 413 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 414 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 415 | ) |
---|
| 416 | ELSE |
---|
| 417 | |
---|
| 418 | ! |
---|
| 419 | !-- Unstable stratification |
---|
[187] | 420 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 421 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[56] | 422 | |
---|
[187] | 423 | us_wall = kappa * vel_total / ( & |
---|
| 424 | LOG( zp / z0(j,i) ) - & |
---|
| 425 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 426 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 427 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 428 | ) |
---|
[56] | 429 | ENDIF |
---|
| 430 | |
---|
| 431 | ! |
---|
| 432 | !-- (4) Compute zp/L (corresponds to neutral Richardson flux number |
---|
| 433 | !-- rifs) |
---|
| 434 | rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * (us_wall**3 + 1E-30) ) |
---|
| 435 | |
---|
| 436 | ! |
---|
| 437 | !-- Limit the value range of the Richardson numbers. |
---|
| 438 | !-- This is necessary for very small velocities (u,w --> 0), because |
---|
| 439 | !-- the absolute value of rif can then become very large, which in |
---|
| 440 | !-- consequence would result in very large shear stresses and very |
---|
| 441 | !-- small momentum fluxes (both are generally unrealistic). |
---|
| 442 | IF ( rifs < rif_min ) rifs = rif_min |
---|
| 443 | IF ( rifs > rif_max ) rifs = rif_max |
---|
| 444 | |
---|
| 445 | ! |
---|
| 446 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
| 447 | IF ( rifs >= 0.0 ) THEN |
---|
| 448 | |
---|
| 449 | ! |
---|
| 450 | !-- Stable stratification (and neutral) |
---|
[53] | 451 | wall_flux(k) = kappa * & |
---|
| 452 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / & |
---|
[56] | 453 | ( LOG( zp / z0(j,i) ) + & |
---|
| 454 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
[53] | 455 | ) |
---|
[52] | 456 | ELSE |
---|
[53] | 457 | |
---|
[56] | 458 | ! |
---|
| 459 | !-- Unstable stratification |
---|
[187] | 460 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 461 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[52] | 462 | |
---|
[187] | 463 | wall_flux(k) = kappa * & |
---|
| 464 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / ( & |
---|
| 465 | LOG( zp / z0(j,i) ) - & |
---|
| 466 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 467 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 468 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 469 | ) |
---|
[56] | 470 | ENDIF |
---|
[187] | 471 | wall_flux(k) = -wall_flux(k) * us_wall |
---|
[53] | 472 | |
---|
[56] | 473 | ! |
---|
| 474 | !-- store rifs for next time step |
---|
| 475 | rif_wall(k,j,i,wall_index) = rifs |
---|
[53] | 476 | |
---|
[56] | 477 | ENDDO |
---|
[53] | 478 | |
---|
[56] | 479 | END SUBROUTINE wall_fluxes_ij |
---|
[53] | 480 | |
---|
[56] | 481 | |
---|
| 482 | |
---|
[53] | 483 | !------------------------------------------------------------------------------! |
---|
[56] | 484 | ! Call for all grid points |
---|
| 485 | !------------------------------------------------------------------------------! |
---|
| 486 | SUBROUTINE wall_fluxes_e( wall_flux, a, b, c1, c2, wall ) |
---|
| 487 | |
---|
| 488 | !------------------------------------------------------------------------------! |
---|
[53] | 489 | ! Description: |
---|
| 490 | ! ------------ |
---|
| 491 | ! Calculates momentum fluxes at vertical walls for routine production_e |
---|
| 492 | ! assuming Monin-Obukhov similarity. |
---|
| 493 | ! Indices: usvs a=1, vsus b=1, wsvs c1=1, wsus c2=1 (other=0). |
---|
| 494 | !------------------------------------------------------------------------------! |
---|
| 495 | |
---|
[56] | 496 | USE arrays_3d |
---|
| 497 | USE control_parameters |
---|
| 498 | USE grid_variables |
---|
| 499 | USE indices |
---|
| 500 | USE statistics |
---|
[53] | 501 | |
---|
[56] | 502 | IMPLICIT NONE |
---|
[53] | 503 | |
---|
[56] | 504 | INTEGER :: i, j, k, kk, wall_index |
---|
[187] | 505 | REAL :: a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, & |
---|
| 506 | ws, zp |
---|
[53] | 507 | |
---|
[56] | 508 | REAL :: rifs |
---|
[53] | 509 | |
---|
[667] | 510 | REAL, DIMENSION(nysg:nyng,nxlg:nxrg) :: wall |
---|
[56] | 511 | REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: wall_flux |
---|
[53] | 512 | |
---|
| 513 | |
---|
[56] | 514 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 515 | wall_flux = 0.0 |
---|
| 516 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
[53] | 517 | |
---|
[56] | 518 | DO i = nxl, nxr |
---|
| 519 | DO j = nys, nyn |
---|
| 520 | |
---|
| 521 | IF ( wall(j,i) /= 0.0 ) THEN |
---|
[53] | 522 | ! |
---|
[187] | 523 | !-- All subsequent variables are computed for scalar locations. |
---|
[56] | 524 | DO k = nzb_diff_s_inner(j,i)-1, nzb_diff_s_outer(j,i)-2 |
---|
[53] | 525 | ! |
---|
[187] | 526 | !-- (1) Compute rifs, u_i, v_i, and ws |
---|
[56] | 527 | IF ( k == nzb_diff_s_inner(j,i)-1 ) THEN |
---|
| 528 | kk = nzb_diff_s_inner(j,i)-1 |
---|
| 529 | ELSE |
---|
| 530 | kk = k-1 |
---|
| 531 | ENDIF |
---|
| 532 | rifs = 0.5 * ( rif_wall(k,j,i,wall_index) + & |
---|
| 533 | a * rif_wall(k,j,i+1,1) + b * rif_wall(k,j+1,i,2) + & |
---|
| 534 | c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4) & |
---|
| 535 | ) |
---|
[53] | 536 | |
---|
[187] | 537 | u_i = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) |
---|
| 538 | v_i = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) |
---|
| 539 | ws = 0.5 * ( w(k,j,i) + w(k-1,j,i) ) |
---|
[53] | 540 | ! |
---|
[187] | 541 | !-- (2) Compute wall-parallel absolute velocity vel_total and |
---|
| 542 | !-- interpolate appropriate velocity component vel_zp. |
---|
| 543 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
| 544 | vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws ) |
---|
| 545 | ! |
---|
| 546 | !-- (3) Compute wall friction velocity us_wall |
---|
| 547 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 548 | |
---|
| 549 | ! |
---|
[187] | 550 | !-- Stable stratification (and neutral) |
---|
| 551 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 552 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 553 | ) |
---|
| 554 | ELSE |
---|
| 555 | |
---|
| 556 | ! |
---|
| 557 | !-- Unstable stratification |
---|
| 558 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 559 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 560 | |
---|
| 561 | us_wall = kappa * vel_total / ( & |
---|
| 562 | LOG( zp / z0(j,i) ) - & |
---|
| 563 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 564 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 565 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 566 | ) |
---|
| 567 | ENDIF |
---|
| 568 | |
---|
| 569 | ! |
---|
| 570 | !-- Skip step (4) of wall_fluxes, because here rifs is already |
---|
| 571 | !-- available from (1) |
---|
| 572 | ! |
---|
[56] | 573 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
[55] | 574 | |
---|
[56] | 575 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 576 | |
---|
| 577 | ! |
---|
[56] | 578 | !-- Stable stratification (and neutral) |
---|
| 579 | wall_flux(k,j,i) = kappa * vel_zp / & |
---|
| 580 | ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp ) |
---|
| 581 | ELSE |
---|
[53] | 582 | |
---|
| 583 | ! |
---|
[56] | 584 | !-- Unstable stratification |
---|
[187] | 585 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 586 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[53] | 587 | |
---|
[187] | 588 | wall_flux(k,j,i) = kappa * vel_zp / ( & |
---|
| 589 | LOG( zp / z0(j,i) ) - & |
---|
| 590 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 591 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 592 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 593 | ) |
---|
[56] | 594 | ENDIF |
---|
[187] | 595 | wall_flux(k,j,i) = - wall_flux(k,j,i) * us_wall |
---|
[56] | 596 | |
---|
| 597 | ENDDO |
---|
| 598 | |
---|
| 599 | ENDIF |
---|
| 600 | |
---|
| 601 | ENDDO |
---|
| 602 | ENDDO |
---|
| 603 | |
---|
| 604 | END SUBROUTINE wall_fluxes_e |
---|
| 605 | |
---|
| 606 | |
---|
[1015] | 607 | !------------------------------------------------------------------------------! |
---|
| 608 | ! Call for all grid points - accelerator version |
---|
| 609 | !------------------------------------------------------------------------------! |
---|
| 610 | SUBROUTINE wall_fluxes_e_acc( wall_flux, a, b, c1, c2, wall ) |
---|
[56] | 611 | |
---|
| 612 | !------------------------------------------------------------------------------! |
---|
[1015] | 613 | ! Description: |
---|
| 614 | ! ------------ |
---|
| 615 | ! Calculates momentum fluxes at vertical walls for routine production_e |
---|
| 616 | ! assuming Monin-Obukhov similarity. |
---|
| 617 | ! Indices: usvs a=1, vsus b=1, wsvs c1=1, wsus c2=1 (other=0). |
---|
| 618 | !------------------------------------------------------------------------------! |
---|
| 619 | |
---|
| 620 | USE arrays_3d |
---|
| 621 | USE control_parameters |
---|
| 622 | USE grid_variables |
---|
| 623 | USE indices |
---|
| 624 | USE statistics |
---|
| 625 | |
---|
| 626 | IMPLICIT NONE |
---|
| 627 | |
---|
| 628 | INTEGER :: i, j, k, kk, max_outer, min_inner, wall_index |
---|
| 629 | REAL :: a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, & |
---|
| 630 | ws, zp |
---|
| 631 | |
---|
| 632 | REAL :: rifs |
---|
| 633 | |
---|
| 634 | REAL, DIMENSION(nysg:nyng,nxlg:nxrg) :: wall |
---|
| 635 | REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: wall_flux |
---|
| 636 | |
---|
| 637 | |
---|
| 638 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 639 | wall_flux = 0.0 |
---|
| 640 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 641 | |
---|
| 642 | min_inner = MINVAL( nzb_diff_s_inner(nys:nyn,nxl:nxr) ) - 1 |
---|
| 643 | max_outer = MAXVAL( nzb_diff_s_outer(nys:nyn,nxl:nxr) ) - 2 |
---|
| 644 | |
---|
| 645 | !$acc kernels present( nzb_diff_s_inner, nzb_diff_s_outer, pt, rif_wall ) & |
---|
| 646 | !$acc present( u, v, w, wall, wall_flux, z0 ) |
---|
| 647 | !$acc loop |
---|
| 648 | DO i = nxl, nxr |
---|
| 649 | DO j = nys, nyn |
---|
| 650 | !$acc loop vector(32) |
---|
| 651 | DO k = min_inner, max_outer |
---|
| 652 | ! |
---|
| 653 | !-- All subsequent variables are computed for scalar locations |
---|
| 654 | IF ( k >= nzb_diff_s_inner(j,i)-1 .AND. & |
---|
| 655 | k <= nzb_diff_s_outer(j,i)-2 .AND. wall(j,i) /= 0.0 ) THEN |
---|
| 656 | ! |
---|
| 657 | !-- (1) Compute rifs, u_i, v_i, and ws |
---|
| 658 | IF ( k == nzb_diff_s_inner(j,i)-1 ) THEN |
---|
| 659 | kk = nzb_diff_s_inner(j,i)-1 |
---|
| 660 | ELSE |
---|
| 661 | kk = k-1 |
---|
| 662 | ENDIF |
---|
| 663 | rifs = 0.5 * ( rif_wall(k,j,i,wall_index) + & |
---|
| 664 | a * rif_wall(k,j,i+1,1) + b * rif_wall(k,j+1,i,2) + & |
---|
| 665 | c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4) & |
---|
| 666 | ) |
---|
| 667 | |
---|
| 668 | u_i = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) |
---|
| 669 | v_i = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) |
---|
| 670 | ws = 0.5 * ( w(k,j,i) + w(k-1,j,i) ) |
---|
| 671 | ! |
---|
| 672 | !-- (2) Compute wall-parallel absolute velocity vel_total and |
---|
| 673 | !-- interpolate appropriate velocity component vel_zp. |
---|
| 674 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
| 675 | vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws ) |
---|
| 676 | ! |
---|
| 677 | !-- (3) Compute wall friction velocity us_wall |
---|
| 678 | IF ( rifs >= 0.0 ) THEN |
---|
| 679 | |
---|
| 680 | ! |
---|
| 681 | !-- Stable stratification (and neutral) |
---|
| 682 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 683 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 684 | ) |
---|
| 685 | ELSE |
---|
| 686 | |
---|
| 687 | ! |
---|
| 688 | !-- Unstable stratification |
---|
| 689 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 690 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 691 | |
---|
| 692 | us_wall = kappa * vel_total / ( & |
---|
| 693 | LOG( zp / z0(j,i) ) - & |
---|
| 694 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 695 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 696 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 697 | ) |
---|
| 698 | ENDIF |
---|
| 699 | |
---|
| 700 | ! |
---|
| 701 | !-- Skip step (4) of wall_fluxes, because here rifs is already |
---|
| 702 | !-- available from (1) |
---|
| 703 | ! |
---|
| 704 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
| 705 | |
---|
| 706 | IF ( rifs >= 0.0 ) THEN |
---|
| 707 | |
---|
| 708 | ! |
---|
| 709 | !-- Stable stratification (and neutral) |
---|
| 710 | wall_flux(k,j,i) = kappa * vel_zp / & |
---|
| 711 | ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp ) |
---|
| 712 | ELSE |
---|
| 713 | |
---|
| 714 | ! |
---|
| 715 | !-- Unstable stratification |
---|
| 716 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 717 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 718 | |
---|
| 719 | wall_flux(k,j,i) = kappa * vel_zp / ( & |
---|
| 720 | LOG( zp / z0(j,i) ) - & |
---|
| 721 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 722 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 723 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 724 | ) |
---|
| 725 | ENDIF |
---|
| 726 | wall_flux(k,j,i) = - wall_flux(k,j,i) * us_wall |
---|
| 727 | |
---|
| 728 | ENDIF |
---|
| 729 | |
---|
| 730 | ENDDO |
---|
| 731 | ENDDO |
---|
| 732 | ENDDO |
---|
| 733 | !$acc end kernels |
---|
| 734 | |
---|
| 735 | END SUBROUTINE wall_fluxes_e_acc |
---|
| 736 | |
---|
| 737 | |
---|
| 738 | !------------------------------------------------------------------------------! |
---|
[56] | 739 | ! Call for grid point i,j |
---|
| 740 | !------------------------------------------------------------------------------! |
---|
| 741 | SUBROUTINE wall_fluxes_e_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 ) |
---|
| 742 | |
---|
| 743 | USE arrays_3d |
---|
| 744 | USE control_parameters |
---|
| 745 | USE grid_variables |
---|
| 746 | USE indices |
---|
| 747 | USE statistics |
---|
| 748 | |
---|
| 749 | IMPLICIT NONE |
---|
| 750 | |
---|
| 751 | INTEGER :: i, j, k, kk, nzb_w, nzt_w, wall_index |
---|
[187] | 752 | REAL :: a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, & |
---|
| 753 | ws, zp |
---|
[56] | 754 | |
---|
| 755 | REAL :: rifs |
---|
| 756 | |
---|
| 757 | REAL, DIMENSION(nzb:nzt+1) :: wall_flux |
---|
| 758 | |
---|
| 759 | |
---|
| 760 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 761 | wall_flux = 0.0 |
---|
| 762 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 763 | |
---|
| 764 | ! |
---|
[187] | 765 | !-- All subsequent variables are computed for scalar locations. |
---|
[56] | 766 | DO k = nzb_w, nzt_w |
---|
| 767 | |
---|
| 768 | ! |
---|
[187] | 769 | !-- (1) Compute rifs, u_i, v_i, and ws |
---|
[56] | 770 | IF ( k == nzb_w ) THEN |
---|
| 771 | kk = nzb_w |
---|
[53] | 772 | ELSE |
---|
[56] | 773 | kk = k-1 |
---|
| 774 | ENDIF |
---|
| 775 | rifs = 0.5 * ( rif_wall(k,j,i,wall_index) + & |
---|
| 776 | a * rif_wall(k,j,i+1,1) + b * rif_wall(k,j+1,i,2) + & |
---|
| 777 | c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4) & |
---|
| 778 | ) |
---|
| 779 | |
---|
[187] | 780 | u_i = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) |
---|
| 781 | v_i = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) |
---|
| 782 | ws = 0.5 * ( w(k,j,i) + w(k-1,j,i) ) |
---|
[56] | 783 | ! |
---|
[187] | 784 | !-- (2) Compute wall-parallel absolute velocity vel_total and |
---|
| 785 | !-- interpolate appropriate velocity component vel_zp. |
---|
| 786 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
| 787 | vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws ) |
---|
| 788 | ! |
---|
| 789 | !-- (3) Compute wall friction velocity us_wall |
---|
| 790 | IF ( rifs >= 0.0 ) THEN |
---|
[56] | 791 | |
---|
| 792 | ! |
---|
[187] | 793 | !-- Stable stratification (and neutral) |
---|
| 794 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 795 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 796 | ) |
---|
| 797 | ELSE |
---|
| 798 | |
---|
| 799 | ! |
---|
| 800 | !-- Unstable stratification |
---|
| 801 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 802 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 803 | |
---|
| 804 | us_wall = kappa * vel_total / ( & |
---|
| 805 | LOG( zp / z0(j,i) ) - & |
---|
| 806 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 807 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 808 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 809 | ) |
---|
| 810 | ENDIF |
---|
| 811 | |
---|
| 812 | ! |
---|
| 813 | !-- Skip step (4) of wall_fluxes, because here rifs is already |
---|
| 814 | !-- available from (1) |
---|
| 815 | ! |
---|
[56] | 816 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
[187] | 817 | !-- First interpolate the velocity (this is different from |
---|
| 818 | !-- subroutine wall_fluxes because fluxes in subroutine |
---|
| 819 | !-- wall_fluxes_e are defined at scalar locations). |
---|
[56] | 820 | vel_zp = 0.5 * ( a * ( u(k,j,i) + u(k,j,i+1) ) + & |
---|
| 821 | b * ( v(k,j,i) + v(k,j+1,i) ) + & |
---|
| 822 | (c1+c2) * ( w(k,j,i) + w(k-1,j,i) ) & |
---|
| 823 | ) |
---|
| 824 | |
---|
| 825 | IF ( rifs >= 0.0 ) THEN |
---|
| 826 | |
---|
| 827 | ! |
---|
| 828 | !-- Stable stratification (and neutral) |
---|
| 829 | wall_flux(k) = kappa * vel_zp / & |
---|
| 830 | ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp ) |
---|
| 831 | ELSE |
---|
| 832 | |
---|
| 833 | ! |
---|
| 834 | !-- Unstable stratification |
---|
[187] | 835 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 836 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[56] | 837 | |
---|
[187] | 838 | wall_flux(k) = kappa * vel_zp / ( & |
---|
| 839 | LOG( zp / z0(j,i) ) - & |
---|
| 840 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 841 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 842 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 843 | ) |
---|
[53] | 844 | ENDIF |
---|
[187] | 845 | wall_flux(k) = - wall_flux(k) * us_wall |
---|
[53] | 846 | |
---|
[56] | 847 | ENDDO |
---|
[53] | 848 | |
---|
[56] | 849 | END SUBROUTINE wall_fluxes_e_ij |
---|
| 850 | |
---|
| 851 | END MODULE wall_fluxes_mod |
---|