[1873] | 1 | !> @file diffusion_w.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1341] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: diffusion_w.f90 3547 2018-11-21 13:21:24Z eckhard $ |
---|
[3547] | 27 | ! variables documented |
---|
| 28 | ! |
---|
| 29 | ! 3241 2018-09-12 15:02:00Z raasch |
---|
[3241] | 30 | ! unused variables removed |
---|
| 31 | ! |
---|
| 32 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 33 | ! Corrected "Former revisions" section |
---|
| 34 | ! |
---|
| 35 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 36 | ! Change in file header (GPL part) |
---|
[1321] | 37 | ! |
---|
[2716] | 38 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
| 39 | ! |
---|
[2233] | 40 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 41 | ! Adjustments to new topography and surface concept |
---|
| 42 | ! |
---|
[2119] | 43 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
| 44 | ! OpenACC version of subroutine removed |
---|
| 45 | ! |
---|
[2038] | 46 | ! 2037 2016-10-26 11:15:40Z knoop |
---|
| 47 | ! Anelastic approximation implemented |
---|
| 48 | ! |
---|
[2001] | 49 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 50 | ! Forced header and separation lines into 80 columns |
---|
| 51 | ! |
---|
[1874] | 52 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 53 | ! Module renamed (removed _mod) |
---|
| 54 | ! |
---|
[1851] | 55 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 56 | ! Module renamed |
---|
| 57 | ! |
---|
[1683] | 58 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 59 | ! Code annotations made doxygen readable |
---|
| 60 | ! |
---|
[1375] | 61 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 62 | ! vsws + vswst removed from acc-present-list |
---|
| 63 | ! |
---|
[1354] | 64 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 65 | ! REAL constants provided with KIND-attribute |
---|
| 66 | ! |
---|
[1341] | 67 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 68 | ! REAL constants defined as wp-kind |
---|
| 69 | ! |
---|
[1323] | 70 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 71 | ! REAL constants defined as wp-kind |
---|
| 72 | ! |
---|
[1321] | 73 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 74 | ! ONLY-attribute added to USE-statements, |
---|
| 75 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 76 | ! kinds are defined in new module kinds, |
---|
| 77 | ! revision history before 2012 removed, |
---|
| 78 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 79 | ! all variable declaration statements |
---|
[1] | 80 | ! |
---|
[1258] | 81 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 82 | ! openacc loop and loop vector clauses removed, declare create moved after |
---|
| 83 | ! the FORTRAN declaration statement |
---|
| 84 | ! |
---|
[1132] | 85 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
| 86 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
| 87 | ! j_north |
---|
| 88 | ! |
---|
[1037] | 89 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 90 | ! code put under GPL (PALM 3.9) |
---|
| 91 | ! |
---|
[1017] | 92 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 93 | ! accelerator version (*_acc) added |
---|
| 94 | ! |
---|
[1002] | 95 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 96 | ! arrays comunicated by module instead of parameter list |
---|
| 97 | ! |
---|
[979] | 98 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 99 | ! outflow damping layer removed |
---|
| 100 | ! kmxm_x/_z and kmxp_x/_z change to kmxm and kmxp |
---|
| 101 | ! kmym_y/_z and kmyp_y/_z change to kmym and kmyp |
---|
| 102 | ! |
---|
[1] | 103 | ! Revision 1.1 1997/09/12 06:24:11 raasch |
---|
| 104 | ! Initial revision |
---|
| 105 | ! |
---|
| 106 | ! |
---|
| 107 | ! Description: |
---|
| 108 | ! ------------ |
---|
[1682] | 109 | !> Diffusion term of the w-component |
---|
[1] | 110 | !------------------------------------------------------------------------------! |
---|
[1682] | 111 | MODULE diffusion_w_mod |
---|
| 112 | |
---|
[1] | 113 | |
---|
| 114 | PRIVATE |
---|
[2118] | 115 | PUBLIC diffusion_w |
---|
[1] | 116 | |
---|
| 117 | INTERFACE diffusion_w |
---|
| 118 | MODULE PROCEDURE diffusion_w |
---|
| 119 | MODULE PROCEDURE diffusion_w_ij |
---|
| 120 | END INTERFACE diffusion_w |
---|
| 121 | |
---|
| 122 | CONTAINS |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | !------------------------------------------------------------------------------! |
---|
[1682] | 126 | ! Description: |
---|
| 127 | ! ------------ |
---|
| 128 | !> Call for all grid points |
---|
[1] | 129 | !------------------------------------------------------------------------------! |
---|
[1001] | 130 | SUBROUTINE diffusion_w |
---|
[1] | 131 | |
---|
[1320] | 132 | USE arrays_3d, & |
---|
[2037] | 133 | ONLY : ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air |
---|
[1320] | 134 | |
---|
| 135 | USE grid_variables, & |
---|
[2232] | 136 | ONLY : ddx, ddy |
---|
[1320] | 137 | |
---|
| 138 | USE indices, & |
---|
[2232] | 139 | ONLY : nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0 |
---|
[1320] | 140 | |
---|
| 141 | USE kinds |
---|
[1] | 142 | |
---|
[2232] | 143 | USE surface_mod, & |
---|
| 144 | ONLY : surf_def_v, surf_lsm_v, surf_usm_v |
---|
| 145 | |
---|
[1] | 146 | IMPLICIT NONE |
---|
| 147 | |
---|
[2232] | 148 | INTEGER(iwp) :: i !< running index x direction |
---|
| 149 | INTEGER(iwp) :: j !< running index y direction |
---|
| 150 | INTEGER(iwp) :: k !< running index z direction |
---|
| 151 | INTEGER(iwp) :: l !< running index of surface type, south- or north-facing wall |
---|
| 152 | INTEGER(iwp) :: m !< running index surface elements |
---|
| 153 | INTEGER(iwp) :: surf_e !< End index of surface elements at (j,i)-gridpoint |
---|
| 154 | INTEGER(iwp) :: surf_s !< Start index of surface elements at (j,i)-gridpoint |
---|
[1320] | 155 | |
---|
[2232] | 156 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
[3547] | 157 | REAL(wp) :: kmxm !< diffusion coefficient on leftward side of the w-gridbox - interpolated onto xu-y grid |
---|
| 158 | REAL(wp) :: kmxp !<diffusion coefficient on rightward side of the w-gridbox - interpolated onto xu-y grid |
---|
| 159 | REAL(wp) :: kmym !< diffusion coefficient on southward side of the w-gridbox - interpolated onto x-yv grid |
---|
| 160 | REAL(wp) :: kmyp !< diffusion coefficient on northward side of the w-gridbox - interpolated onto x-yv grid |
---|
[2232] | 161 | REAL(wp) :: mask_west !< flag to mask vertical wall west of the grid point |
---|
| 162 | REAL(wp) :: mask_east !< flag to mask vertical wall east of the grid point |
---|
| 163 | REAL(wp) :: mask_south !< flag to mask vertical wall south of the grid point |
---|
| 164 | REAL(wp) :: mask_north !< flag to mask vertical wall north of the grid point |
---|
[1001] | 165 | |
---|
[1] | 166 | |
---|
| 167 | |
---|
| 168 | DO i = nxl, nxr |
---|
| 169 | DO j = nys, nyn |
---|
[2232] | 170 | DO k = nzb+1, nzt-1 |
---|
[1] | 171 | ! |
---|
[2232] | 172 | !-- Predetermine flag to mask topography and wall-bounded grid points. |
---|
| 173 | flag = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 174 | BTEST( wall_flags_0(k,j,i), 3 ) ) |
---|
| 175 | mask_east = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 176 | BTEST( wall_flags_0(k,j,i+1), 3 ) ) |
---|
| 177 | mask_west = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 178 | BTEST( wall_flags_0(k,j,i-1), 3 ) ) |
---|
| 179 | mask_south = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 180 | BTEST( wall_flags_0(k,j-1,i), 3 ) ) |
---|
| 181 | mask_north = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 182 | BTEST( wall_flags_0(k,j+1,i), 3 ) ) |
---|
| 183 | ! |
---|
[1] | 184 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[3547] | 185 | kmxp = 0.25_wp * ( km(k,j,i) + km(k,j,i+1) + & |
---|
[2232] | 186 | km(k+1,j,i) + km(k+1,j,i+1) ) |
---|
| 187 | kmxm = 0.25_wp * ( km(k,j,i) + km(k,j,i-1) + & |
---|
| 188 | km(k+1,j,i) + km(k+1,j,i-1) ) |
---|
| 189 | kmyp = 0.25_wp * ( km(k,j,i) + km(k+1,j,i) + & |
---|
| 190 | km(k,j+1,i) + km(k+1,j+1,i) ) |
---|
| 191 | kmym = 0.25_wp * ( km(k,j,i) + km(k+1,j,i) + & |
---|
| 192 | km(k,j-1,i) + km(k+1,j-1,i) ) |
---|
[1] | 193 | |
---|
| 194 | tend(k,j,i) = tend(k,j,i) & |
---|
[2232] | 195 | + ( mask_east * kmxp * ( & |
---|
| 196 | ( w(k,j,i+1) - w(k,j,i) ) * ddx & |
---|
| 197 | + ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) & |
---|
| 198 | ) & |
---|
| 199 | - mask_west * kmxm * ( & |
---|
| 200 | ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
| 201 | + ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 202 | ) & |
---|
| 203 | ) * ddx * flag & |
---|
| 204 | + ( mask_north * kmyp * ( & |
---|
| 205 | ( w(k,j+1,i) - w(k,j,i) ) * ddy & |
---|
| 206 | + ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) & |
---|
| 207 | ) & |
---|
| 208 | - mask_south * kmym * ( & |
---|
| 209 | ( w(k,j,i) - w(k,j-1,i) ) * ddy & |
---|
| 210 | + ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) & |
---|
| 211 | ) & |
---|
| 212 | ) * ddy * flag & |
---|
| 213 | + 2.0_wp * ( & |
---|
| 214 | km(k+1,j,i) * ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) & |
---|
| 215 | * rho_air(k+1) & |
---|
| 216 | - km(k,j,i) * ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) & |
---|
| 217 | * rho_air(k) & |
---|
| 218 | ) * ddzu(k+1) * drho_air_zw(k) * flag |
---|
[1] | 219 | ENDDO |
---|
| 220 | |
---|
| 221 | ! |
---|
[2232] | 222 | !-- Add horizontal momentum flux v'w' at north- (l=0) and south-facing (l=1) |
---|
| 223 | !-- surfaces. Note, in the the flat case, loops won't be entered as |
---|
| 224 | !-- start_index > end_index. Furtermore, note, no vertical natural surfaces |
---|
| 225 | !-- so far. |
---|
| 226 | !-- Default-type surfaces |
---|
| 227 | DO l = 0, 1 |
---|
| 228 | surf_s = surf_def_v(l)%start_index(j,i) |
---|
| 229 | surf_e = surf_def_v(l)%end_index(j,i) |
---|
| 230 | DO m = surf_s, surf_e |
---|
| 231 | k = surf_def_v(l)%k(m) |
---|
| 232 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 233 | surf_def_v(l)%mom_flux_w(m) * ddy |
---|
| 234 | ENDDO |
---|
| 235 | ENDDO |
---|
[1] | 236 | ! |
---|
[2232] | 237 | !-- Natural-type surfaces |
---|
| 238 | DO l = 0, 1 |
---|
| 239 | surf_s = surf_lsm_v(l)%start_index(j,i) |
---|
| 240 | surf_e = surf_lsm_v(l)%end_index(j,i) |
---|
| 241 | DO m = surf_s, surf_e |
---|
| 242 | k = surf_lsm_v(l)%k(m) |
---|
| 243 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 244 | surf_lsm_v(l)%mom_flux_w(m) * ddy |
---|
| 245 | ENDDO |
---|
| 246 | ENDDO |
---|
| 247 | ! |
---|
| 248 | !-- Urban-type surfaces |
---|
| 249 | DO l = 0, 1 |
---|
| 250 | surf_s = surf_usm_v(l)%start_index(j,i) |
---|
| 251 | surf_e = surf_usm_v(l)%end_index(j,i) |
---|
| 252 | DO m = surf_s, surf_e |
---|
| 253 | k = surf_usm_v(l)%k(m) |
---|
| 254 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 255 | surf_usm_v(l)%mom_flux_w(m) * ddy |
---|
| 256 | ENDDO |
---|
| 257 | ENDDO |
---|
| 258 | ! |
---|
| 259 | !-- Add horizontal momentum flux u'w' at east- (l=2) and west-facing (l=3) |
---|
| 260 | !-- surface. |
---|
| 261 | !-- Default-type surfaces |
---|
| 262 | DO l = 2, 3 |
---|
| 263 | surf_s = surf_def_v(l)%start_index(j,i) |
---|
| 264 | surf_e = surf_def_v(l)%end_index(j,i) |
---|
| 265 | DO m = surf_s, surf_e |
---|
| 266 | k = surf_def_v(l)%k(m) |
---|
| 267 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 268 | surf_def_v(l)%mom_flux_w(m) * ddx |
---|
| 269 | ENDDO |
---|
| 270 | ENDDO |
---|
| 271 | ! |
---|
| 272 | !-- Natural-type surfaces |
---|
| 273 | DO l = 2, 3 |
---|
| 274 | surf_s = surf_lsm_v(l)%start_index(j,i) |
---|
| 275 | surf_e = surf_lsm_v(l)%end_index(j,i) |
---|
| 276 | DO m = surf_s, surf_e |
---|
| 277 | k = surf_lsm_v(l)%k(m) |
---|
| 278 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 279 | surf_lsm_v(l)%mom_flux_w(m) * ddx |
---|
| 280 | ENDDO |
---|
| 281 | ENDDO |
---|
| 282 | ! |
---|
| 283 | !-- Urban-type surfaces |
---|
| 284 | DO l = 2, 3 |
---|
| 285 | surf_s = surf_usm_v(l)%start_index(j,i) |
---|
| 286 | surf_e = surf_usm_v(l)%end_index(j,i) |
---|
| 287 | DO m = surf_s, surf_e |
---|
| 288 | k = surf_usm_v(l)%k(m) |
---|
| 289 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 290 | surf_usm_v(l)%mom_flux_w(m) * ddx |
---|
| 291 | ENDDO |
---|
| 292 | ENDDO |
---|
[1] | 293 | |
---|
| 294 | ENDDO |
---|
| 295 | ENDDO |
---|
| 296 | |
---|
| 297 | END SUBROUTINE diffusion_w |
---|
| 298 | |
---|
| 299 | |
---|
| 300 | !------------------------------------------------------------------------------! |
---|
[1682] | 301 | ! Description: |
---|
| 302 | ! ------------ |
---|
| 303 | !> Call for grid point i,j |
---|
[1] | 304 | !------------------------------------------------------------------------------! |
---|
[1001] | 305 | SUBROUTINE diffusion_w_ij( i, j ) |
---|
[1] | 306 | |
---|
[1320] | 307 | USE arrays_3d, & |
---|
[2037] | 308 | ONLY : ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air |
---|
[1320] | 309 | |
---|
| 310 | USE grid_variables, & |
---|
[2232] | 311 | ONLY : ddx, ddy |
---|
[1320] | 312 | |
---|
| 313 | USE indices, & |
---|
[3241] | 314 | ONLY : nzb, nzt, wall_flags_0 |
---|
[1320] | 315 | |
---|
| 316 | USE kinds |
---|
[1] | 317 | |
---|
[2232] | 318 | USE surface_mod, & |
---|
| 319 | ONLY : surf_def_v, surf_lsm_v, surf_usm_v |
---|
| 320 | |
---|
[1] | 321 | IMPLICIT NONE |
---|
| 322 | |
---|
[2232] | 323 | |
---|
| 324 | INTEGER(iwp) :: i !< running index x direction |
---|
| 325 | INTEGER(iwp) :: j !< running index y direction |
---|
| 326 | INTEGER(iwp) :: k !< running index z direction |
---|
| 327 | INTEGER(iwp) :: l !< running index of surface type, south- or north-facing wall |
---|
| 328 | INTEGER(iwp) :: m !< running index surface elements |
---|
| 329 | INTEGER(iwp) :: surf_e !< End index of surface elements at (j,i)-gridpoint |
---|
| 330 | INTEGER(iwp) :: surf_s !< Start index of surface elements at (j,i)-gridpoint |
---|
[1320] | 331 | |
---|
[2232] | 332 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
[3547] | 333 | REAL(wp) :: kmxm !< diffusion coefficient on leftward side of the w-gridbox - interpolated onto xu-y grid |
---|
| 334 | REAL(wp) :: kmxp !< diffusion coefficient on rightward side of the w-gridbox - interpolated onto xu-y grid |
---|
| 335 | REAL(wp) :: kmym !< diffusion coefficient on southward side of the w-gridbox - interpolated onto x-yv grid |
---|
| 336 | REAL(wp) :: kmyp !< diffusion coefficient on northward side of the w-gridbox - interpolated onto x-yv grid |
---|
[2232] | 337 | REAL(wp) :: mask_west !< flag to mask vertical wall west of the grid point |
---|
| 338 | REAL(wp) :: mask_east !< flag to mask vertical wall east of the grid point |
---|
| 339 | REAL(wp) :: mask_south !< flag to mask vertical wall south of the grid point |
---|
| 340 | REAL(wp) :: mask_north !< flag to mask vertical wall north of the grid point |
---|
[1] | 341 | |
---|
| 342 | |
---|
[2232] | 343 | DO k = nzb+1, nzt-1 |
---|
[1] | 344 | ! |
---|
[2232] | 345 | !-- Predetermine flag to mask topography and wall-bounded grid points. |
---|
| 346 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) ) |
---|
| 347 | mask_east = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i+1), 3 ) ) |
---|
| 348 | mask_west = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i-1), 3 ) ) |
---|
| 349 | mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j-1,i), 3 ) ) |
---|
| 350 | mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j+1,i), 3 ) ) |
---|
| 351 | ! |
---|
[1] | 352 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[1322] | 353 | kmxp = 0.25_wp * ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) ) |
---|
| 354 | kmxm = 0.25_wp * ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) ) |
---|
| 355 | kmyp = 0.25_wp * ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) ) |
---|
| 356 | kmym = 0.25_wp * ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) ) |
---|
[1] | 357 | |
---|
| 358 | tend(k,j,i) = tend(k,j,i) & |
---|
[2232] | 359 | + ( mask_east * kmxp * ( & |
---|
| 360 | ( w(k,j,i+1) - w(k,j,i) ) * ddx & |
---|
| 361 | + ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) & |
---|
| 362 | ) & |
---|
| 363 | - mask_west * kmxm * ( & |
---|
| 364 | ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
| 365 | + ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 366 | ) & |
---|
| 367 | ) * ddx * flag & |
---|
| 368 | + ( mask_north * kmyp * ( & |
---|
| 369 | ( w(k,j+1,i) - w(k,j,i) ) * ddy & |
---|
| 370 | + ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) & |
---|
| 371 | ) & |
---|
| 372 | - mask_south * kmym * ( & |
---|
| 373 | ( w(k,j,i) - w(k,j-1,i) ) * ddy & |
---|
| 374 | + ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) & |
---|
| 375 | ) & |
---|
| 376 | ) * ddy * flag & |
---|
| 377 | + 2.0_wp * ( & |
---|
| 378 | km(k+1,j,i) * ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) & |
---|
| 379 | * rho_air(k+1) & |
---|
| 380 | - km(k,j,i) * ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) & |
---|
| 381 | * rho_air(k) & |
---|
| 382 | ) * ddzu(k+1) * drho_air_zw(k) * flag |
---|
[1] | 383 | ENDDO |
---|
| 384 | ! |
---|
[2232] | 385 | !-- Add horizontal momentum flux v'w' at north- (l=0) and south-facing (l=1) |
---|
| 386 | !-- surfaces. Note, in the the flat case, loops won't be entered as |
---|
| 387 | !-- start_index > end_index. Furtermore, note, no vertical natural surfaces |
---|
| 388 | !-- so far. |
---|
| 389 | !-- Default-type surfaces |
---|
| 390 | DO l = 0, 1 |
---|
| 391 | surf_s = surf_def_v(l)%start_index(j,i) |
---|
| 392 | surf_e = surf_def_v(l)%end_index(j,i) |
---|
| 393 | DO m = surf_s, surf_e |
---|
| 394 | k = surf_def_v(l)%k(m) |
---|
| 395 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 396 | surf_def_v(l)%mom_flux_w(m) * ddy |
---|
| 397 | ENDDO |
---|
| 398 | ENDDO |
---|
[51] | 399 | ! |
---|
[2232] | 400 | !-- Natural-type surfaces |
---|
| 401 | DO l = 0, 1 |
---|
| 402 | surf_s = surf_lsm_v(l)%start_index(j,i) |
---|
| 403 | surf_e = surf_lsm_v(l)%end_index(j,i) |
---|
| 404 | DO m = surf_s, surf_e |
---|
| 405 | k = surf_lsm_v(l)%k(m) |
---|
| 406 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 407 | surf_lsm_v(l)%mom_flux_w(m) * ddy |
---|
| 408 | ENDDO |
---|
| 409 | ENDDO |
---|
[1] | 410 | ! |
---|
[2232] | 411 | !-- Urban-type surfaces |
---|
| 412 | DO l = 0, 1 |
---|
| 413 | surf_s = surf_usm_v(l)%start_index(j,i) |
---|
| 414 | surf_e = surf_usm_v(l)%end_index(j,i) |
---|
| 415 | DO m = surf_s, surf_e |
---|
| 416 | k = surf_usm_v(l)%k(m) |
---|
| 417 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 418 | surf_usm_v(l)%mom_flux_w(m) * ddy |
---|
| 419 | ENDDO |
---|
| 420 | ENDDO |
---|
| 421 | ! |
---|
| 422 | !-- Add horizontal momentum flux u'w' at east- (l=2) and west-facing (l=3) |
---|
| 423 | !-- surfaces. |
---|
| 424 | !-- Default-type surfaces |
---|
| 425 | DO l = 2, 3 |
---|
| 426 | surf_s = surf_def_v(l)%start_index(j,i) |
---|
| 427 | surf_e = surf_def_v(l)%end_index(j,i) |
---|
| 428 | DO m = surf_s, surf_e |
---|
| 429 | k = surf_def_v(l)%k(m) |
---|
| 430 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 431 | surf_def_v(l)%mom_flux_w(m) * ddx |
---|
| 432 | ENDDO |
---|
| 433 | ENDDO |
---|
| 434 | ! |
---|
| 435 | !-- Natural-type surfaces |
---|
| 436 | DO l = 2, 3 |
---|
| 437 | surf_s = surf_lsm_v(l)%start_index(j,i) |
---|
| 438 | surf_e = surf_lsm_v(l)%end_index(j,i) |
---|
| 439 | DO m = surf_s, surf_e |
---|
| 440 | k = surf_lsm_v(l)%k(m) |
---|
| 441 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 442 | surf_lsm_v(l)%mom_flux_w(m) * ddx |
---|
| 443 | ENDDO |
---|
| 444 | ENDDO |
---|
| 445 | ! |
---|
| 446 | !-- Urban-type surfaces |
---|
| 447 | DO l = 2, 3 |
---|
| 448 | surf_s = surf_usm_v(l)%start_index(j,i) |
---|
| 449 | surf_e = surf_usm_v(l)%end_index(j,i) |
---|
| 450 | DO m = surf_s, surf_e |
---|
| 451 | k = surf_usm_v(l)%k(m) |
---|
| 452 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 453 | surf_usm_v(l)%mom_flux_w(m) * ddx |
---|
| 454 | ENDDO |
---|
| 455 | ENDDO |
---|
[1] | 456 | |
---|
| 457 | |
---|
| 458 | END SUBROUTINE diffusion_w_ij |
---|
| 459 | |
---|
[1323] | 460 | END MODULE diffusion_w_mod |
---|