[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 2718 2018-01-02 08:49:38Z gronemeier $ |
---|
[2716] | 27 | ! Corrected "Former revisions" section |
---|
| 28 | ! |
---|
| 29 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 30 | ! Change in file header (GPL part) |
---|
[1321] | 31 | ! |
---|
[2716] | 32 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
| 33 | ! |
---|
[2233] | 34 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 35 | ! Adjustments to new topography and surface concept |
---|
| 36 | ! |
---|
[2119] | 37 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
| 38 | ! OpenACC version of subroutine removed |
---|
| 39 | ! |
---|
[2038] | 40 | ! 2037 2016-10-26 11:15:40Z knoop |
---|
| 41 | ! Anelastic approximation implemented |
---|
| 42 | ! |
---|
[2001] | 43 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 44 | ! Forced header and separation lines into 80 columns |
---|
| 45 | ! |
---|
[1874] | 46 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 47 | ! Module renamed (removed _mod) |
---|
| 48 | ! |
---|
[1851] | 49 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 50 | ! Module renamed |
---|
| 51 | ! |
---|
[1683] | 52 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 53 | ! Code annotations made doxygen readable |
---|
| 54 | ! |
---|
[1375] | 55 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 56 | ! vsws + vswst removed from acc-present-list |
---|
| 57 | ! |
---|
[1354] | 58 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 59 | ! REAL constants provided with KIND-attribute |
---|
| 60 | ! |
---|
[1341] | 61 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 62 | ! REAL constants defined as wp-kind |
---|
| 63 | ! |
---|
[1323] | 64 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 65 | ! REAL constants defined as wp-kind |
---|
| 66 | ! |
---|
[1321] | 67 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 68 | ! ONLY-attribute added to USE-statements, |
---|
| 69 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 70 | ! kinds are defined in new module kinds, |
---|
| 71 | ! revision history before 2012 removed, |
---|
| 72 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 73 | ! all variable declaration statements |
---|
[1] | 74 | ! |
---|
[1258] | 75 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 76 | ! openacc loop and loop vector clauses removed, declare create moved after |
---|
| 77 | ! the FORTRAN declaration statement |
---|
| 78 | ! |
---|
[1132] | 79 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
| 80 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
| 81 | ! j_north |
---|
| 82 | ! |
---|
[1037] | 83 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 84 | ! code put under GPL (PALM 3.9) |
---|
| 85 | ! |
---|
[1017] | 86 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 87 | ! accelerator version (*_acc) added |
---|
| 88 | ! |
---|
[1002] | 89 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 90 | ! arrays comunicated by module instead of parameter list |
---|
| 91 | ! |
---|
[979] | 92 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 93 | ! outflow damping layer removed |
---|
| 94 | ! kmxm_x/_z and kmxp_x/_z change to kmxm and kmxp |
---|
| 95 | ! kmym_y/_z and kmyp_y/_z change to kmym and kmyp |
---|
| 96 | ! |
---|
[1] | 97 | ! Revision 1.1 1997/09/12 06:24:11 raasch |
---|
| 98 | ! Initial revision |
---|
| 99 | ! |
---|
| 100 | ! |
---|
| 101 | ! Description: |
---|
| 102 | ! ------------ |
---|
[1682] | 103 | !> Diffusion term of the w-component |
---|
[1] | 104 | !------------------------------------------------------------------------------! |
---|
[1682] | 105 | MODULE diffusion_w_mod |
---|
| 106 | |
---|
[1] | 107 | |
---|
| 108 | PRIVATE |
---|
[2118] | 109 | PUBLIC diffusion_w |
---|
[1] | 110 | |
---|
| 111 | INTERFACE diffusion_w |
---|
| 112 | MODULE PROCEDURE diffusion_w |
---|
| 113 | MODULE PROCEDURE diffusion_w_ij |
---|
| 114 | END INTERFACE diffusion_w |
---|
| 115 | |
---|
| 116 | CONTAINS |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | !------------------------------------------------------------------------------! |
---|
[1682] | 120 | ! Description: |
---|
| 121 | ! ------------ |
---|
| 122 | !> Call for all grid points |
---|
[1] | 123 | !------------------------------------------------------------------------------! |
---|
[1001] | 124 | SUBROUTINE diffusion_w |
---|
[1] | 125 | |
---|
[1320] | 126 | USE arrays_3d, & |
---|
[2037] | 127 | ONLY : ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air |
---|
[1320] | 128 | |
---|
| 129 | USE control_parameters, & |
---|
| 130 | ONLY : topography |
---|
| 131 | |
---|
| 132 | USE grid_variables, & |
---|
[2232] | 133 | ONLY : ddx, ddy |
---|
[1320] | 134 | |
---|
| 135 | USE indices, & |
---|
[2232] | 136 | ONLY : nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0 |
---|
[1320] | 137 | |
---|
| 138 | USE kinds |
---|
[1] | 139 | |
---|
[2232] | 140 | USE surface_mod, & |
---|
| 141 | ONLY : surf_def_v, surf_lsm_v, surf_usm_v |
---|
| 142 | |
---|
[1] | 143 | IMPLICIT NONE |
---|
| 144 | |
---|
[2232] | 145 | INTEGER(iwp) :: i !< running index x direction |
---|
| 146 | INTEGER(iwp) :: j !< running index y direction |
---|
| 147 | INTEGER(iwp) :: k !< running index z direction |
---|
| 148 | INTEGER(iwp) :: l !< running index of surface type, south- or north-facing wall |
---|
| 149 | INTEGER(iwp) :: m !< running index surface elements |
---|
| 150 | INTEGER(iwp) :: surf_e !< End index of surface elements at (j,i)-gridpoint |
---|
| 151 | INTEGER(iwp) :: surf_s !< Start index of surface elements at (j,i)-gridpoint |
---|
[1320] | 152 | |
---|
[2232] | 153 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
| 154 | REAL(wp) :: kmxm !< |
---|
| 155 | REAL(wp) :: kmxp !< |
---|
| 156 | REAL(wp) :: kmym !< |
---|
| 157 | REAL(wp) :: kmyp !< |
---|
| 158 | REAL(wp) :: mask_west !< flag to mask vertical wall west of the grid point |
---|
| 159 | REAL(wp) :: mask_east !< flag to mask vertical wall east of the grid point |
---|
| 160 | REAL(wp) :: mask_south !< flag to mask vertical wall south of the grid point |
---|
| 161 | REAL(wp) :: mask_north !< flag to mask vertical wall north of the grid point |
---|
[1001] | 162 | |
---|
[1] | 163 | |
---|
| 164 | |
---|
| 165 | DO i = nxl, nxr |
---|
| 166 | DO j = nys, nyn |
---|
[2232] | 167 | DO k = nzb+1, nzt-1 |
---|
[1] | 168 | ! |
---|
[2232] | 169 | !-- Predetermine flag to mask topography and wall-bounded grid points. |
---|
| 170 | flag = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 171 | BTEST( wall_flags_0(k,j,i), 3 ) ) |
---|
| 172 | mask_east = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 173 | BTEST( wall_flags_0(k,j,i+1), 3 ) ) |
---|
| 174 | mask_west = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 175 | BTEST( wall_flags_0(k,j,i-1), 3 ) ) |
---|
| 176 | mask_south = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 177 | BTEST( wall_flags_0(k,j-1,i), 3 ) ) |
---|
| 178 | mask_north = MERGE( 1.0_wp, 0.0_wp, & |
---|
| 179 | BTEST( wall_flags_0(k,j+1,i), 3 ) ) |
---|
| 180 | ! |
---|
[1] | 181 | !-- Interpolate eddy diffusivities on staggered gridpoints |
---|
[2232] | 182 | kmxp = 0.25_wp * ( km(k,j,i) + km(k,j,i+1) + & |
---|
| 183 | km(k+1,j,i) + km(k+1,j,i+1) ) |
---|
| 184 | kmxm = 0.25_wp * ( km(k,j,i) + km(k,j,i-1) + & |
---|
| 185 | km(k+1,j,i) + km(k+1,j,i-1) ) |
---|
| 186 | kmyp = 0.25_wp * ( km(k,j,i) + km(k+1,j,i) + & |
---|
| 187 | km(k,j+1,i) + km(k+1,j+1,i) ) |
---|
| 188 | kmym = 0.25_wp * ( km(k,j,i) + km(k+1,j,i) + & |
---|
| 189 | km(k,j-1,i) + km(k+1,j-1,i) ) |
---|
[1] | 190 | |
---|
| 191 | tend(k,j,i) = tend(k,j,i) & |
---|
[2232] | 192 | + ( mask_east * kmxp * ( & |
---|
| 193 | ( w(k,j,i+1) - w(k,j,i) ) * ddx & |
---|
| 194 | + ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) & |
---|
| 195 | ) & |
---|
| 196 | - mask_west * kmxm * ( & |
---|
| 197 | ( w(k,j,i) - w(k,j,i-1) ) * ddx & |
---|
| 198 | + ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) & |
---|
| 199 | ) & |
---|
| 200 | ) * ddx * flag & |
---|
| 201 | + ( mask_north * kmyp * ( & |
---|
| 202 | ( w(k,j+1,i) - w(k,j,i) ) * ddy & |
---|
| 203 | + ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) & |
---|
| 204 | ) & |
---|
| 205 | - mask_south * kmym * ( & |
---|
| 206 | ( w(k,j,i) - w(k,j-1,i) ) * ddy & |
---|
| 207 | + ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) & |
---|
| 208 | ) & |
---|
| 209 | ) * ddy * flag & |
---|
| 210 | + 2.0_wp * ( & |
---|
| 211 | km(k+1,j,i) * ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) & |
---|
| 212 | * rho_air(k+1) & |
---|
| 213 | - km(k,j,i) * ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) & |
---|
| 214 | * rho_air(k) & |
---|
| 215 | ) * ddzu(k+1) * drho_air_zw(k) * flag |
---|
[1] | 216 | ENDDO |
---|
| 217 | |
---|
| 218 | ! |
---|
[2232] | 219 | !-- Add horizontal momentum flux v'w' at north- (l=0) and south-facing (l=1) |
---|
| 220 | !-- surfaces. Note, in the the flat case, loops won't be entered as |
---|
| 221 | !-- start_index > end_index. Furtermore, note, no vertical natural surfaces |
---|
| 222 | !-- so far. |
---|
| 223 | !-- Default-type surfaces |
---|
| 224 | DO l = 0, 1 |
---|
| 225 | surf_s = surf_def_v(l)%start_index(j,i) |
---|
| 226 | surf_e = surf_def_v(l)%end_index(j,i) |
---|
| 227 | DO m = surf_s, surf_e |
---|
| 228 | k = surf_def_v(l)%k(m) |
---|
| 229 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 230 | surf_def_v(l)%mom_flux_w(m) * ddy |
---|
| 231 | ENDDO |
---|
| 232 | ENDDO |
---|
[1] | 233 | ! |
---|
[2232] | 234 | !-- Natural-type surfaces |
---|
| 235 | DO l = 0, 1 |
---|
| 236 | surf_s = surf_lsm_v(l)%start_index(j,i) |
---|
| 237 | surf_e = surf_lsm_v(l)%end_index(j,i) |
---|
| 238 | DO m = surf_s, surf_e |
---|
| 239 | k = surf_lsm_v(l)%k(m) |
---|
| 240 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 241 | surf_lsm_v(l)%mom_flux_w(m) * ddy |
---|
| 242 | ENDDO |
---|
| 243 | ENDDO |
---|
| 244 | ! |
---|
| 245 | !-- Urban-type surfaces |
---|
| 246 | DO l = 0, 1 |
---|
| 247 | surf_s = surf_usm_v(l)%start_index(j,i) |
---|
| 248 | surf_e = surf_usm_v(l)%end_index(j,i) |
---|
| 249 | DO m = surf_s, surf_e |
---|
| 250 | k = surf_usm_v(l)%k(m) |
---|
| 251 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 252 | surf_usm_v(l)%mom_flux_w(m) * ddy |
---|
| 253 | ENDDO |
---|
| 254 | ENDDO |
---|
| 255 | ! |
---|
| 256 | !-- Add horizontal momentum flux u'w' at east- (l=2) and west-facing (l=3) |
---|
| 257 | !-- surface. |
---|
| 258 | !-- Default-type surfaces |
---|
| 259 | DO l = 2, 3 |
---|
| 260 | surf_s = surf_def_v(l)%start_index(j,i) |
---|
| 261 | surf_e = surf_def_v(l)%end_index(j,i) |
---|
| 262 | DO m = surf_s, surf_e |
---|
| 263 | k = surf_def_v(l)%k(m) |
---|
| 264 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 265 | surf_def_v(l)%mom_flux_w(m) * ddx |
---|
| 266 | ENDDO |
---|
| 267 | ENDDO |
---|
| 268 | ! |
---|
| 269 | !-- Natural-type surfaces |
---|
| 270 | DO l = 2, 3 |
---|
| 271 | surf_s = surf_lsm_v(l)%start_index(j,i) |
---|
| 272 | surf_e = surf_lsm_v(l)%end_index(j,i) |
---|
| 273 | DO m = surf_s, surf_e |
---|
| 274 | k = surf_lsm_v(l)%k(m) |
---|
| 275 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 276 | surf_lsm_v(l)%mom_flux_w(m) * ddx |
---|
| 277 | ENDDO |
---|
| 278 | ENDDO |
---|
| 279 | ! |
---|
| 280 | !-- Urban-type surfaces |
---|
| 281 | DO l = 2, 3 |
---|
| 282 | surf_s = surf_usm_v(l)%start_index(j,i) |
---|
| 283 | surf_e = surf_usm_v(l)%end_index(j,i) |
---|
| 284 | DO m = surf_s, surf_e |
---|
| 285 | k = surf_usm_v(l)%k(m) |
---|
| 286 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 287 | surf_usm_v(l)%mom_flux_w(m) * ddx |
---|
| 288 | ENDDO |
---|
| 289 | ENDDO |
---|
[1] | 290 | |
---|
| 291 | ENDDO |
---|
| 292 | ENDDO |
---|
| 293 | |
---|
| 294 | END SUBROUTINE diffusion_w |
---|
| 295 | |
---|
| 296 | |
---|
| 297 | !------------------------------------------------------------------------------! |
---|
[1682] | 298 | ! Description: |
---|
| 299 | ! ------------ |
---|
| 300 | !> Call for grid point i,j |
---|
[1] | 301 | !------------------------------------------------------------------------------! |
---|
[1001] | 302 | SUBROUTINE diffusion_w_ij( i, j ) |
---|
[1] | 303 | |
---|
[1320] | 304 | USE arrays_3d, & |
---|
[2037] | 305 | ONLY : ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air |
---|
[1320] | 306 | |
---|
| 307 | USE control_parameters, & |
---|
| 308 | ONLY : topography |
---|
| 309 | |
---|
| 310 | USE grid_variables, & |
---|
[2232] | 311 | ONLY : ddx, ddy |
---|
[1320] | 312 | |
---|
| 313 | USE indices, & |
---|
[2232] | 314 | ONLY : nxl, nxr, nyn, nys, 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 |
---|
| 333 | REAL(wp) :: kmxm !< |
---|
| 334 | REAL(wp) :: kmxp !< |
---|
| 335 | REAL(wp) :: kmym !< |
---|
| 336 | REAL(wp) :: kmyp !< |
---|
| 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 |
---|