[1873] | 1 | !> @file diffusion_u.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 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 | ! |
---|
[2101] | 17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1341] | 22 | ! |
---|
[2119] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: diffusion_u.f90 2119 2017-01-17 16:51:50Z raasch $ |
---|
| 27 | ! |
---|
[2119] | 28 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
| 29 | ! OpenACC version of subroutine removed |
---|
| 30 | ! |
---|
[2038] | 31 | ! 2037 2016-10-26 11:15:40Z knoop |
---|
| 32 | ! Anelastic approximation implemented |
---|
| 33 | ! |
---|
[2001] | 34 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 35 | ! Forced header and separation lines into 80 columns |
---|
| 36 | ! |
---|
[1874] | 37 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 38 | ! Module renamed (removed _mod) |
---|
| 39 | ! |
---|
[1851] | 40 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 41 | ! Module renamed |
---|
| 42 | ! |
---|
[1741] | 43 | ! 1740 2016-01-13 08:19:40Z raasch |
---|
| 44 | ! unnecessary calculations of kmzm and kmzp in wall bounded parts removed |
---|
| 45 | ! |
---|
[1692] | 46 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 47 | ! Formatting corrections. |
---|
| 48 | ! |
---|
[1683] | 49 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 50 | ! Code annotations made doxygen readable |
---|
| 51 | ! |
---|
[1341] | 52 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 53 | ! REAL constants defined as wp-kind |
---|
| 54 | ! |
---|
[1321] | 55 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 56 | ! ONLY-attribute added to USE-statements, |
---|
| 57 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 58 | ! kinds are defined in new module kinds, |
---|
| 59 | ! revision history before 2012 removed, |
---|
| 60 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 61 | ! all variable declaration statements |
---|
[1321] | 62 | ! |
---|
[1258] | 63 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 64 | ! openacc loop and loop vector clauses removed, declare create moved after |
---|
| 65 | ! the FORTRAN declaration statement |
---|
| 66 | ! |
---|
[1132] | 67 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
| 68 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
| 69 | ! j_north |
---|
| 70 | ! |
---|
[1037] | 71 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 72 | ! code put under GPL (PALM 3.9) |
---|
| 73 | ! |
---|
[1017] | 74 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 75 | ! accelerator version (*_acc) added |
---|
| 76 | ! |
---|
[1002] | 77 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 78 | ! arrays comunicated by module instead of parameter list |
---|
| 79 | ! |
---|
[979] | 80 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 81 | ! outflow damping layer removed |
---|
| 82 | ! kmym_x/_y and kmyp_x/_y change to kmym and kmyp |
---|
| 83 | ! |
---|
[1] | 84 | ! Revision 1.1 1997/09/12 06:23:51 raasch |
---|
| 85 | ! Initial revision |
---|
| 86 | ! |
---|
| 87 | ! |
---|
| 88 | ! Description: |
---|
| 89 | ! ------------ |
---|
[1682] | 90 | !> Diffusion term of the u-component |
---|
| 91 | !> @todo additional damping (needed for non-cyclic bc) causes bad vectorization |
---|
| 92 | !> and slows down the speed on NEC about 5-10% |
---|
[1] | 93 | !------------------------------------------------------------------------------! |
---|
[1682] | 94 | MODULE diffusion_u_mod |
---|
| 95 | |
---|
[1] | 96 | |
---|
[56] | 97 | USE wall_fluxes_mod |
---|
| 98 | |
---|
[1] | 99 | PRIVATE |
---|
[2118] | 100 | PUBLIC diffusion_u |
---|
[1] | 101 | |
---|
| 102 | INTERFACE diffusion_u |
---|
| 103 | MODULE PROCEDURE diffusion_u |
---|
| 104 | MODULE PROCEDURE diffusion_u_ij |
---|
| 105 | END INTERFACE diffusion_u |
---|
| 106 | |
---|
| 107 | CONTAINS |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | !------------------------------------------------------------------------------! |
---|
[1682] | 111 | ! Description: |
---|
| 112 | ! ------------ |
---|
| 113 | !> Call for all grid points |
---|
[1] | 114 | !------------------------------------------------------------------------------! |
---|
[1001] | 115 | SUBROUTINE diffusion_u |
---|
[1] | 116 | |
---|
[1320] | 117 | USE arrays_3d, & |
---|
[2037] | 118 | ONLY: ddzu, ddzw, km, tend, u, usws, uswst, v, w, & |
---|
| 119 | drho_air, rho_air_zw |
---|
[1320] | 120 | |
---|
| 121 | USE control_parameters, & |
---|
| 122 | ONLY: constant_top_momentumflux, topography, use_surface_fluxes, & |
---|
| 123 | use_top_fluxes |
---|
| 124 | |
---|
| 125 | USE grid_variables, & |
---|
| 126 | ONLY: ddx, ddx2, ddy, fym, fyp, wall_u |
---|
| 127 | |
---|
| 128 | USE indices, & |
---|
| 129 | ONLY: nxl, nxlu, nxr, nyn, nys, nzb, nzb_diff_u, nzb_u_inner, & |
---|
| 130 | nzb_u_outer, nzt, nzt_diff |
---|
| 131 | |
---|
| 132 | USE kinds |
---|
[1] | 133 | |
---|
| 134 | IMPLICIT NONE |
---|
| 135 | |
---|
[1682] | 136 | INTEGER(iwp) :: i !< |
---|
| 137 | INTEGER(iwp) :: j !< |
---|
| 138 | INTEGER(iwp) :: k !< |
---|
| 139 | REAL(wp) :: kmym !< |
---|
| 140 | REAL(wp) :: kmyp !< |
---|
| 141 | REAL(wp) :: kmzm !< |
---|
| 142 | REAL(wp) :: kmzp !< |
---|
[1001] | 143 | |
---|
[1682] | 144 | REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: usvs !< |
---|
[1] | 145 | |
---|
[56] | 146 | ! |
---|
| 147 | !-- First calculate horizontal momentum flux u'v' at vertical walls, |
---|
| 148 | !-- if neccessary |
---|
| 149 | IF ( topography /= 'flat' ) THEN |
---|
[1320] | 150 | CALL wall_fluxes( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, nzb_u_inner, & |
---|
[56] | 151 | nzb_u_outer, wall_u ) |
---|
| 152 | ENDIF |
---|
| 153 | |
---|
[106] | 154 | DO i = nxlu, nxr |
---|
[1001] | 155 | DO j = nys, nyn |
---|
[1] | 156 | ! |
---|
| 157 | !-- Compute horizontal diffusion |
---|
| 158 | DO k = nzb_u_outer(j,i)+1, nzt |
---|
| 159 | ! |
---|
| 160 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 161 | kmyp = 0.25_wp * & |
---|
[978] | 162 | ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) ) |
---|
[1340] | 163 | kmym = 0.25_wp * & |
---|
[978] | 164 | ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) ) |
---|
[1] | 165 | |
---|
[1320] | 166 | tend(k,j,i) = tend(k,j,i) & |
---|
[1340] | 167 | & + 2.0_wp * ( & |
---|
[1320] | 168 | & km(k,j,i) * ( u(k,j,i+1) - u(k,j,i) ) & |
---|
| 169 | & - km(k,j,i-1) * ( u(k,j,i) - u(k,j,i-1) ) & |
---|
[1340] | 170 | & ) * ddx2 & |
---|
[1320] | 171 | & + ( kmyp * ( u(k,j+1,i) - u(k,j,i) ) * ddy & |
---|
| 172 | & + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx & |
---|
| 173 | & - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy & |
---|
| 174 | & - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx & |
---|
[1] | 175 | & ) * ddy |
---|
| 176 | ENDDO |
---|
| 177 | |
---|
| 178 | ! |
---|
| 179 | !-- Wall functions at the north and south walls, respectively |
---|
[1340] | 180 | IF ( wall_u(j,i) /= 0.0_wp ) THEN |
---|
[51] | 181 | |
---|
[1] | 182 | DO k = nzb_u_inner(j,i)+1, nzb_u_outer(j,i) |
---|
[1340] | 183 | kmyp = 0.25_wp * & |
---|
[978] | 184 | ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) ) |
---|
[1340] | 185 | kmym = 0.25_wp * & |
---|
[978] | 186 | ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) ) |
---|
[1] | 187 | |
---|
| 188 | tend(k,j,i) = tend(k,j,i) & |
---|
[1340] | 189 | + 2.0_wp * ( & |
---|
[1] | 190 | km(k,j,i) * ( u(k,j,i+1) - u(k,j,i) ) & |
---|
| 191 | - km(k,j,i-1) * ( u(k,j,i) - u(k,j,i-1) ) & |
---|
[1340] | 192 | ) * ddx2 & |
---|
[1] | 193 | + ( fyp(j,i) * ( & |
---|
[978] | 194 | kmyp * ( u(k,j+1,i) - u(k,j,i) ) * ddy & |
---|
| 195 | + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx & |
---|
[1] | 196 | ) & |
---|
| 197 | - fym(j,i) * ( & |
---|
[978] | 198 | kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy & |
---|
| 199 | + kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx & |
---|
[1] | 200 | ) & |
---|
[56] | 201 | + wall_u(j,i) * usvs(k,j,i) & |
---|
[1] | 202 | ) * ddy |
---|
| 203 | ENDDO |
---|
| 204 | ENDIF |
---|
| 205 | |
---|
| 206 | ! |
---|
| 207 | !-- Compute vertical diffusion. In case of simulating a Prandtl layer, |
---|
| 208 | !-- index k starts at nzb_u_inner+2. |
---|
[102] | 209 | DO k = nzb_diff_u(j,i), nzt_diff |
---|
[1] | 210 | ! |
---|
| 211 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 212 | kmzp = 0.25_wp * & |
---|
[1] | 213 | ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) ) |
---|
[1340] | 214 | kmzm = 0.25_wp * & |
---|
[1] | 215 | ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) ) |
---|
| 216 | |
---|
[1320] | 217 | tend(k,j,i) = tend(k,j,i) & |
---|
| 218 | & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 219 | & + ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
[2037] | 220 | & ) * rho_air_zw(k) & |
---|
[1320] | 221 | & - kmzm * ( ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) & |
---|
| 222 | & + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx & |
---|
[2037] | 223 | & ) * rho_air_zw(k-1) & |
---|
| 224 | & ) * ddzw(k) * drho_air(k) |
---|
[1] | 225 | ENDDO |
---|
| 226 | |
---|
| 227 | ! |
---|
| 228 | !-- Vertical diffusion at the first grid point above the surface, |
---|
| 229 | !-- if the momentum flux at the bottom is given by the Prandtl law or |
---|
| 230 | !-- if it is prescribed by the user. |
---|
| 231 | !-- Difference quotient of the momentum flux is not formed over half |
---|
| 232 | !-- of the grid spacing (2.0*ddzw(k)) any more, since the comparison |
---|
[1320] | 233 | !-- with other (LES) models showed that the values of the momentum |
---|
[1] | 234 | !-- flux becomes too large in this case. |
---|
| 235 | !-- The term containing w(k-1,..) (see above equation) is removed here |
---|
| 236 | !-- because the vertical velocity is assumed to be zero at the surface. |
---|
| 237 | IF ( use_surface_fluxes ) THEN |
---|
| 238 | k = nzb_u_inner(j,i)+1 |
---|
| 239 | ! |
---|
| 240 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 241 | kmzp = 0.25_wp * & |
---|
[1] | 242 | ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) ) |
---|
| 243 | |
---|
[1320] | 244 | tend(k,j,i) = tend(k,j,i) & |
---|
[2037] | 245 | & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 246 | & + ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
| 247 | & ) * rho_air_zw(k) & |
---|
| 248 | & - ( -usws(j,i) ) & |
---|
| 249 | & ) * ddzw(k) * drho_air(k) |
---|
[1] | 250 | ENDIF |
---|
| 251 | |
---|
[102] | 252 | ! |
---|
| 253 | !-- Vertical diffusion at the first gridpoint below the top boundary, |
---|
| 254 | !-- if the momentum flux at the top is prescribed by the user |
---|
[103] | 255 | IF ( use_top_fluxes .AND. constant_top_momentumflux ) THEN |
---|
[102] | 256 | k = nzt |
---|
| 257 | ! |
---|
| 258 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 259 | kmzm = 0.25_wp * & |
---|
[102] | 260 | ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) ) |
---|
| 261 | |
---|
[1320] | 262 | tend(k,j,i) = tend(k,j,i) & |
---|
[2037] | 263 | & + ( ( -uswst(j,i) ) & |
---|
| 264 | & - kmzm * ( ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) & |
---|
| 265 | & + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx & |
---|
| 266 | & ) * rho_air_zw(k-1) & |
---|
| 267 | & ) * ddzw(k) * drho_air(k) |
---|
[102] | 268 | ENDIF |
---|
| 269 | |
---|
[1] | 270 | ENDDO |
---|
| 271 | ENDDO |
---|
| 272 | |
---|
| 273 | END SUBROUTINE diffusion_u |
---|
| 274 | |
---|
| 275 | |
---|
| 276 | !------------------------------------------------------------------------------! |
---|
[1682] | 277 | ! Description: |
---|
| 278 | ! ------------ |
---|
| 279 | !> Call for grid point i,j |
---|
[1] | 280 | !------------------------------------------------------------------------------! |
---|
[1001] | 281 | SUBROUTINE diffusion_u_ij( i, j ) |
---|
[1] | 282 | |
---|
[1320] | 283 | USE arrays_3d, & |
---|
[2037] | 284 | ONLY: ddzu, ddzw, km, tend, u, usws, uswst, v, w, & |
---|
| 285 | drho_air, rho_air_zw |
---|
[1320] | 286 | |
---|
| 287 | USE control_parameters, & |
---|
| 288 | ONLY: constant_top_momentumflux, use_surface_fluxes, use_top_fluxes |
---|
| 289 | |
---|
| 290 | USE grid_variables, & |
---|
| 291 | ONLY: ddx, ddx2, ddy, fym, fyp, wall_u |
---|
| 292 | |
---|
| 293 | USE indices, & |
---|
| 294 | ONLY: nzb, nzb_diff_u, nzb_u_inner, nzb_u_outer, nzt, nzt_diff |
---|
| 295 | |
---|
| 296 | USE kinds |
---|
[1] | 297 | |
---|
| 298 | IMPLICIT NONE |
---|
| 299 | |
---|
[1682] | 300 | INTEGER(iwp) :: i !< |
---|
| 301 | INTEGER(iwp) :: j !< |
---|
| 302 | INTEGER(iwp) :: k !< |
---|
| 303 | REAL(wp) :: kmym !< |
---|
| 304 | REAL(wp) :: kmyp !< |
---|
| 305 | REAL(wp) :: kmzm !< |
---|
| 306 | REAL(wp) :: kmzp !< |
---|
[1] | 307 | |
---|
[1682] | 308 | REAL(wp), DIMENSION(nzb:nzt+1) :: usvs !< |
---|
[1001] | 309 | |
---|
[1] | 310 | ! |
---|
| 311 | !-- Compute horizontal diffusion |
---|
| 312 | DO k = nzb_u_outer(j,i)+1, nzt |
---|
| 313 | ! |
---|
| 314 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 315 | kmyp = 0.25_wp * ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) ) |
---|
| 316 | kmym = 0.25_wp * ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) ) |
---|
[1] | 317 | |
---|
[1320] | 318 | tend(k,j,i) = tend(k,j,i) & |
---|
[1340] | 319 | & + 2.0_wp * ( & |
---|
[1320] | 320 | & km(k,j,i) * ( u(k,j,i+1) - u(k,j,i) ) & |
---|
| 321 | & - km(k,j,i-1) * ( u(k,j,i) - u(k,j,i-1) ) & |
---|
[1340] | 322 | & ) * ddx2 & |
---|
[1320] | 323 | & + ( kmyp * ( u(k,j+1,i) - u(k,j,i) ) * ddy & |
---|
| 324 | & + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx & |
---|
| 325 | & - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy & |
---|
| 326 | & - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx & |
---|
[1] | 327 | & ) * ddy |
---|
| 328 | ENDDO |
---|
| 329 | |
---|
| 330 | ! |
---|
| 331 | !-- Wall functions at the north and south walls, respectively |
---|
[1691] | 332 | IF ( wall_u(j,i) /= 0.0_wp ) THEN |
---|
[51] | 333 | |
---|
| 334 | ! |
---|
| 335 | !-- Calculate the horizontal momentum flux u'v' |
---|
[1320] | 336 | CALL wall_fluxes( i, j, nzb_u_inner(j,i)+1, nzb_u_outer(j,i), & |
---|
| 337 | usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp ) |
---|
[51] | 338 | |
---|
[1] | 339 | DO k = nzb_u_inner(j,i)+1, nzb_u_outer(j,i) |
---|
[1340] | 340 | kmyp = 0.25_wp * ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) ) |
---|
| 341 | kmym = 0.25_wp * ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) ) |
---|
[1] | 342 | |
---|
| 343 | tend(k,j,i) = tend(k,j,i) & |
---|
[1340] | 344 | + 2.0_wp * ( & |
---|
[1] | 345 | km(k,j,i) * ( u(k,j,i+1) - u(k,j,i) ) & |
---|
| 346 | - km(k,j,i-1) * ( u(k,j,i) - u(k,j,i-1) ) & |
---|
[1340] | 347 | ) * ddx2 & |
---|
[1] | 348 | + ( fyp(j,i) * ( & |
---|
[978] | 349 | kmyp * ( u(k,j+1,i) - u(k,j,i) ) * ddy & |
---|
| 350 | + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx & |
---|
[1] | 351 | ) & |
---|
| 352 | - fym(j,i) * ( & |
---|
[978] | 353 | kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy & |
---|
| 354 | + kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx & |
---|
[1] | 355 | ) & |
---|
[51] | 356 | + wall_u(j,i) * usvs(k) & |
---|
[1] | 357 | ) * ddy |
---|
| 358 | ENDDO |
---|
| 359 | ENDIF |
---|
| 360 | |
---|
| 361 | ! |
---|
| 362 | !-- Compute vertical diffusion. In case of simulating a Prandtl layer, |
---|
| 363 | !-- index k starts at nzb_u_inner+2. |
---|
[102] | 364 | DO k = nzb_diff_u(j,i), nzt_diff |
---|
[1] | 365 | ! |
---|
| 366 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 367 | kmzp = 0.25_wp * ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) ) |
---|
| 368 | kmzm = 0.25_wp * ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) ) |
---|
[1] | 369 | |
---|
[1320] | 370 | tend(k,j,i) = tend(k,j,i) & |
---|
| 371 | & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 372 | & + ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
[2037] | 373 | & ) * rho_air_zw(k) & |
---|
[1320] | 374 | & - kmzm * ( ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) & |
---|
| 375 | & + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx & |
---|
[2037] | 376 | & ) * rho_air_zw(k-1) & |
---|
| 377 | & ) * ddzw(k) * drho_air(k) |
---|
[1] | 378 | ENDDO |
---|
| 379 | |
---|
| 380 | ! |
---|
| 381 | !-- Vertical diffusion at the first grid point above the surface, if the |
---|
| 382 | !-- momentum flux at the bottom is given by the Prandtl law or if it is |
---|
| 383 | !-- prescribed by the user. |
---|
| 384 | !-- Difference quotient of the momentum flux is not formed over half of |
---|
| 385 | !-- the grid spacing (2.0*ddzw(k)) any more, since the comparison with |
---|
[1320] | 386 | !-- other (LES) models showed that the values of the momentum flux becomes |
---|
[1] | 387 | !-- too large in this case. |
---|
| 388 | !-- The term containing w(k-1,..) (see above equation) is removed here |
---|
| 389 | !-- because the vertical velocity is assumed to be zero at the surface. |
---|
| 390 | IF ( use_surface_fluxes ) THEN |
---|
| 391 | k = nzb_u_inner(j,i)+1 |
---|
| 392 | ! |
---|
| 393 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1340] | 394 | kmzp = 0.25_wp * ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) ) |
---|
[1] | 395 | |
---|
[1320] | 396 | tend(k,j,i) = tend(k,j,i) & |
---|
[2037] | 397 | & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 398 | & + ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
| 399 | & ) * rho_air_zw(k) & |
---|
| 400 | & - ( -usws(j,i) ) & |
---|
| 401 | & ) * ddzw(k) * drho_air(k) |
---|
[1] | 402 | ENDIF |
---|
| 403 | |
---|
[102] | 404 | ! |
---|
| 405 | !-- Vertical diffusion at the first gridpoint below the top boundary, |
---|
| 406 | !-- if the momentum flux at the top is prescribed by the user |
---|
[103] | 407 | IF ( use_top_fluxes .AND. constant_top_momentumflux ) THEN |
---|
[102] | 408 | k = nzt |
---|
| 409 | ! |
---|
| 410 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[2037] | 411 | kmzm = 0.25_wp * ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) ) |
---|
[102] | 412 | |
---|
[1320] | 413 | tend(k,j,i) = tend(k,j,i) & |
---|
[2037] | 414 | & + ( ( -uswst(j,i) ) & |
---|
| 415 | & - kmzm * ( ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) & |
---|
| 416 | & + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx & |
---|
| 417 | & ) * rho_air_zw(k-1) & |
---|
| 418 | & ) * ddzw(k) * drho_air(k) |
---|
[102] | 419 | ENDIF |
---|
| 420 | |
---|
[1] | 421 | END SUBROUTINE diffusion_u_ij |
---|
| 422 | |
---|
| 423 | END MODULE diffusion_u_mod |
---|