[56] | 1 | MODULE wall_fluxes_mod |
---|
[52] | 2 | !------------------------------------------------------------------------------! |
---|
[484] | 3 | ! Current revisions: |
---|
[52] | 4 | ! ----------------- |
---|
[198] | 5 | ! |
---|
| 6 | ! |
---|
| 7 | ! Former revisions: |
---|
| 8 | ! ----------------- |
---|
| 9 | ! $Id: wall_fluxes.f90 667 2010-12-23 12:06:00Z franke $ |
---|
| 10 | ! |
---|
| 11 | ! 187 2008-08-06 16:25:09Z letzel |
---|
| 12 | ! Bugfix: Modification of the evaluation of the vertical turbulent momentum |
---|
| 13 | ! fluxes u'w' and v'w (see prandtl_fluxes), this requires the calculation of |
---|
| 14 | ! us_wall (and vel_total, u_i, v_i, ws) also in wall_fluxes_e. |
---|
| 15 | ! Bugfix: change definition of us_wall from 1D to 2D |
---|
[187] | 16 | ! Bugfix: storage of rifs to rifs_wall in wall_fluxes_e removed |
---|
| 17 | ! Change: add 'minus' sign to fluxes produced by subroutine wall_fluxes_e for |
---|
[198] | 18 | ! consistency with subroutine wall_fluxes |
---|
[187] | 19 | ! Change: Modification of the integrated version of the profile function for |
---|
[198] | 20 | ! momentum for unstable stratification |
---|
[52] | 21 | ! |
---|
| 22 | ! Initial version (2007/03/07) |
---|
| 23 | ! |
---|
| 24 | ! Description: |
---|
| 25 | ! ------------ |
---|
| 26 | ! Calculates momentum fluxes at vertical walls assuming Monin-Obukhov |
---|
| 27 | ! similarity. |
---|
| 28 | ! Indices: usvs a=1, vsus b=1, wsvs c1=1, wsus c2=1 (other=0). |
---|
[56] | 29 | ! The all-gridpoint version of wall_fluxes_e is not used so far, because |
---|
| 30 | ! it gives slightly different results from the ij-version for some unknown |
---|
| 31 | ! reason. |
---|
[52] | 32 | !------------------------------------------------------------------------------! |
---|
[56] | 33 | PRIVATE |
---|
| 34 | PUBLIC wall_fluxes, wall_fluxes_e |
---|
| 35 | |
---|
| 36 | INTERFACE wall_fluxes |
---|
| 37 | MODULE PROCEDURE wall_fluxes |
---|
| 38 | MODULE PROCEDURE wall_fluxes_ij |
---|
| 39 | END INTERFACE wall_fluxes |
---|
| 40 | |
---|
| 41 | INTERFACE wall_fluxes_e |
---|
| 42 | MODULE PROCEDURE wall_fluxes_e |
---|
| 43 | MODULE PROCEDURE wall_fluxes_e_ij |
---|
| 44 | END INTERFACE wall_fluxes_e |
---|
| 45 | |
---|
| 46 | CONTAINS |
---|
[52] | 47 | |
---|
[56] | 48 | !------------------------------------------------------------------------------! |
---|
| 49 | ! Call for all grid points |
---|
| 50 | !------------------------------------------------------------------------------! |
---|
[75] | 51 | SUBROUTINE wall_fluxes( wall_flux, a, b, c1, c2, nzb_uvw_inner, & |
---|
[56] | 52 | nzb_uvw_outer, wall ) |
---|
[52] | 53 | |
---|
[56] | 54 | USE arrays_3d |
---|
| 55 | USE control_parameters |
---|
| 56 | USE grid_variables |
---|
| 57 | USE indices |
---|
| 58 | USE statistics |
---|
[52] | 59 | |
---|
[56] | 60 | IMPLICIT NONE |
---|
[52] | 61 | |
---|
[75] | 62 | INTEGER :: i, j, k, wall_index |
---|
[52] | 63 | |
---|
[667] | 64 | INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg) :: nzb_uvw_inner, & |
---|
[56] | 65 | nzb_uvw_outer |
---|
| 66 | REAL :: a, b, c1, c2, h1, h2, zp |
---|
| 67 | REAL :: pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts |
---|
[52] | 68 | |
---|
[667] | 69 | REAL, DIMENSION(nysg:nyng,nxlg:nxrg) :: wall |
---|
[75] | 70 | REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: wall_flux |
---|
[52] | 71 | |
---|
| 72 | |
---|
[56] | 73 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 74 | wall_flux = 0.0 |
---|
| 75 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 76 | |
---|
[75] | 77 | DO i = nxl, nxr |
---|
| 78 | DO j = nys, nyn |
---|
[56] | 79 | |
---|
| 80 | IF ( wall(j,i) /= 0.0 ) THEN |
---|
[52] | 81 | ! |
---|
[56] | 82 | !-- All subsequent variables are computed for the respective |
---|
[187] | 83 | !-- location where the respective flux is defined. |
---|
[56] | 84 | DO k = nzb_uvw_inner(j,i)+1, nzb_uvw_outer(j,i) |
---|
[53] | 85 | |
---|
[52] | 86 | ! |
---|
[56] | 87 | !-- (1) Compute rifs, u_i, v_i, ws, pt' and w'pt' |
---|
| 88 | rifs = rif_wall(k,j,i,wall_index) |
---|
[53] | 89 | |
---|
[56] | 90 | u_i = a * u(k,j,i) + c1 * 0.25 * & |
---|
| 91 | ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) ) |
---|
[53] | 92 | |
---|
[56] | 93 | v_i = b * v(k,j,i) + c2 * 0.25 * & |
---|
| 94 | ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) ) |
---|
[53] | 95 | |
---|
[56] | 96 | ws = ( c1 + c2 ) * w(k,j,i) + 0.25 * ( & |
---|
| 97 | a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) & |
---|
| 98 | + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) & |
---|
| 99 | ) |
---|
| 100 | pt_i = 0.5 * ( pt(k,j,i) + a * pt(k,j,i-1) + & |
---|
| 101 | b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) ) |
---|
[53] | 102 | |
---|
[56] | 103 | pts = pt_i - hom(k,1,4,0) |
---|
| 104 | wspts = ws * pts |
---|
[53] | 105 | |
---|
[52] | 106 | ! |
---|
[56] | 107 | !-- (2) Compute wall-parallel absolute velocity vel_total |
---|
| 108 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
[53] | 109 | |
---|
[52] | 110 | ! |
---|
[56] | 111 | !-- (3) Compute wall friction velocity us_wall |
---|
| 112 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 113 | |
---|
[52] | 114 | ! |
---|
[56] | 115 | !-- Stable stratification (and neutral) |
---|
| 116 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 117 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 118 | ) |
---|
| 119 | ELSE |
---|
[53] | 120 | |
---|
[52] | 121 | ! |
---|
[56] | 122 | !-- Unstable stratification |
---|
[187] | 123 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 124 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[53] | 125 | |
---|
[187] | 126 | us_wall = kappa * vel_total / ( & |
---|
| 127 | LOG( zp / z0(j,i) ) - & |
---|
| 128 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 129 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 130 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 131 | ) |
---|
[56] | 132 | ENDIF |
---|
[53] | 133 | |
---|
[52] | 134 | ! |
---|
[56] | 135 | !-- (4) Compute zp/L (corresponds to neutral Richardson flux |
---|
| 136 | !-- number rifs) |
---|
| 137 | rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * & |
---|
| 138 | ( us_wall**3 + 1E-30 ) ) |
---|
[53] | 139 | |
---|
[52] | 140 | ! |
---|
[56] | 141 | !-- Limit the value range of the Richardson numbers. |
---|
| 142 | !-- This is necessary for very small velocities (u,w --> 0), |
---|
| 143 | !-- because the absolute value of rif can then become very |
---|
| 144 | !-- large, which in consequence would result in very large |
---|
| 145 | !-- shear stresses and very small momentum fluxes (both are |
---|
| 146 | !-- generally unrealistic). |
---|
| 147 | IF ( rifs < rif_min ) rifs = rif_min |
---|
| 148 | IF ( rifs > rif_max ) rifs = rif_max |
---|
[53] | 149 | |
---|
[52] | 150 | ! |
---|
[56] | 151 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
| 152 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 153 | |
---|
[52] | 154 | ! |
---|
[56] | 155 | !-- Stable stratification (and neutral) |
---|
| 156 | wall_flux(k,j,i) = kappa * & |
---|
| 157 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / & |
---|
| 158 | ( LOG( zp / z0(j,i) ) + & |
---|
| 159 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 160 | ) |
---|
| 161 | ELSE |
---|
[53] | 162 | |
---|
[52] | 163 | ! |
---|
[56] | 164 | !-- Unstable stratification |
---|
[187] | 165 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 166 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[53] | 167 | |
---|
[187] | 168 | wall_flux(k,j,i) = kappa * & |
---|
| 169 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / ( & |
---|
| 170 | LOG( zp / z0(j,i) ) - & |
---|
| 171 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 172 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 173 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 174 | ) |
---|
[56] | 175 | ENDIF |
---|
[187] | 176 | wall_flux(k,j,i) = -wall_flux(k,j,i) * us_wall |
---|
[56] | 177 | |
---|
| 178 | ! |
---|
| 179 | !-- store rifs for next time step |
---|
| 180 | rif_wall(k,j,i,wall_index) = rifs |
---|
| 181 | |
---|
| 182 | ENDDO |
---|
| 183 | |
---|
| 184 | ENDIF |
---|
| 185 | |
---|
| 186 | ENDDO |
---|
| 187 | ENDDO |
---|
| 188 | |
---|
| 189 | END SUBROUTINE wall_fluxes |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | |
---|
| 193 | !------------------------------------------------------------------------------! |
---|
| 194 | ! Call for all grid point i,j |
---|
| 195 | !------------------------------------------------------------------------------! |
---|
| 196 | SUBROUTINE wall_fluxes_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 ) |
---|
| 197 | |
---|
| 198 | USE arrays_3d |
---|
| 199 | USE control_parameters |
---|
| 200 | USE grid_variables |
---|
| 201 | USE indices |
---|
| 202 | USE statistics |
---|
| 203 | |
---|
| 204 | IMPLICIT NONE |
---|
| 205 | |
---|
| 206 | INTEGER :: i, j, k, nzb_w, nzt_w, wall_index |
---|
| 207 | REAL :: a, b, c1, c2, h1, h2, zp |
---|
| 208 | |
---|
| 209 | REAL :: pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts |
---|
| 210 | |
---|
| 211 | REAL, DIMENSION(nzb:nzt+1) :: wall_flux |
---|
| 212 | |
---|
| 213 | |
---|
| 214 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 215 | wall_flux = 0.0 |
---|
| 216 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 217 | |
---|
| 218 | ! |
---|
| 219 | !-- All subsequent variables are computed for the respective location where |
---|
[187] | 220 | !-- the respective flux is defined. |
---|
[56] | 221 | DO k = nzb_w, nzt_w |
---|
| 222 | |
---|
| 223 | ! |
---|
| 224 | !-- (1) Compute rifs, u_i, v_i, ws, pt' and w'pt' |
---|
| 225 | rifs = rif_wall(k,j,i,wall_index) |
---|
| 226 | |
---|
| 227 | u_i = a * u(k,j,i) + c1 * 0.25 * & |
---|
| 228 | ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) ) |
---|
| 229 | |
---|
| 230 | v_i = b * v(k,j,i) + c2 * 0.25 * & |
---|
| 231 | ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) ) |
---|
| 232 | |
---|
| 233 | ws = ( c1 + c2 ) * w(k,j,i) + 0.25 * ( & |
---|
| 234 | a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) & |
---|
| 235 | + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) & |
---|
| 236 | ) |
---|
| 237 | pt_i = 0.5 * ( pt(k,j,i) + a * pt(k,j,i-1) + b * pt(k,j-1,i) & |
---|
| 238 | + ( c1 + c2 ) * pt(k+1,j,i) ) |
---|
| 239 | |
---|
| 240 | pts = pt_i - hom(k,1,4,0) |
---|
| 241 | wspts = ws * pts |
---|
| 242 | |
---|
| 243 | ! |
---|
| 244 | !-- (2) Compute wall-parallel absolute velocity vel_total |
---|
| 245 | vel_total = SQRT( ws**2 + ( a+c1 ) * u_i**2 + ( b+c2 ) * v_i**2 ) |
---|
| 246 | |
---|
| 247 | ! |
---|
| 248 | !-- (3) Compute wall friction velocity us_wall |
---|
| 249 | IF ( rifs >= 0.0 ) THEN |
---|
| 250 | |
---|
| 251 | ! |
---|
| 252 | !-- Stable stratification (and neutral) |
---|
| 253 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 254 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 255 | ) |
---|
| 256 | ELSE |
---|
| 257 | |
---|
| 258 | ! |
---|
| 259 | !-- Unstable stratification |
---|
[187] | 260 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 261 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[56] | 262 | |
---|
[187] | 263 | us_wall = kappa * vel_total / ( & |
---|
| 264 | LOG( zp / z0(j,i) ) - & |
---|
| 265 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 266 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 267 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 268 | ) |
---|
[56] | 269 | ENDIF |
---|
| 270 | |
---|
| 271 | ! |
---|
| 272 | !-- (4) Compute zp/L (corresponds to neutral Richardson flux number |
---|
| 273 | !-- rifs) |
---|
| 274 | rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * (us_wall**3 + 1E-30) ) |
---|
| 275 | |
---|
| 276 | ! |
---|
| 277 | !-- Limit the value range of the Richardson numbers. |
---|
| 278 | !-- This is necessary for very small velocities (u,w --> 0), because |
---|
| 279 | !-- the absolute value of rif can then become very large, which in |
---|
| 280 | !-- consequence would result in very large shear stresses and very |
---|
| 281 | !-- small momentum fluxes (both are generally unrealistic). |
---|
| 282 | IF ( rifs < rif_min ) rifs = rif_min |
---|
| 283 | IF ( rifs > rif_max ) rifs = rif_max |
---|
| 284 | |
---|
| 285 | ! |
---|
| 286 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
| 287 | IF ( rifs >= 0.0 ) THEN |
---|
| 288 | |
---|
| 289 | ! |
---|
| 290 | !-- Stable stratification (and neutral) |
---|
[53] | 291 | wall_flux(k) = kappa * & |
---|
| 292 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / & |
---|
[56] | 293 | ( LOG( zp / z0(j,i) ) + & |
---|
| 294 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
[53] | 295 | ) |
---|
[52] | 296 | ELSE |
---|
[53] | 297 | |
---|
[56] | 298 | ! |
---|
| 299 | !-- Unstable stratification |
---|
[187] | 300 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 301 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[52] | 302 | |
---|
[187] | 303 | wall_flux(k) = kappa * & |
---|
| 304 | ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / ( & |
---|
| 305 | LOG( zp / z0(j,i) ) - & |
---|
| 306 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 307 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 308 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 309 | ) |
---|
[56] | 310 | ENDIF |
---|
[187] | 311 | wall_flux(k) = -wall_flux(k) * us_wall |
---|
[53] | 312 | |
---|
[56] | 313 | ! |
---|
| 314 | !-- store rifs for next time step |
---|
| 315 | rif_wall(k,j,i,wall_index) = rifs |
---|
[53] | 316 | |
---|
[56] | 317 | ENDDO |
---|
[53] | 318 | |
---|
[56] | 319 | END SUBROUTINE wall_fluxes_ij |
---|
[53] | 320 | |
---|
[56] | 321 | |
---|
| 322 | |
---|
[53] | 323 | !------------------------------------------------------------------------------! |
---|
[56] | 324 | ! Call for all grid points |
---|
| 325 | !------------------------------------------------------------------------------! |
---|
| 326 | SUBROUTINE wall_fluxes_e( wall_flux, a, b, c1, c2, wall ) |
---|
| 327 | |
---|
| 328 | !------------------------------------------------------------------------------! |
---|
[53] | 329 | ! Description: |
---|
| 330 | ! ------------ |
---|
| 331 | ! Calculates momentum fluxes at vertical walls for routine production_e |
---|
| 332 | ! assuming Monin-Obukhov similarity. |
---|
| 333 | ! Indices: usvs a=1, vsus b=1, wsvs c1=1, wsus c2=1 (other=0). |
---|
| 334 | !------------------------------------------------------------------------------! |
---|
| 335 | |
---|
[56] | 336 | USE arrays_3d |
---|
| 337 | USE control_parameters |
---|
| 338 | USE grid_variables |
---|
| 339 | USE indices |
---|
| 340 | USE statistics |
---|
[53] | 341 | |
---|
[56] | 342 | IMPLICIT NONE |
---|
[53] | 343 | |
---|
[56] | 344 | INTEGER :: i, j, k, kk, wall_index |
---|
[187] | 345 | REAL :: a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, & |
---|
| 346 | ws, zp |
---|
[53] | 347 | |
---|
[56] | 348 | REAL :: rifs |
---|
[53] | 349 | |
---|
[667] | 350 | REAL, DIMENSION(nysg:nyng,nxlg:nxrg) :: wall |
---|
[56] | 351 | REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: wall_flux |
---|
[53] | 352 | |
---|
| 353 | |
---|
[56] | 354 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 355 | wall_flux = 0.0 |
---|
| 356 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
[53] | 357 | |
---|
[56] | 358 | DO i = nxl, nxr |
---|
| 359 | DO j = nys, nyn |
---|
| 360 | |
---|
| 361 | IF ( wall(j,i) /= 0.0 ) THEN |
---|
[53] | 362 | ! |
---|
[187] | 363 | !-- All subsequent variables are computed for scalar locations. |
---|
[56] | 364 | DO k = nzb_diff_s_inner(j,i)-1, nzb_diff_s_outer(j,i)-2 |
---|
[53] | 365 | ! |
---|
[187] | 366 | !-- (1) Compute rifs, u_i, v_i, and ws |
---|
[56] | 367 | IF ( k == nzb_diff_s_inner(j,i)-1 ) THEN |
---|
| 368 | kk = nzb_diff_s_inner(j,i)-1 |
---|
| 369 | ELSE |
---|
| 370 | kk = k-1 |
---|
| 371 | ENDIF |
---|
| 372 | rifs = 0.5 * ( rif_wall(k,j,i,wall_index) + & |
---|
| 373 | a * rif_wall(k,j,i+1,1) + b * rif_wall(k,j+1,i,2) + & |
---|
| 374 | c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4) & |
---|
| 375 | ) |
---|
[53] | 376 | |
---|
[187] | 377 | u_i = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) |
---|
| 378 | v_i = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) |
---|
| 379 | ws = 0.5 * ( w(k,j,i) + w(k-1,j,i) ) |
---|
[53] | 380 | ! |
---|
[187] | 381 | !-- (2) Compute wall-parallel absolute velocity vel_total and |
---|
| 382 | !-- interpolate appropriate velocity component vel_zp. |
---|
| 383 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
| 384 | vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws ) |
---|
| 385 | ! |
---|
| 386 | !-- (3) Compute wall friction velocity us_wall |
---|
| 387 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 388 | |
---|
| 389 | ! |
---|
[187] | 390 | !-- Stable stratification (and neutral) |
---|
| 391 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 392 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 393 | ) |
---|
| 394 | ELSE |
---|
| 395 | |
---|
| 396 | ! |
---|
| 397 | !-- Unstable stratification |
---|
| 398 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 399 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 400 | |
---|
| 401 | us_wall = kappa * vel_total / ( & |
---|
| 402 | LOG( zp / z0(j,i) ) - & |
---|
| 403 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 404 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 405 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 406 | ) |
---|
| 407 | ENDIF |
---|
| 408 | |
---|
| 409 | ! |
---|
| 410 | !-- Skip step (4) of wall_fluxes, because here rifs is already |
---|
| 411 | !-- available from (1) |
---|
| 412 | ! |
---|
[56] | 413 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
[55] | 414 | |
---|
[56] | 415 | IF ( rifs >= 0.0 ) THEN |
---|
[53] | 416 | |
---|
| 417 | ! |
---|
[56] | 418 | !-- Stable stratification (and neutral) |
---|
| 419 | wall_flux(k,j,i) = kappa * vel_zp / & |
---|
| 420 | ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp ) |
---|
| 421 | ELSE |
---|
[53] | 422 | |
---|
| 423 | ! |
---|
[56] | 424 | !-- Unstable stratification |
---|
[187] | 425 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 426 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[53] | 427 | |
---|
[187] | 428 | wall_flux(k,j,i) = kappa * vel_zp / ( & |
---|
| 429 | LOG( zp / z0(j,i) ) - & |
---|
| 430 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 431 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 432 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 433 | ) |
---|
[56] | 434 | ENDIF |
---|
[187] | 435 | wall_flux(k,j,i) = - wall_flux(k,j,i) * us_wall |
---|
[56] | 436 | |
---|
| 437 | ENDDO |
---|
| 438 | |
---|
| 439 | ENDIF |
---|
| 440 | |
---|
| 441 | ENDDO |
---|
| 442 | ENDDO |
---|
| 443 | |
---|
| 444 | END SUBROUTINE wall_fluxes_e |
---|
| 445 | |
---|
| 446 | |
---|
| 447 | |
---|
| 448 | !------------------------------------------------------------------------------! |
---|
| 449 | ! Call for grid point i,j |
---|
| 450 | !------------------------------------------------------------------------------! |
---|
| 451 | SUBROUTINE wall_fluxes_e_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 ) |
---|
| 452 | |
---|
| 453 | USE arrays_3d |
---|
| 454 | USE control_parameters |
---|
| 455 | USE grid_variables |
---|
| 456 | USE indices |
---|
| 457 | USE statistics |
---|
| 458 | |
---|
| 459 | IMPLICIT NONE |
---|
| 460 | |
---|
| 461 | INTEGER :: i, j, k, kk, nzb_w, nzt_w, wall_index |
---|
[187] | 462 | REAL :: a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, & |
---|
| 463 | ws, zp |
---|
[56] | 464 | |
---|
| 465 | REAL :: rifs |
---|
| 466 | |
---|
| 467 | REAL, DIMENSION(nzb:nzt+1) :: wall_flux |
---|
| 468 | |
---|
| 469 | |
---|
| 470 | zp = 0.5 * ( (a+c1) * dy + (b+c2) * dx ) |
---|
| 471 | wall_flux = 0.0 |
---|
| 472 | wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 ) |
---|
| 473 | |
---|
| 474 | ! |
---|
[187] | 475 | !-- All subsequent variables are computed for scalar locations. |
---|
[56] | 476 | DO k = nzb_w, nzt_w |
---|
| 477 | |
---|
| 478 | ! |
---|
[187] | 479 | !-- (1) Compute rifs, u_i, v_i, and ws |
---|
[56] | 480 | IF ( k == nzb_w ) THEN |
---|
| 481 | kk = nzb_w |
---|
[53] | 482 | ELSE |
---|
[56] | 483 | kk = k-1 |
---|
| 484 | ENDIF |
---|
| 485 | rifs = 0.5 * ( rif_wall(k,j,i,wall_index) + & |
---|
| 486 | a * rif_wall(k,j,i+1,1) + b * rif_wall(k,j+1,i,2) + & |
---|
| 487 | c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4) & |
---|
| 488 | ) |
---|
| 489 | |
---|
[187] | 490 | u_i = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) |
---|
| 491 | v_i = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) |
---|
| 492 | ws = 0.5 * ( w(k,j,i) + w(k-1,j,i) ) |
---|
[56] | 493 | ! |
---|
[187] | 494 | !-- (2) Compute wall-parallel absolute velocity vel_total and |
---|
| 495 | !-- interpolate appropriate velocity component vel_zp. |
---|
| 496 | vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 ) |
---|
| 497 | vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws ) |
---|
| 498 | ! |
---|
| 499 | !-- (3) Compute wall friction velocity us_wall |
---|
| 500 | IF ( rifs >= 0.0 ) THEN |
---|
[56] | 501 | |
---|
| 502 | ! |
---|
[187] | 503 | !-- Stable stratification (and neutral) |
---|
| 504 | us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) + & |
---|
| 505 | 5.0 * rifs * ( zp - z0(j,i) ) / zp & |
---|
| 506 | ) |
---|
| 507 | ELSE |
---|
| 508 | |
---|
| 509 | ! |
---|
| 510 | !-- Unstable stratification |
---|
| 511 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 512 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
| 513 | |
---|
| 514 | us_wall = kappa * vel_total / ( & |
---|
| 515 | LOG( zp / z0(j,i) ) - & |
---|
| 516 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 517 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 518 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 519 | ) |
---|
| 520 | ENDIF |
---|
| 521 | |
---|
| 522 | ! |
---|
| 523 | !-- Skip step (4) of wall_fluxes, because here rifs is already |
---|
| 524 | !-- available from (1) |
---|
| 525 | ! |
---|
[56] | 526 | !-- (5) Compute wall_flux (u'v', v'u', w'v', or w'u') |
---|
[187] | 527 | !-- First interpolate the velocity (this is different from |
---|
| 528 | !-- subroutine wall_fluxes because fluxes in subroutine |
---|
| 529 | !-- wall_fluxes_e are defined at scalar locations). |
---|
[56] | 530 | vel_zp = 0.5 * ( a * ( u(k,j,i) + u(k,j,i+1) ) + & |
---|
| 531 | b * ( v(k,j,i) + v(k,j+1,i) ) + & |
---|
| 532 | (c1+c2) * ( w(k,j,i) + w(k-1,j,i) ) & |
---|
| 533 | ) |
---|
| 534 | |
---|
| 535 | IF ( rifs >= 0.0 ) THEN |
---|
| 536 | |
---|
| 537 | ! |
---|
| 538 | !-- Stable stratification (and neutral) |
---|
| 539 | wall_flux(k) = kappa * vel_zp / & |
---|
| 540 | ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp ) |
---|
| 541 | ELSE |
---|
| 542 | |
---|
| 543 | ! |
---|
| 544 | !-- Unstable stratification |
---|
[187] | 545 | h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) ) |
---|
| 546 | h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) ) |
---|
[56] | 547 | |
---|
[187] | 548 | wall_flux(k) = kappa * vel_zp / ( & |
---|
| 549 | LOG( zp / z0(j,i) ) - & |
---|
| 550 | LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / ( & |
---|
| 551 | ( 1.0 + h2 )**2 * ( 1.0 + h2**2 ) ) ) + & |
---|
| 552 | 2.0 * ( ATAN( h1 ) - ATAN( h2 ) ) & |
---|
| 553 | ) |
---|
[53] | 554 | ENDIF |
---|
[187] | 555 | wall_flux(k) = - wall_flux(k) * us_wall |
---|
[53] | 556 | |
---|
[56] | 557 | ENDDO |
---|
[53] | 558 | |
---|
[56] | 559 | END SUBROUTINE wall_fluxes_e_ij |
---|
| 560 | |
---|
| 561 | END MODULE wall_fluxes_mod |
---|