[1682] | 1 | !> @file boundary_conds.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 | ! ----------------- |
---|
[1933] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: boundary_conds.f90 2569 2017-10-20 11:54:42Z schwenkel $ |
---|
[2569] | 27 | ! Removed redundant code for ibc_s_b=1 and ibc_q_b=1 |
---|
| 28 | ! |
---|
| 29 | ! 2365 2017-08-21 14:59:59Z kanani |
---|
[2365] | 30 | ! Vertical grid nesting implemented: exclude setting vertical velocity to zero |
---|
| 31 | ! on fine grid (SadiqHuq) |
---|
| 32 | ! |
---|
| 33 | ! 2320 2017-07-21 12:47:43Z suehring |
---|
[2320] | 34 | ! Remove unused control parameter large_scale_forcing from only-list |
---|
| 35 | ! |
---|
| 36 | ! 2292 2017-06-20 09:51:42Z schwenkel |
---|
[2292] | 37 | ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' |
---|
| 38 | ! includes two more prognostic equations for cloud drop concentration (nc) |
---|
| 39 | ! and cloud water content (qc). |
---|
| 40 | ! |
---|
| 41 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[1321] | 42 | ! |
---|
[2233] | 43 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 44 | ! Set boundary conditions on topography top using flag method. |
---|
| 45 | ! |
---|
[2119] | 46 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
| 47 | ! OpenACC directives removed |
---|
| 48 | ! |
---|
[2001] | 49 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 50 | ! Forced header and separation lines into 80 columns |
---|
| 51 | ! |
---|
[1993] | 52 | ! 1992 2016-08-12 15:14:59Z suehring |
---|
| 53 | ! Adjustments for top boundary condition for passive scalar |
---|
| 54 | ! |
---|
[1961] | 55 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 56 | ! Treat humidity and passive scalar separately |
---|
| 57 | ! |
---|
[1933] | 58 | ! 1823 2016-04-07 08:57:52Z hoffmann |
---|
| 59 | ! Initial version of purely vertical nesting introduced. |
---|
| 60 | ! |
---|
[1823] | 61 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
| 62 | ! icloud_scheme removed. microphyisics_seifert added. |
---|
| 63 | ! |
---|
[1765] | 64 | ! 1764 2016-02-28 12:45:19Z raasch |
---|
| 65 | ! index bug for u_p at left outflow removed |
---|
| 66 | ! |
---|
[1763] | 67 | ! 1762 2016-02-25 12:31:13Z hellstea |
---|
| 68 | ! Introduction of nested domain feature |
---|
| 69 | ! |
---|
[1744] | 70 | ! 1742 2016-01-13 09:50:06Z raasch |
---|
| 71 | ! bugfix for outflow Neumann boundary conditions at bottom and top |
---|
| 72 | ! |
---|
[1718] | 73 | ! 1717 2015-11-11 15:09:47Z raasch |
---|
| 74 | ! Bugfix: index error in outflow conditions for left boundary |
---|
| 75 | ! |
---|
[1683] | 76 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 77 | ! Code annotations made doxygen readable |
---|
| 78 | ! |
---|
[1717] | 79 | ! 1410 2014-05-23 12:16:18Z suehring |
---|
[1463] | 80 | ! Bugfix: set dirichlet boundary condition for passive_scalar at model domain |
---|
| 81 | ! top |
---|
| 82 | ! |
---|
[1410] | 83 | ! 1399 2014-05-07 11:16:25Z heinze |
---|
| 84 | ! Bugfix: set inflow boundary conditions also if no humidity or passive_scalar |
---|
| 85 | ! is used. |
---|
| 86 | ! |
---|
[1399] | 87 | ! 1398 2014-05-07 11:15:00Z heinze |
---|
| 88 | ! Dirichlet-condition at the top for u and v changed to u_init and v_init also |
---|
| 89 | ! for large_scale_forcing |
---|
| 90 | ! |
---|
[1381] | 91 | ! 1380 2014-04-28 12:40:45Z heinze |
---|
| 92 | ! Adjust Dirichlet-condition at the top for pt in case of nudging |
---|
| 93 | ! |
---|
[1362] | 94 | ! 1361 2014-04-16 15:17:48Z hoffmann |
---|
| 95 | ! Bottom and top boundary conditions of rain water content (qr) and |
---|
| 96 | ! rain drop concentration (nr) changed to Dirichlet |
---|
| 97 | ! |
---|
[1354] | 98 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 99 | ! REAL constants provided with KIND-attribute |
---|
| 100 | ! |
---|
[1321] | 101 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 102 | ! ONLY-attribute added to USE-statements, |
---|
| 103 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 104 | ! kinds are defined in new module kinds, |
---|
| 105 | ! revision history before 2012 removed, |
---|
| 106 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 107 | ! all variable declaration statements |
---|
[1160] | 108 | ! |
---|
[1258] | 109 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 110 | ! loop independent clauses added |
---|
| 111 | ! |
---|
[1242] | 112 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
| 113 | ! Adjust ug and vg at each timestep in case of large_scale_forcing |
---|
| 114 | ! |
---|
[1160] | 115 | ! 1159 2013-05-21 11:58:22Z fricke |
---|
[1159] | 116 | ! Bugfix: Neumann boundary conditions for the velocity components at the |
---|
| 117 | ! outflow are in fact radiation boundary conditions using the maximum phase |
---|
| 118 | ! velocity that ensures numerical stability (CFL-condition). |
---|
| 119 | ! Hence, logical operator use_cmax is now used instead of bc_lr_dirneu/_neudir. |
---|
| 120 | ! Bugfix: In case of use_cmax at the outflow, u, v, w are replaced by |
---|
| 121 | ! u_p, v_p, w_p |
---|
[1116] | 122 | ! |
---|
| 123 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 124 | ! boundary conditions of two-moment cloud scheme are restricted to Neumann- |
---|
| 125 | ! boundary-conditions |
---|
| 126 | ! |
---|
[1114] | 127 | ! 1113 2013-03-10 02:48:14Z raasch |
---|
| 128 | ! GPU-porting |
---|
| 129 | ! dummy argument "range" removed |
---|
| 130 | ! Bugfix: wrong index in loops of radiation boundary condition |
---|
[1113] | 131 | ! |
---|
[1054] | 132 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 133 | ! boundary conditions for the two new prognostic equations (nr, qr) of the |
---|
| 134 | ! two-moment cloud scheme |
---|
| 135 | ! |
---|
[1037] | 136 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 137 | ! code put under GPL (PALM 3.9) |
---|
| 138 | ! |
---|
[997] | 139 | ! 996 2012-09-07 10:41:47Z raasch |
---|
| 140 | ! little reformatting |
---|
| 141 | ! |
---|
[979] | 142 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 143 | ! Neumann boudnary conditions are added at the inflow boundary for the SGS-TKE. |
---|
| 144 | ! Outflow boundary conditions for the velocity components can be set to Neumann |
---|
| 145 | ! conditions or to radiation conditions with a horizontal averaged phase |
---|
| 146 | ! velocity. |
---|
| 147 | ! |
---|
[876] | 148 | ! 875 2012-04-02 15:35:15Z gryschka |
---|
| 149 | ! Bugfix in case of dirichlet inflow bc at the right or north boundary |
---|
| 150 | ! |
---|
[1] | 151 | ! Revision 1.1 1997/09/12 06:21:34 raasch |
---|
| 152 | ! Initial revision |
---|
| 153 | ! |
---|
| 154 | ! |
---|
| 155 | ! Description: |
---|
| 156 | ! ------------ |
---|
[1682] | 157 | !> Boundary conditions for the prognostic quantities. |
---|
| 158 | !> One additional bottom boundary condition is applied for the TKE (=(u*)**2) |
---|
| 159 | !> in prandtl_fluxes. The cyclic lateral boundary conditions are implicitly |
---|
| 160 | !> handled in routine exchange_horiz. Pressure boundary conditions are |
---|
| 161 | !> explicitly set in routines pres, poisfft, poismg and sor. |
---|
[1] | 162 | !------------------------------------------------------------------------------! |
---|
[1682] | 163 | SUBROUTINE boundary_conds |
---|
| 164 | |
---|
[1] | 165 | |
---|
[1320] | 166 | USE arrays_3d, & |
---|
| 167 | ONLY: c_u, c_u_m, c_u_m_l, c_v, c_v_m, c_v_m_l, c_w, c_w_m, c_w_m_l, & |
---|
[2292] | 168 | dzu, e_p, nc_p, nr_p, pt, pt_p, q, q_p, qc_p, qr_p, s, s_p, sa, & |
---|
| 169 | sa_p, u, ug, u_init, u_m_l, u_m_n, u_m_r, u_m_s, u_p, & |
---|
[1320] | 170 | v, vg, v_init, v_m_l, v_m_n, v_m_r, v_m_s, v_p, & |
---|
[1960] | 171 | w, w_p, w_m_l, w_m_n, w_m_r, w_m_s, pt_init |
---|
[2292] | 172 | |
---|
[1320] | 173 | USE control_parameters, & |
---|
[1960] | 174 | ONLY: bc_pt_t_val, bc_q_t_val, bc_s_t_val, constant_diffusion, & |
---|
[2365] | 175 | cloud_physics, coupling_mode, dt_3d, humidity, & |
---|
[1960] | 176 | ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_s_b, ibc_s_t, & |
---|
| 177 | ibc_sa_t, ibc_uv_b, ibc_uv_t, inflow_l, inflow_n, inflow_r, & |
---|
[2320] | 178 | inflow_s, intermediate_timestep_count, & |
---|
[2292] | 179 | microphysics_morrison, microphysics_seifert, nest_domain, & |
---|
| 180 | nest_bound_l, nest_bound_s, nudging, ocean, outflow_l, & |
---|
| 181 | outflow_n, outflow_r, outflow_s, passive_scalar, tsc, use_cmax |
---|
[1320] | 182 | |
---|
| 183 | USE grid_variables, & |
---|
| 184 | ONLY: ddx, ddy, dx, dy |
---|
| 185 | |
---|
| 186 | USE indices, & |
---|
| 187 | ONLY: nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, & |
---|
[2232] | 188 | nzb, nzt, wall_flags_0 |
---|
[1320] | 189 | |
---|
| 190 | USE kinds |
---|
| 191 | |
---|
[1] | 192 | USE pegrid |
---|
| 193 | |
---|
[1933] | 194 | USE pmc_interface, & |
---|
| 195 | ONLY : nesting_mode |
---|
[1320] | 196 | |
---|
[2232] | 197 | USE surface_mod, & |
---|
| 198 | ONLY : bc_h |
---|
[1933] | 199 | |
---|
[1] | 200 | IMPLICIT NONE |
---|
| 201 | |
---|
[2232] | 202 | INTEGER(iwp) :: i !< grid index x direction |
---|
| 203 | INTEGER(iwp) :: j !< grid index y direction |
---|
| 204 | INTEGER(iwp) :: k !< grid index z direction |
---|
| 205 | INTEGER(iwp) :: kb !< variable to set respective boundary value, depends on facing. |
---|
| 206 | INTEGER(iwp) :: l !< running index boundary type, for up- and downward-facing walls |
---|
| 207 | INTEGER(iwp) :: m !< running index surface elements |
---|
[1] | 208 | |
---|
[1682] | 209 | REAL(wp) :: c_max !< |
---|
| 210 | REAL(wp) :: denom !< |
---|
[1] | 211 | |
---|
[73] | 212 | |
---|
[1] | 213 | ! |
---|
[1113] | 214 | !-- Bottom boundary |
---|
| 215 | IF ( ibc_uv_b == 1 ) THEN |
---|
| 216 | u_p(nzb,:,:) = u_p(nzb+1,:,:) |
---|
| 217 | v_p(nzb,:,:) = v_p(nzb+1,:,:) |
---|
| 218 | ENDIF |
---|
[2232] | 219 | ! |
---|
| 220 | !-- Set zero vertical velocity at topography top (l=0), or bottom (l=1) in case |
---|
| 221 | !-- of downward-facing surfaces. |
---|
| 222 | DO l = 0, 1 |
---|
| 223 | ! |
---|
| 224 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 225 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 226 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 227 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 228 | DO m = 1, bc_h(l)%ns |
---|
| 229 | i = bc_h(l)%i(m) |
---|
| 230 | j = bc_h(l)%j(m) |
---|
| 231 | k = bc_h(l)%k(m) |
---|
| 232 | w_p(k+kb,j,i) = 0.0_wp |
---|
[1113] | 233 | ENDDO |
---|
| 234 | ENDDO |
---|
| 235 | |
---|
| 236 | ! |
---|
[1762] | 237 | !-- Top boundary. A nested domain ( ibc_uv_t = 3 ) does not require settings. |
---|
[1113] | 238 | IF ( ibc_uv_t == 0 ) THEN |
---|
| 239 | u_p(nzt+1,:,:) = u_init(nzt+1) |
---|
| 240 | v_p(nzt+1,:,:) = v_init(nzt+1) |
---|
[1762] | 241 | ELSEIF ( ibc_uv_t == 1 ) THEN |
---|
[1113] | 242 | u_p(nzt+1,:,:) = u_p(nzt,:,:) |
---|
| 243 | v_p(nzt+1,:,:) = v_p(nzt,:,:) |
---|
| 244 | ENDIF |
---|
| 245 | |
---|
[2365] | 246 | ! |
---|
| 247 | !-- Vertical nesting: Vertical velocity not zero at the top of the fine grid |
---|
| 248 | IF ( .NOT. nest_domain .AND. & |
---|
| 249 | TRIM(coupling_mode) /= 'vnested_fine' ) THEN |
---|
| 250 | w_p(nzt:nzt+1,:,:) = 0.0_wp !< nzt is not a prognostic level (but cf. pres) |
---|
[1762] | 251 | ENDIF |
---|
| 252 | |
---|
[1113] | 253 | ! |
---|
[2232] | 254 | !-- Temperature at bottom and top boundary. |
---|
[1113] | 255 | !-- In case of coupled runs (ibc_pt_b = 2) the temperature is given by |
---|
| 256 | !-- the sea surface temperature of the coupled ocean model. |
---|
[2232] | 257 | !-- Dirichlet |
---|
[1113] | 258 | IF ( ibc_pt_b == 0 ) THEN |
---|
[2232] | 259 | DO l = 0, 1 |
---|
| 260 | ! |
---|
| 261 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 262 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 263 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 264 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 265 | DO m = 1, bc_h(l)%ns |
---|
| 266 | i = bc_h(l)%i(m) |
---|
| 267 | j = bc_h(l)%j(m) |
---|
| 268 | k = bc_h(l)%k(m) |
---|
| 269 | pt_p(k+kb,j,i) = pt(k+kb,j,i) |
---|
[1] | 270 | ENDDO |
---|
| 271 | ENDDO |
---|
[2232] | 272 | ! |
---|
| 273 | !-- Neumann, zero-gradient |
---|
[1113] | 274 | ELSEIF ( ibc_pt_b == 1 ) THEN |
---|
[2232] | 275 | DO l = 0, 1 |
---|
| 276 | ! |
---|
| 277 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 278 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 279 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 280 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 281 | DO m = 1, bc_h(l)%ns |
---|
| 282 | i = bc_h(l)%i(m) |
---|
| 283 | j = bc_h(l)%j(m) |
---|
| 284 | k = bc_h(l)%k(m) |
---|
| 285 | pt_p(k+kb,j,i) = pt_p(k,j,i) |
---|
[1113] | 286 | ENDDO |
---|
| 287 | ENDDO |
---|
| 288 | ENDIF |
---|
[1] | 289 | |
---|
| 290 | ! |
---|
[1113] | 291 | !-- Temperature at top boundary |
---|
| 292 | IF ( ibc_pt_t == 0 ) THEN |
---|
| 293 | pt_p(nzt+1,:,:) = pt(nzt+1,:,:) |
---|
[1380] | 294 | ! |
---|
| 295 | !-- In case of nudging adjust top boundary to pt which is |
---|
| 296 | !-- read in from NUDGING-DATA |
---|
| 297 | IF ( nudging ) THEN |
---|
| 298 | pt_p(nzt+1,:,:) = pt_init(nzt+1) |
---|
| 299 | ENDIF |
---|
[1113] | 300 | ELSEIF ( ibc_pt_t == 1 ) THEN |
---|
| 301 | pt_p(nzt+1,:,:) = pt_p(nzt,:,:) |
---|
| 302 | ELSEIF ( ibc_pt_t == 2 ) THEN |
---|
[1992] | 303 | pt_p(nzt+1,:,:) = pt_p(nzt,:,:) + bc_pt_t_val * dzu(nzt+1) |
---|
[1113] | 304 | ENDIF |
---|
[1] | 305 | |
---|
| 306 | ! |
---|
[1113] | 307 | !-- Boundary conditions for TKE |
---|
| 308 | !-- Generally Neumann conditions with de/dz=0 are assumed |
---|
| 309 | IF ( .NOT. constant_diffusion ) THEN |
---|
[2232] | 310 | |
---|
| 311 | DO l = 0, 1 |
---|
| 312 | ! |
---|
| 313 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 314 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 315 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 316 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 317 | DO m = 1, bc_h(l)%ns |
---|
| 318 | i = bc_h(l)%i(m) |
---|
| 319 | j = bc_h(l)%j(m) |
---|
| 320 | k = bc_h(l)%k(m) |
---|
| 321 | e_p(k+kb,j,i) = e_p(k,j,i) |
---|
[73] | 322 | ENDDO |
---|
[1113] | 323 | ENDDO |
---|
[2232] | 324 | |
---|
[1762] | 325 | IF ( .NOT. nest_domain ) THEN |
---|
| 326 | e_p(nzt+1,:,:) = e_p(nzt,:,:) |
---|
| 327 | ENDIF |
---|
[1113] | 328 | ENDIF |
---|
| 329 | |
---|
| 330 | ! |
---|
| 331 | !-- Boundary conditions for salinity |
---|
| 332 | IF ( ocean ) THEN |
---|
| 333 | ! |
---|
| 334 | !-- Bottom boundary: Neumann condition because salinity flux is always |
---|
[2232] | 335 | !-- given. |
---|
| 336 | DO l = 0, 1 |
---|
| 337 | ! |
---|
| 338 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 339 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 340 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 341 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 342 | DO m = 1, bc_h(l)%ns |
---|
| 343 | i = bc_h(l)%i(m) |
---|
| 344 | j = bc_h(l)%j(m) |
---|
| 345 | k = bc_h(l)%k(m) |
---|
| 346 | sa_p(k+kb,j,i) = sa_p(k,j,i) |
---|
[1] | 347 | ENDDO |
---|
[1113] | 348 | ENDDO |
---|
[1] | 349 | ! |
---|
[1113] | 350 | !-- Top boundary: Dirichlet or Neumann |
---|
| 351 | IF ( ibc_sa_t == 0 ) THEN |
---|
| 352 | sa_p(nzt+1,:,:) = sa(nzt+1,:,:) |
---|
| 353 | ELSEIF ( ibc_sa_t == 1 ) THEN |
---|
| 354 | sa_p(nzt+1,:,:) = sa_p(nzt,:,:) |
---|
[1] | 355 | ENDIF |
---|
| 356 | |
---|
[1113] | 357 | ENDIF |
---|
| 358 | |
---|
[1] | 359 | ! |
---|
[1960] | 360 | !-- Boundary conditions for total water content, |
---|
[1113] | 361 | !-- bottom and top boundary (see also temperature) |
---|
[1960] | 362 | IF ( humidity ) THEN |
---|
[1113] | 363 | ! |
---|
| 364 | !-- Surface conditions for constant_humidity_flux |
---|
[2232] | 365 | !-- Run loop over all non-natural and natural walls. Note, in wall-datatype |
---|
| 366 | !-- the k coordinate belongs to the atmospheric grid point, therefore, set |
---|
| 367 | !-- q_p at k-1 |
---|
[1113] | 368 | IF ( ibc_q_b == 0 ) THEN |
---|
[2232] | 369 | |
---|
| 370 | DO l = 0, 1 |
---|
| 371 | ! |
---|
| 372 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 373 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 374 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 375 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 376 | DO m = 1, bc_h(l)%ns |
---|
| 377 | i = bc_h(l)%i(m) |
---|
| 378 | j = bc_h(l)%j(m) |
---|
| 379 | k = bc_h(l)%k(m) |
---|
| 380 | q_p(k+kb,j,i) = q(k+kb,j,i) |
---|
[1] | 381 | ENDDO |
---|
| 382 | ENDDO |
---|
[2232] | 383 | |
---|
[1113] | 384 | ELSE |
---|
[2232] | 385 | |
---|
| 386 | DO l = 0, 1 |
---|
| 387 | ! |
---|
| 388 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 389 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 390 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 391 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 392 | DO m = 1, bc_h(l)%ns |
---|
| 393 | i = bc_h(l)%i(m) |
---|
| 394 | j = bc_h(l)%j(m) |
---|
| 395 | k = bc_h(l)%k(m) |
---|
| 396 | q_p(k+kb,j,i) = q_p(k,j,i) |
---|
[95] | 397 | ENDDO |
---|
| 398 | ENDDO |
---|
[1113] | 399 | ENDIF |
---|
[95] | 400 | ! |
---|
[1113] | 401 | !-- Top boundary |
---|
[1462] | 402 | IF ( ibc_q_t == 0 ) THEN |
---|
| 403 | q_p(nzt+1,:,:) = q(nzt+1,:,:) |
---|
| 404 | ELSEIF ( ibc_q_t == 1 ) THEN |
---|
[1992] | 405 | q_p(nzt+1,:,:) = q_p(nzt,:,:) + bc_q_t_val * dzu(nzt+1) |
---|
[1462] | 406 | ENDIF |
---|
[95] | 407 | |
---|
[2292] | 408 | IF ( cloud_physics .AND. microphysics_morrison ) THEN |
---|
| 409 | ! |
---|
| 410 | !-- Surface conditions cloud water (Dirichlet) |
---|
| 411 | !-- Run loop over all non-natural and natural walls. Note, in wall-datatype |
---|
| 412 | !-- the k coordinate belongs to the atmospheric grid point, therefore, set |
---|
| 413 | !-- qr_p and nr_p at k-1 |
---|
| 414 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 415 | DO m = 1, bc_h(0)%ns |
---|
| 416 | i = bc_h(0)%i(m) |
---|
| 417 | j = bc_h(0)%j(m) |
---|
| 418 | k = bc_h(0)%k(m) |
---|
| 419 | qc_p(k-1,j,i) = 0.0_wp |
---|
| 420 | nc_p(k-1,j,i) = 0.0_wp |
---|
| 421 | ENDDO |
---|
| 422 | ! |
---|
| 423 | !-- Top boundary condition for cloud water (Dirichlet) |
---|
| 424 | qc_p(nzt+1,:,:) = 0.0_wp |
---|
| 425 | nc_p(nzt+1,:,:) = 0.0_wp |
---|
| 426 | |
---|
| 427 | ENDIF |
---|
| 428 | |
---|
[1822] | 429 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1113] | 430 | ! |
---|
[1361] | 431 | !-- Surface conditions rain water (Dirichlet) |
---|
[2232] | 432 | !-- Run loop over all non-natural and natural walls. Note, in wall-datatype |
---|
| 433 | !-- the k coordinate belongs to the atmospheric grid point, therefore, set |
---|
| 434 | !-- qr_p and nr_p at k-1 |
---|
| 435 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 436 | DO m = 1, bc_h(0)%ns |
---|
| 437 | i = bc_h(0)%i(m) |
---|
| 438 | j = bc_h(0)%j(m) |
---|
| 439 | k = bc_h(0)%k(m) |
---|
| 440 | qr_p(k-1,j,i) = 0.0_wp |
---|
| 441 | nr_p(k-1,j,i) = 0.0_wp |
---|
[1115] | 442 | ENDDO |
---|
[1] | 443 | ! |
---|
[1361] | 444 | !-- Top boundary condition for rain water (Dirichlet) |
---|
| 445 | qr_p(nzt+1,:,:) = 0.0_wp |
---|
| 446 | nr_p(nzt+1,:,:) = 0.0_wp |
---|
[1115] | 447 | |
---|
[1] | 448 | ENDIF |
---|
[1409] | 449 | ENDIF |
---|
[1] | 450 | ! |
---|
[1960] | 451 | !-- Boundary conditions for scalar, |
---|
| 452 | !-- bottom and top boundary (see also temperature) |
---|
| 453 | IF ( passive_scalar ) THEN |
---|
| 454 | ! |
---|
| 455 | !-- Surface conditions for constant_humidity_flux |
---|
[2232] | 456 | !-- Run loop over all non-natural and natural walls. Note, in wall-datatype |
---|
| 457 | !-- the k coordinate belongs to the atmospheric grid point, therefore, set |
---|
| 458 | !-- s_p at k-1 |
---|
[1960] | 459 | IF ( ibc_s_b == 0 ) THEN |
---|
[2232] | 460 | |
---|
| 461 | DO l = 0, 1 |
---|
| 462 | ! |
---|
| 463 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 464 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 465 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 466 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 467 | DO m = 1, bc_h(l)%ns |
---|
| 468 | i = bc_h(l)%i(m) |
---|
| 469 | j = bc_h(l)%j(m) |
---|
| 470 | k = bc_h(l)%k(m) |
---|
| 471 | s_p(k+kb,j,i) = s(k+kb,j,i) |
---|
[1960] | 472 | ENDDO |
---|
| 473 | ENDDO |
---|
[2232] | 474 | |
---|
[1960] | 475 | ELSE |
---|
[2232] | 476 | |
---|
| 477 | DO l = 0, 1 |
---|
| 478 | ! |
---|
| 479 | !-- Set kb, for upward-facing surfaces value at topography top (k-1) is set, |
---|
| 480 | !-- for downward-facing surfaces at topography bottom (k+1). |
---|
| 481 | kb = MERGE( -1, 1, l == 0 ) |
---|
| 482 | !$OMP PARALLEL DO PRIVATE( i, j, k ) |
---|
| 483 | DO m = 1, bc_h(l)%ns |
---|
| 484 | i = bc_h(l)%i(m) |
---|
| 485 | j = bc_h(l)%j(m) |
---|
| 486 | k = bc_h(l)%k(m) |
---|
| 487 | s_p(k+kb,j,i) = s_p(k,j,i) |
---|
[1960] | 488 | ENDDO |
---|
| 489 | ENDDO |
---|
| 490 | ENDIF |
---|
| 491 | ! |
---|
[1992] | 492 | !-- Top boundary condition |
---|
| 493 | IF ( ibc_s_t == 0 ) THEN |
---|
[1960] | 494 | s_p(nzt+1,:,:) = s(nzt+1,:,:) |
---|
[1992] | 495 | ELSEIF ( ibc_s_t == 1 ) THEN |
---|
| 496 | s_p(nzt+1,:,:) = s_p(nzt,:,:) |
---|
| 497 | ELSEIF ( ibc_s_t == 2 ) THEN |
---|
| 498 | s_p(nzt+1,:,:) = s_p(nzt,:,:) + bc_s_t_val * dzu(nzt+1) |
---|
[1960] | 499 | ENDIF |
---|
| 500 | |
---|
| 501 | ENDIF |
---|
| 502 | ! |
---|
[1762] | 503 | !-- In case of inflow or nest boundary at the south boundary the boundary for v |
---|
| 504 | !-- is at nys and in case of inflow or nest boundary at the left boundary the |
---|
| 505 | !-- boundary for u is at nxl. Since in prognostic_equations (cache optimized |
---|
| 506 | !-- version) these levels are handled as a prognostic level, boundary values |
---|
| 507 | !-- have to be restored here. |
---|
[1409] | 508 | !-- For the SGS-TKE, Neumann boundary conditions are used at the inflow. |
---|
| 509 | IF ( inflow_s ) THEN |
---|
| 510 | v_p(:,nys,:) = v_p(:,nys-1,:) |
---|
| 511 | IF ( .NOT. constant_diffusion ) e_p(:,nys-1,:) = e_p(:,nys,:) |
---|
| 512 | ELSEIF ( inflow_n ) THEN |
---|
| 513 | IF ( .NOT. constant_diffusion ) e_p(:,nyn+1,:) = e_p(:,nyn,:) |
---|
| 514 | ELSEIF ( inflow_l ) THEN |
---|
| 515 | u_p(:,:,nxl) = u_p(:,:,nxl-1) |
---|
| 516 | IF ( .NOT. constant_diffusion ) e_p(:,:,nxl-1) = e_p(:,:,nxl) |
---|
| 517 | ELSEIF ( inflow_r ) THEN |
---|
| 518 | IF ( .NOT. constant_diffusion ) e_p(:,:,nxr+1) = e_p(:,:,nxr) |
---|
| 519 | ENDIF |
---|
[1] | 520 | |
---|
| 521 | ! |
---|
[1762] | 522 | !-- The same restoration for u at i=nxl and v at j=nys as above must be made |
---|
[1933] | 523 | !-- in case of nest boundaries. This must not be done in case of vertical nesting |
---|
| 524 | !-- mode as in that case the lateral boundaries are actually cyclic. |
---|
| 525 | IF ( nesting_mode /= 'vertical' ) THEN |
---|
| 526 | IF ( nest_bound_s ) THEN |
---|
| 527 | v_p(:,nys,:) = v_p(:,nys-1,:) |
---|
| 528 | ENDIF |
---|
| 529 | IF ( nest_bound_l ) THEN |
---|
| 530 | u_p(:,:,nxl) = u_p(:,:,nxl-1) |
---|
| 531 | ENDIF |
---|
[1762] | 532 | ENDIF |
---|
| 533 | |
---|
| 534 | ! |
---|
[1409] | 535 | !-- Lateral boundary conditions for scalar quantities at the outflow |
---|
| 536 | IF ( outflow_s ) THEN |
---|
| 537 | pt_p(:,nys-1,:) = pt_p(:,nys,:) |
---|
[2232] | 538 | IF ( .NOT. constant_diffusion ) e_p(:,nys-1,:) = e_p(:,nys,:) |
---|
[1960] | 539 | IF ( humidity ) THEN |
---|
[1409] | 540 | q_p(:,nys-1,:) = q_p(:,nys,:) |
---|
[2292] | 541 | IF ( cloud_physics .AND. microphysics_morrison ) THEN |
---|
| 542 | qc_p(:,nys-1,:) = qc_p(:,nys,:) |
---|
| 543 | nc_p(:,nys-1,:) = nc_p(:,nys,:) |
---|
| 544 | ENDIF |
---|
[1822] | 545 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1409] | 546 | qr_p(:,nys-1,:) = qr_p(:,nys,:) |
---|
| 547 | nr_p(:,nys-1,:) = nr_p(:,nys,:) |
---|
[1053] | 548 | ENDIF |
---|
[1409] | 549 | ENDIF |
---|
[1960] | 550 | IF ( passive_scalar ) s_p(:,nys-1,:) = s_p(:,nys,:) |
---|
[1409] | 551 | ELSEIF ( outflow_n ) THEN |
---|
| 552 | pt_p(:,nyn+1,:) = pt_p(:,nyn,:) |
---|
| 553 | IF ( .NOT. constant_diffusion ) e_p(:,nyn+1,:) = e_p(:,nyn,:) |
---|
[1960] | 554 | IF ( humidity ) THEN |
---|
[1409] | 555 | q_p(:,nyn+1,:) = q_p(:,nyn,:) |
---|
[2292] | 556 | IF ( cloud_physics .AND. microphysics_morrison ) THEN |
---|
| 557 | qc_p(:,nyn+1,:) = qc_p(:,nyn,:) |
---|
| 558 | nc_p(:,nyn+1,:) = nc_p(:,nyn,:) |
---|
| 559 | ENDIF |
---|
[1822] | 560 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1409] | 561 | qr_p(:,nyn+1,:) = qr_p(:,nyn,:) |
---|
| 562 | nr_p(:,nyn+1,:) = nr_p(:,nyn,:) |
---|
[1053] | 563 | ENDIF |
---|
[1409] | 564 | ENDIF |
---|
[1960] | 565 | IF ( passive_scalar ) s_p(:,nyn+1,:) = s_p(:,nyn,:) |
---|
[1409] | 566 | ELSEIF ( outflow_l ) THEN |
---|
| 567 | pt_p(:,:,nxl-1) = pt_p(:,:,nxl) |
---|
| 568 | IF ( .NOT. constant_diffusion ) e_p(:,:,nxl-1) = e_p(:,:,nxl) |
---|
[1960] | 569 | IF ( humidity ) THEN |
---|
[1409] | 570 | q_p(:,:,nxl-1) = q_p(:,:,nxl) |
---|
[2292] | 571 | IF ( cloud_physics .AND. microphysics_morrison ) THEN |
---|
| 572 | qc_p(:,:,nxl-1) = qc_p(:,:,nxl) |
---|
| 573 | nc_p(:,:,nxl-1) = nc_p(:,:,nxl) |
---|
| 574 | ENDIF |
---|
[1822] | 575 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1409] | 576 | qr_p(:,:,nxl-1) = qr_p(:,:,nxl) |
---|
| 577 | nr_p(:,:,nxl-1) = nr_p(:,:,nxl) |
---|
[1053] | 578 | ENDIF |
---|
[1409] | 579 | ENDIF |
---|
[1960] | 580 | IF ( passive_scalar ) s_p(:,:,nxl-1) = s_p(:,:,nxl) |
---|
[1409] | 581 | ELSEIF ( outflow_r ) THEN |
---|
| 582 | pt_p(:,:,nxr+1) = pt_p(:,:,nxr) |
---|
| 583 | IF ( .NOT. constant_diffusion ) e_p(:,:,nxr+1) = e_p(:,:,nxr) |
---|
[1960] | 584 | IF ( humidity ) THEN |
---|
[1409] | 585 | q_p(:,:,nxr+1) = q_p(:,:,nxr) |
---|
[2292] | 586 | IF ( cloud_physics .AND. microphysics_morrison ) THEN |
---|
| 587 | qc_p(:,:,nxr+1) = qc_p(:,:,nxr) |
---|
| 588 | nc_p(:,:,nxr+1) = nc_p(:,:,nxr) |
---|
| 589 | ENDIF |
---|
[1822] | 590 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
[1409] | 591 | qr_p(:,:,nxr+1) = qr_p(:,:,nxr) |
---|
| 592 | nr_p(:,:,nxr+1) = nr_p(:,:,nxr) |
---|
[1053] | 593 | ENDIF |
---|
[1] | 594 | ENDIF |
---|
[1960] | 595 | IF ( passive_scalar ) s_p(:,:,nxr+1) = s_p(:,:,nxr) |
---|
[1] | 596 | ENDIF |
---|
| 597 | |
---|
| 598 | ! |
---|
[1159] | 599 | !-- Radiation boundary conditions for the velocities at the respective outflow. |
---|
| 600 | !-- The phase velocity is either assumed to the maximum phase velocity that |
---|
| 601 | !-- ensures numerical stability (CFL-condition) or calculated after |
---|
| 602 | !-- Orlanski(1976) and averaged along the outflow boundary. |
---|
[106] | 603 | IF ( outflow_s ) THEN |
---|
[75] | 604 | |
---|
[1159] | 605 | IF ( use_cmax ) THEN |
---|
| 606 | u_p(:,-1,:) = u(:,0,:) |
---|
| 607 | v_p(:,0,:) = v(:,1,:) |
---|
| 608 | w_p(:,-1,:) = w(:,0,:) |
---|
| 609 | ELSEIF ( .NOT. use_cmax ) THEN |
---|
[75] | 610 | |
---|
[978] | 611 | c_max = dy / dt_3d |
---|
[75] | 612 | |
---|
[1353] | 613 | c_u_m_l = 0.0_wp |
---|
| 614 | c_v_m_l = 0.0_wp |
---|
| 615 | c_w_m_l = 0.0_wp |
---|
[978] | 616 | |
---|
[1353] | 617 | c_u_m = 0.0_wp |
---|
| 618 | c_v_m = 0.0_wp |
---|
| 619 | c_w_m = 0.0_wp |
---|
[978] | 620 | |
---|
[75] | 621 | ! |
---|
[996] | 622 | !-- Calculate the phase speeds for u, v, and w, first local and then |
---|
| 623 | !-- average along the outflow boundary. |
---|
| 624 | DO k = nzb+1, nzt+1 |
---|
| 625 | DO i = nxl, nxr |
---|
[75] | 626 | |
---|
[106] | 627 | denom = u_m_s(k,0,i) - u_m_s(k,1,i) |
---|
| 628 | |
---|
[1353] | 629 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 630 | c_u(k,i) = -c_max * ( u(k,0,i) - u_m_s(k,0,i) ) / ( denom * tsc(2) ) |
---|
[1353] | 631 | IF ( c_u(k,i) < 0.0_wp ) THEN |
---|
| 632 | c_u(k,i) = 0.0_wp |
---|
[106] | 633 | ELSEIF ( c_u(k,i) > c_max ) THEN |
---|
| 634 | c_u(k,i) = c_max |
---|
| 635 | ENDIF |
---|
| 636 | ELSE |
---|
| 637 | c_u(k,i) = c_max |
---|
[75] | 638 | ENDIF |
---|
| 639 | |
---|
[106] | 640 | denom = v_m_s(k,1,i) - v_m_s(k,2,i) |
---|
| 641 | |
---|
[1353] | 642 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 643 | c_v(k,i) = -c_max * ( v(k,1,i) - v_m_s(k,1,i) ) / ( denom * tsc(2) ) |
---|
[1353] | 644 | IF ( c_v(k,i) < 0.0_wp ) THEN |
---|
| 645 | c_v(k,i) = 0.0_wp |
---|
[106] | 646 | ELSEIF ( c_v(k,i) > c_max ) THEN |
---|
| 647 | c_v(k,i) = c_max |
---|
| 648 | ENDIF |
---|
| 649 | ELSE |
---|
| 650 | c_v(k,i) = c_max |
---|
[75] | 651 | ENDIF |
---|
| 652 | |
---|
[106] | 653 | denom = w_m_s(k,0,i) - w_m_s(k,1,i) |
---|
[75] | 654 | |
---|
[1353] | 655 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 656 | c_w(k,i) = -c_max * ( w(k,0,i) - w_m_s(k,0,i) ) / ( denom * tsc(2) ) |
---|
[1353] | 657 | IF ( c_w(k,i) < 0.0_wp ) THEN |
---|
| 658 | c_w(k,i) = 0.0_wp |
---|
[106] | 659 | ELSEIF ( c_w(k,i) > c_max ) THEN |
---|
| 660 | c_w(k,i) = c_max |
---|
| 661 | ENDIF |
---|
| 662 | ELSE |
---|
| 663 | c_w(k,i) = c_max |
---|
[75] | 664 | ENDIF |
---|
[106] | 665 | |
---|
[978] | 666 | c_u_m_l(k) = c_u_m_l(k) + c_u(k,i) |
---|
| 667 | c_v_m_l(k) = c_v_m_l(k) + c_v(k,i) |
---|
| 668 | c_w_m_l(k) = c_w_m_l(k) + c_w(k,i) |
---|
[106] | 669 | |
---|
[978] | 670 | ENDDO |
---|
| 671 | ENDDO |
---|
[75] | 672 | |
---|
[978] | 673 | #if defined( __parallel ) |
---|
| 674 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dx, ierr ) |
---|
| 675 | CALL MPI_ALLREDUCE( c_u_m_l(nzb+1), c_u_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 676 | MPI_SUM, comm1dx, ierr ) |
---|
| 677 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dx, ierr ) |
---|
| 678 | CALL MPI_ALLREDUCE( c_v_m_l(nzb+1), c_v_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 679 | MPI_SUM, comm1dx, ierr ) |
---|
| 680 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dx, ierr ) |
---|
| 681 | CALL MPI_ALLREDUCE( c_w_m_l(nzb+1), c_w_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 682 | MPI_SUM, comm1dx, ierr ) |
---|
| 683 | #else |
---|
| 684 | c_u_m = c_u_m_l |
---|
| 685 | c_v_m = c_v_m_l |
---|
| 686 | c_w_m = c_w_m_l |
---|
| 687 | #endif |
---|
| 688 | |
---|
| 689 | c_u_m = c_u_m / (nx+1) |
---|
| 690 | c_v_m = c_v_m / (nx+1) |
---|
| 691 | c_w_m = c_w_m / (nx+1) |
---|
| 692 | |
---|
[75] | 693 | ! |
---|
[978] | 694 | !-- Save old timelevels for the next timestep |
---|
| 695 | IF ( intermediate_timestep_count == 1 ) THEN |
---|
| 696 | u_m_s(:,:,:) = u(:,0:1,:) |
---|
| 697 | v_m_s(:,:,:) = v(:,1:2,:) |
---|
| 698 | w_m_s(:,:,:) = w(:,0:1,:) |
---|
| 699 | ENDIF |
---|
| 700 | |
---|
| 701 | ! |
---|
| 702 | !-- Calculate the new velocities |
---|
[996] | 703 | DO k = nzb+1, nzt+1 |
---|
| 704 | DO i = nxlg, nxrg |
---|
[978] | 705 | u_p(k,-1,i) = u(k,-1,i) - dt_3d * tsc(2) * c_u_m(k) * & |
---|
[75] | 706 | ( u(k,-1,i) - u(k,0,i) ) * ddy |
---|
| 707 | |
---|
[978] | 708 | v_p(k,0,i) = v(k,0,i) - dt_3d * tsc(2) * c_v_m(k) * & |
---|
[106] | 709 | ( v(k,0,i) - v(k,1,i) ) * ddy |
---|
[75] | 710 | |
---|
[978] | 711 | w_p(k,-1,i) = w(k,-1,i) - dt_3d * tsc(2) * c_w_m(k) * & |
---|
[75] | 712 | ( w(k,-1,i) - w(k,0,i) ) * ddy |
---|
[978] | 713 | ENDDO |
---|
[75] | 714 | ENDDO |
---|
| 715 | |
---|
| 716 | ! |
---|
[978] | 717 | !-- Bottom boundary at the outflow |
---|
| 718 | IF ( ibc_uv_b == 0 ) THEN |
---|
[1353] | 719 | u_p(nzb,-1,:) = 0.0_wp |
---|
| 720 | v_p(nzb,0,:) = 0.0_wp |
---|
[978] | 721 | ELSE |
---|
| 722 | u_p(nzb,-1,:) = u_p(nzb+1,-1,:) |
---|
| 723 | v_p(nzb,0,:) = v_p(nzb+1,0,:) |
---|
| 724 | ENDIF |
---|
[1353] | 725 | w_p(nzb,-1,:) = 0.0_wp |
---|
[73] | 726 | |
---|
[75] | 727 | ! |
---|
[978] | 728 | !-- Top boundary at the outflow |
---|
| 729 | IF ( ibc_uv_t == 0 ) THEN |
---|
| 730 | u_p(nzt+1,-1,:) = u_init(nzt+1) |
---|
| 731 | v_p(nzt+1,0,:) = v_init(nzt+1) |
---|
| 732 | ELSE |
---|
[1742] | 733 | u_p(nzt+1,-1,:) = u_p(nzt,-1,:) |
---|
| 734 | v_p(nzt+1,0,:) = v_p(nzt,0,:) |
---|
[978] | 735 | ENDIF |
---|
[1353] | 736 | w_p(nzt:nzt+1,-1,:) = 0.0_wp |
---|
[978] | 737 | |
---|
[75] | 738 | ENDIF |
---|
[73] | 739 | |
---|
[75] | 740 | ENDIF |
---|
[73] | 741 | |
---|
[106] | 742 | IF ( outflow_n ) THEN |
---|
[73] | 743 | |
---|
[1159] | 744 | IF ( use_cmax ) THEN |
---|
| 745 | u_p(:,ny+1,:) = u(:,ny,:) |
---|
| 746 | v_p(:,ny+1,:) = v(:,ny,:) |
---|
| 747 | w_p(:,ny+1,:) = w(:,ny,:) |
---|
| 748 | ELSEIF ( .NOT. use_cmax ) THEN |
---|
[75] | 749 | |
---|
[978] | 750 | c_max = dy / dt_3d |
---|
[75] | 751 | |
---|
[1353] | 752 | c_u_m_l = 0.0_wp |
---|
| 753 | c_v_m_l = 0.0_wp |
---|
| 754 | c_w_m_l = 0.0_wp |
---|
[978] | 755 | |
---|
[1353] | 756 | c_u_m = 0.0_wp |
---|
| 757 | c_v_m = 0.0_wp |
---|
| 758 | c_w_m = 0.0_wp |
---|
[978] | 759 | |
---|
[1] | 760 | ! |
---|
[996] | 761 | !-- Calculate the phase speeds for u, v, and w, first local and then |
---|
| 762 | !-- average along the outflow boundary. |
---|
| 763 | DO k = nzb+1, nzt+1 |
---|
| 764 | DO i = nxl, nxr |
---|
[73] | 765 | |
---|
[106] | 766 | denom = u_m_n(k,ny,i) - u_m_n(k,ny-1,i) |
---|
| 767 | |
---|
[1353] | 768 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 769 | c_u(k,i) = -c_max * ( u(k,ny,i) - u_m_n(k,ny,i) ) / ( denom * tsc(2) ) |
---|
[1353] | 770 | IF ( c_u(k,i) < 0.0_wp ) THEN |
---|
| 771 | c_u(k,i) = 0.0_wp |
---|
[106] | 772 | ELSEIF ( c_u(k,i) > c_max ) THEN |
---|
| 773 | c_u(k,i) = c_max |
---|
| 774 | ENDIF |
---|
| 775 | ELSE |
---|
| 776 | c_u(k,i) = c_max |
---|
[73] | 777 | ENDIF |
---|
| 778 | |
---|
[106] | 779 | denom = v_m_n(k,ny,i) - v_m_n(k,ny-1,i) |
---|
[73] | 780 | |
---|
[1353] | 781 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 782 | c_v(k,i) = -c_max * ( v(k,ny,i) - v_m_n(k,ny,i) ) / ( denom * tsc(2) ) |
---|
[1353] | 783 | IF ( c_v(k,i) < 0.0_wp ) THEN |
---|
| 784 | c_v(k,i) = 0.0_wp |
---|
[106] | 785 | ELSEIF ( c_v(k,i) > c_max ) THEN |
---|
| 786 | c_v(k,i) = c_max |
---|
| 787 | ENDIF |
---|
| 788 | ELSE |
---|
| 789 | c_v(k,i) = c_max |
---|
[73] | 790 | ENDIF |
---|
| 791 | |
---|
[106] | 792 | denom = w_m_n(k,ny,i) - w_m_n(k,ny-1,i) |
---|
[73] | 793 | |
---|
[1353] | 794 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 795 | c_w(k,i) = -c_max * ( w(k,ny,i) - w_m_n(k,ny,i) ) / ( denom * tsc(2) ) |
---|
[1353] | 796 | IF ( c_w(k,i) < 0.0_wp ) THEN |
---|
| 797 | c_w(k,i) = 0.0_wp |
---|
[106] | 798 | ELSEIF ( c_w(k,i) > c_max ) THEN |
---|
| 799 | c_w(k,i) = c_max |
---|
| 800 | ENDIF |
---|
| 801 | ELSE |
---|
| 802 | c_w(k,i) = c_max |
---|
[73] | 803 | ENDIF |
---|
[106] | 804 | |
---|
[978] | 805 | c_u_m_l(k) = c_u_m_l(k) + c_u(k,i) |
---|
| 806 | c_v_m_l(k) = c_v_m_l(k) + c_v(k,i) |
---|
| 807 | c_w_m_l(k) = c_w_m_l(k) + c_w(k,i) |
---|
[106] | 808 | |
---|
[978] | 809 | ENDDO |
---|
| 810 | ENDDO |
---|
[73] | 811 | |
---|
[978] | 812 | #if defined( __parallel ) |
---|
| 813 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dx, ierr ) |
---|
| 814 | CALL MPI_ALLREDUCE( c_u_m_l(nzb+1), c_u_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 815 | MPI_SUM, comm1dx, ierr ) |
---|
| 816 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dx, ierr ) |
---|
| 817 | CALL MPI_ALLREDUCE( c_v_m_l(nzb+1), c_v_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 818 | MPI_SUM, comm1dx, ierr ) |
---|
| 819 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dx, ierr ) |
---|
| 820 | CALL MPI_ALLREDUCE( c_w_m_l(nzb+1), c_w_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 821 | MPI_SUM, comm1dx, ierr ) |
---|
| 822 | #else |
---|
| 823 | c_u_m = c_u_m_l |
---|
| 824 | c_v_m = c_v_m_l |
---|
| 825 | c_w_m = c_w_m_l |
---|
| 826 | #endif |
---|
| 827 | |
---|
| 828 | c_u_m = c_u_m / (nx+1) |
---|
| 829 | c_v_m = c_v_m / (nx+1) |
---|
| 830 | c_w_m = c_w_m / (nx+1) |
---|
| 831 | |
---|
[73] | 832 | ! |
---|
[978] | 833 | !-- Save old timelevels for the next timestep |
---|
| 834 | IF ( intermediate_timestep_count == 1 ) THEN |
---|
| 835 | u_m_n(:,:,:) = u(:,ny-1:ny,:) |
---|
| 836 | v_m_n(:,:,:) = v(:,ny-1:ny,:) |
---|
| 837 | w_m_n(:,:,:) = w(:,ny-1:ny,:) |
---|
| 838 | ENDIF |
---|
[73] | 839 | |
---|
[978] | 840 | ! |
---|
| 841 | !-- Calculate the new velocities |
---|
[996] | 842 | DO k = nzb+1, nzt+1 |
---|
| 843 | DO i = nxlg, nxrg |
---|
[978] | 844 | u_p(k,ny+1,i) = u(k,ny+1,i) - dt_3d * tsc(2) * c_u_m(k) * & |
---|
| 845 | ( u(k,ny+1,i) - u(k,ny,i) ) * ddy |
---|
[73] | 846 | |
---|
[978] | 847 | v_p(k,ny+1,i) = v(k,ny+1,i) - dt_3d * tsc(2) * c_v_m(k) * & |
---|
| 848 | ( v(k,ny+1,i) - v(k,ny,i) ) * ddy |
---|
[73] | 849 | |
---|
[978] | 850 | w_p(k,ny+1,i) = w(k,ny+1,i) - dt_3d * tsc(2) * c_w_m(k) * & |
---|
| 851 | ( w(k,ny+1,i) - w(k,ny,i) ) * ddy |
---|
| 852 | ENDDO |
---|
[1] | 853 | ENDDO |
---|
| 854 | |
---|
| 855 | ! |
---|
[978] | 856 | !-- Bottom boundary at the outflow |
---|
| 857 | IF ( ibc_uv_b == 0 ) THEN |
---|
[1353] | 858 | u_p(nzb,ny+1,:) = 0.0_wp |
---|
| 859 | v_p(nzb,ny+1,:) = 0.0_wp |
---|
[978] | 860 | ELSE |
---|
| 861 | u_p(nzb,ny+1,:) = u_p(nzb+1,ny+1,:) |
---|
| 862 | v_p(nzb,ny+1,:) = v_p(nzb+1,ny+1,:) |
---|
| 863 | ENDIF |
---|
[1353] | 864 | w_p(nzb,ny+1,:) = 0.0_wp |
---|
[73] | 865 | |
---|
| 866 | ! |
---|
[978] | 867 | !-- Top boundary at the outflow |
---|
| 868 | IF ( ibc_uv_t == 0 ) THEN |
---|
| 869 | u_p(nzt+1,ny+1,:) = u_init(nzt+1) |
---|
| 870 | v_p(nzt+1,ny+1,:) = v_init(nzt+1) |
---|
| 871 | ELSE |
---|
| 872 | u_p(nzt+1,ny+1,:) = u_p(nzt,nyn+1,:) |
---|
| 873 | v_p(nzt+1,ny+1,:) = v_p(nzt,nyn+1,:) |
---|
| 874 | ENDIF |
---|
[1353] | 875 | w_p(nzt:nzt+1,ny+1,:) = 0.0_wp |
---|
[978] | 876 | |
---|
[1] | 877 | ENDIF |
---|
| 878 | |
---|
[75] | 879 | ENDIF |
---|
| 880 | |
---|
[106] | 881 | IF ( outflow_l ) THEN |
---|
[75] | 882 | |
---|
[1159] | 883 | IF ( use_cmax ) THEN |
---|
[1717] | 884 | u_p(:,:,0) = u(:,:,1) |
---|
| 885 | v_p(:,:,-1) = v(:,:,0) |
---|
[1159] | 886 | w_p(:,:,-1) = w(:,:,0) |
---|
| 887 | ELSEIF ( .NOT. use_cmax ) THEN |
---|
[75] | 888 | |
---|
[978] | 889 | c_max = dx / dt_3d |
---|
[75] | 890 | |
---|
[1353] | 891 | c_u_m_l = 0.0_wp |
---|
| 892 | c_v_m_l = 0.0_wp |
---|
| 893 | c_w_m_l = 0.0_wp |
---|
[978] | 894 | |
---|
[1353] | 895 | c_u_m = 0.0_wp |
---|
| 896 | c_v_m = 0.0_wp |
---|
| 897 | c_w_m = 0.0_wp |
---|
[978] | 898 | |
---|
[1] | 899 | ! |
---|
[996] | 900 | !-- Calculate the phase speeds for u, v, and w, first local and then |
---|
| 901 | !-- average along the outflow boundary. |
---|
| 902 | DO k = nzb+1, nzt+1 |
---|
| 903 | DO j = nys, nyn |
---|
[75] | 904 | |
---|
[106] | 905 | denom = u_m_l(k,j,1) - u_m_l(k,j,2) |
---|
| 906 | |
---|
[1353] | 907 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 908 | c_u(k,j) = -c_max * ( u(k,j,1) - u_m_l(k,j,1) ) / ( denom * tsc(2) ) |
---|
[1353] | 909 | IF ( c_u(k,j) < 0.0_wp ) THEN |
---|
| 910 | c_u(k,j) = 0.0_wp |
---|
[107] | 911 | ELSEIF ( c_u(k,j) > c_max ) THEN |
---|
| 912 | c_u(k,j) = c_max |
---|
[106] | 913 | ENDIF |
---|
| 914 | ELSE |
---|
[107] | 915 | c_u(k,j) = c_max |
---|
[75] | 916 | ENDIF |
---|
| 917 | |
---|
[106] | 918 | denom = v_m_l(k,j,0) - v_m_l(k,j,1) |
---|
[75] | 919 | |
---|
[1353] | 920 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 921 | c_v(k,j) = -c_max * ( v(k,j,0) - v_m_l(k,j,0) ) / ( denom * tsc(2) ) |
---|
[1353] | 922 | IF ( c_v(k,j) < 0.0_wp ) THEN |
---|
| 923 | c_v(k,j) = 0.0_wp |
---|
[106] | 924 | ELSEIF ( c_v(k,j) > c_max ) THEN |
---|
| 925 | c_v(k,j) = c_max |
---|
| 926 | ENDIF |
---|
| 927 | ELSE |
---|
| 928 | c_v(k,j) = c_max |
---|
[75] | 929 | ENDIF |
---|
| 930 | |
---|
[106] | 931 | denom = w_m_l(k,j,0) - w_m_l(k,j,1) |
---|
[75] | 932 | |
---|
[1353] | 933 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 934 | c_w(k,j) = -c_max * ( w(k,j,0) - w_m_l(k,j,0) ) / ( denom * tsc(2) ) |
---|
[1353] | 935 | IF ( c_w(k,j) < 0.0_wp ) THEN |
---|
| 936 | c_w(k,j) = 0.0_wp |
---|
[106] | 937 | ELSEIF ( c_w(k,j) > c_max ) THEN |
---|
| 938 | c_w(k,j) = c_max |
---|
| 939 | ENDIF |
---|
| 940 | ELSE |
---|
| 941 | c_w(k,j) = c_max |
---|
[75] | 942 | ENDIF |
---|
[106] | 943 | |
---|
[978] | 944 | c_u_m_l(k) = c_u_m_l(k) + c_u(k,j) |
---|
| 945 | c_v_m_l(k) = c_v_m_l(k) + c_v(k,j) |
---|
| 946 | c_w_m_l(k) = c_w_m_l(k) + c_w(k,j) |
---|
[106] | 947 | |
---|
[978] | 948 | ENDDO |
---|
| 949 | ENDDO |
---|
[75] | 950 | |
---|
[978] | 951 | #if defined( __parallel ) |
---|
| 952 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dy, ierr ) |
---|
| 953 | CALL MPI_ALLREDUCE( c_u_m_l(nzb+1), c_u_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 954 | MPI_SUM, comm1dy, ierr ) |
---|
| 955 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dy, ierr ) |
---|
| 956 | CALL MPI_ALLREDUCE( c_v_m_l(nzb+1), c_v_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 957 | MPI_SUM, comm1dy, ierr ) |
---|
| 958 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dy, ierr ) |
---|
| 959 | CALL MPI_ALLREDUCE( c_w_m_l(nzb+1), c_w_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 960 | MPI_SUM, comm1dy, ierr ) |
---|
| 961 | #else |
---|
| 962 | c_u_m = c_u_m_l |
---|
| 963 | c_v_m = c_v_m_l |
---|
| 964 | c_w_m = c_w_m_l |
---|
| 965 | #endif |
---|
| 966 | |
---|
| 967 | c_u_m = c_u_m / (ny+1) |
---|
| 968 | c_v_m = c_v_m / (ny+1) |
---|
| 969 | c_w_m = c_w_m / (ny+1) |
---|
| 970 | |
---|
[73] | 971 | ! |
---|
[978] | 972 | !-- Save old timelevels for the next timestep |
---|
| 973 | IF ( intermediate_timestep_count == 1 ) THEN |
---|
| 974 | u_m_l(:,:,:) = u(:,:,1:2) |
---|
| 975 | v_m_l(:,:,:) = v(:,:,0:1) |
---|
| 976 | w_m_l(:,:,:) = w(:,:,0:1) |
---|
| 977 | ENDIF |
---|
| 978 | |
---|
| 979 | ! |
---|
| 980 | !-- Calculate the new velocities |
---|
[996] | 981 | DO k = nzb+1, nzt+1 |
---|
[1113] | 982 | DO j = nysg, nyng |
---|
[978] | 983 | u_p(k,j,0) = u(k,j,0) - dt_3d * tsc(2) * c_u_m(k) * & |
---|
[106] | 984 | ( u(k,j,0) - u(k,j,1) ) * ddx |
---|
[75] | 985 | |
---|
[978] | 986 | v_p(k,j,-1) = v(k,j,-1) - dt_3d * tsc(2) * c_v_m(k) * & |
---|
[75] | 987 | ( v(k,j,-1) - v(k,j,0) ) * ddx |
---|
| 988 | |
---|
[978] | 989 | w_p(k,j,-1) = w(k,j,-1) - dt_3d * tsc(2) * c_w_m(k) * & |
---|
[75] | 990 | ( w(k,j,-1) - w(k,j,0) ) * ddx |
---|
[978] | 991 | ENDDO |
---|
[75] | 992 | ENDDO |
---|
| 993 | |
---|
| 994 | ! |
---|
[978] | 995 | !-- Bottom boundary at the outflow |
---|
| 996 | IF ( ibc_uv_b == 0 ) THEN |
---|
[1353] | 997 | u_p(nzb,:,0) = 0.0_wp |
---|
| 998 | v_p(nzb,:,-1) = 0.0_wp |
---|
[978] | 999 | ELSE |
---|
| 1000 | u_p(nzb,:,0) = u_p(nzb+1,:,0) |
---|
| 1001 | v_p(nzb,:,-1) = v_p(nzb+1,:,-1) |
---|
| 1002 | ENDIF |
---|
[1353] | 1003 | w_p(nzb,:,-1) = 0.0_wp |
---|
[1] | 1004 | |
---|
[75] | 1005 | ! |
---|
[978] | 1006 | !-- Top boundary at the outflow |
---|
| 1007 | IF ( ibc_uv_t == 0 ) THEN |
---|
[1764] | 1008 | u_p(nzt+1,:,0) = u_init(nzt+1) |
---|
[978] | 1009 | v_p(nzt+1,:,-1) = v_init(nzt+1) |
---|
| 1010 | ELSE |
---|
[1764] | 1011 | u_p(nzt+1,:,0) = u_p(nzt,:,0) |
---|
[978] | 1012 | v_p(nzt+1,:,-1) = v_p(nzt,:,-1) |
---|
| 1013 | ENDIF |
---|
[1353] | 1014 | w_p(nzt:nzt+1,:,-1) = 0.0_wp |
---|
[978] | 1015 | |
---|
[75] | 1016 | ENDIF |
---|
[73] | 1017 | |
---|
[75] | 1018 | ENDIF |
---|
[73] | 1019 | |
---|
[106] | 1020 | IF ( outflow_r ) THEN |
---|
[73] | 1021 | |
---|
[1159] | 1022 | IF ( use_cmax ) THEN |
---|
| 1023 | u_p(:,:,nx+1) = u(:,:,nx) |
---|
| 1024 | v_p(:,:,nx+1) = v(:,:,nx) |
---|
| 1025 | w_p(:,:,nx+1) = w(:,:,nx) |
---|
| 1026 | ELSEIF ( .NOT. use_cmax ) THEN |
---|
[75] | 1027 | |
---|
[978] | 1028 | c_max = dx / dt_3d |
---|
[75] | 1029 | |
---|
[1353] | 1030 | c_u_m_l = 0.0_wp |
---|
| 1031 | c_v_m_l = 0.0_wp |
---|
| 1032 | c_w_m_l = 0.0_wp |
---|
[978] | 1033 | |
---|
[1353] | 1034 | c_u_m = 0.0_wp |
---|
| 1035 | c_v_m = 0.0_wp |
---|
| 1036 | c_w_m = 0.0_wp |
---|
[978] | 1037 | |
---|
[1] | 1038 | ! |
---|
[996] | 1039 | !-- Calculate the phase speeds for u, v, and w, first local and then |
---|
| 1040 | !-- average along the outflow boundary. |
---|
| 1041 | DO k = nzb+1, nzt+1 |
---|
| 1042 | DO j = nys, nyn |
---|
[73] | 1043 | |
---|
[106] | 1044 | denom = u_m_r(k,j,nx) - u_m_r(k,j,nx-1) |
---|
| 1045 | |
---|
[1353] | 1046 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 1047 | c_u(k,j) = -c_max * ( u(k,j,nx) - u_m_r(k,j,nx) ) / ( denom * tsc(2) ) |
---|
[1353] | 1048 | IF ( c_u(k,j) < 0.0_wp ) THEN |
---|
| 1049 | c_u(k,j) = 0.0_wp |
---|
[106] | 1050 | ELSEIF ( c_u(k,j) > c_max ) THEN |
---|
| 1051 | c_u(k,j) = c_max |
---|
| 1052 | ENDIF |
---|
| 1053 | ELSE |
---|
| 1054 | c_u(k,j) = c_max |
---|
[73] | 1055 | ENDIF |
---|
| 1056 | |
---|
[106] | 1057 | denom = v_m_r(k,j,nx) - v_m_r(k,j,nx-1) |
---|
[73] | 1058 | |
---|
[1353] | 1059 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 1060 | c_v(k,j) = -c_max * ( v(k,j,nx) - v_m_r(k,j,nx) ) / ( denom * tsc(2) ) |
---|
[1353] | 1061 | IF ( c_v(k,j) < 0.0_wp ) THEN |
---|
| 1062 | c_v(k,j) = 0.0_wp |
---|
[106] | 1063 | ELSEIF ( c_v(k,j) > c_max ) THEN |
---|
| 1064 | c_v(k,j) = c_max |
---|
| 1065 | ENDIF |
---|
| 1066 | ELSE |
---|
| 1067 | c_v(k,j) = c_max |
---|
[73] | 1068 | ENDIF |
---|
| 1069 | |
---|
[106] | 1070 | denom = w_m_r(k,j,nx) - w_m_r(k,j,nx-1) |
---|
[73] | 1071 | |
---|
[1353] | 1072 | IF ( denom /= 0.0_wp ) THEN |
---|
[996] | 1073 | c_w(k,j) = -c_max * ( w(k,j,nx) - w_m_r(k,j,nx) ) / ( denom * tsc(2) ) |
---|
[1353] | 1074 | IF ( c_w(k,j) < 0.0_wp ) THEN |
---|
| 1075 | c_w(k,j) = 0.0_wp |
---|
[106] | 1076 | ELSEIF ( c_w(k,j) > c_max ) THEN |
---|
| 1077 | c_w(k,j) = c_max |
---|
| 1078 | ENDIF |
---|
| 1079 | ELSE |
---|
| 1080 | c_w(k,j) = c_max |
---|
[73] | 1081 | ENDIF |
---|
[106] | 1082 | |
---|
[978] | 1083 | c_u_m_l(k) = c_u_m_l(k) + c_u(k,j) |
---|
| 1084 | c_v_m_l(k) = c_v_m_l(k) + c_v(k,j) |
---|
| 1085 | c_w_m_l(k) = c_w_m_l(k) + c_w(k,j) |
---|
[106] | 1086 | |
---|
[978] | 1087 | ENDDO |
---|
| 1088 | ENDDO |
---|
[73] | 1089 | |
---|
[978] | 1090 | #if defined( __parallel ) |
---|
| 1091 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dy, ierr ) |
---|
| 1092 | CALL MPI_ALLREDUCE( c_u_m_l(nzb+1), c_u_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 1093 | MPI_SUM, comm1dy, ierr ) |
---|
| 1094 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dy, ierr ) |
---|
| 1095 | CALL MPI_ALLREDUCE( c_v_m_l(nzb+1), c_v_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 1096 | MPI_SUM, comm1dy, ierr ) |
---|
| 1097 | IF ( collective_wait ) CALL MPI_BARRIER( comm1dy, ierr ) |
---|
| 1098 | CALL MPI_ALLREDUCE( c_w_m_l(nzb+1), c_w_m(nzb+1), nzt-nzb, MPI_REAL, & |
---|
| 1099 | MPI_SUM, comm1dy, ierr ) |
---|
| 1100 | #else |
---|
| 1101 | c_u_m = c_u_m_l |
---|
| 1102 | c_v_m = c_v_m_l |
---|
| 1103 | c_w_m = c_w_m_l |
---|
| 1104 | #endif |
---|
| 1105 | |
---|
| 1106 | c_u_m = c_u_m / (ny+1) |
---|
| 1107 | c_v_m = c_v_m / (ny+1) |
---|
| 1108 | c_w_m = c_w_m / (ny+1) |
---|
| 1109 | |
---|
[73] | 1110 | ! |
---|
[978] | 1111 | !-- Save old timelevels for the next timestep |
---|
| 1112 | IF ( intermediate_timestep_count == 1 ) THEN |
---|
| 1113 | u_m_r(:,:,:) = u(:,:,nx-1:nx) |
---|
| 1114 | v_m_r(:,:,:) = v(:,:,nx-1:nx) |
---|
| 1115 | w_m_r(:,:,:) = w(:,:,nx-1:nx) |
---|
| 1116 | ENDIF |
---|
[73] | 1117 | |
---|
[978] | 1118 | ! |
---|
| 1119 | !-- Calculate the new velocities |
---|
[996] | 1120 | DO k = nzb+1, nzt+1 |
---|
[1113] | 1121 | DO j = nysg, nyng |
---|
[978] | 1122 | u_p(k,j,nx+1) = u(k,j,nx+1) - dt_3d * tsc(2) * c_u_m(k) * & |
---|
| 1123 | ( u(k,j,nx+1) - u(k,j,nx) ) * ddx |
---|
[73] | 1124 | |
---|
[978] | 1125 | v_p(k,j,nx+1) = v(k,j,nx+1) - dt_3d * tsc(2) * c_v_m(k) * & |
---|
| 1126 | ( v(k,j,nx+1) - v(k,j,nx) ) * ddx |
---|
[73] | 1127 | |
---|
[978] | 1128 | w_p(k,j,nx+1) = w(k,j,nx+1) - dt_3d * tsc(2) * c_w_m(k) * & |
---|
| 1129 | ( w(k,j,nx+1) - w(k,j,nx) ) * ddx |
---|
| 1130 | ENDDO |
---|
[73] | 1131 | ENDDO |
---|
| 1132 | |
---|
| 1133 | ! |
---|
[978] | 1134 | !-- Bottom boundary at the outflow |
---|
| 1135 | IF ( ibc_uv_b == 0 ) THEN |
---|
[1353] | 1136 | u_p(nzb,:,nx+1) = 0.0_wp |
---|
| 1137 | v_p(nzb,:,nx+1) = 0.0_wp |
---|
[978] | 1138 | ELSE |
---|
| 1139 | u_p(nzb,:,nx+1) = u_p(nzb+1,:,nx+1) |
---|
| 1140 | v_p(nzb,:,nx+1) = v_p(nzb+1,:,nx+1) |
---|
| 1141 | ENDIF |
---|
[1353] | 1142 | w_p(nzb,:,nx+1) = 0.0_wp |
---|
[73] | 1143 | |
---|
| 1144 | ! |
---|
[978] | 1145 | !-- Top boundary at the outflow |
---|
| 1146 | IF ( ibc_uv_t == 0 ) THEN |
---|
| 1147 | u_p(nzt+1,:,nx+1) = u_init(nzt+1) |
---|
| 1148 | v_p(nzt+1,:,nx+1) = v_init(nzt+1) |
---|
| 1149 | ELSE |
---|
| 1150 | u_p(nzt+1,:,nx+1) = u_p(nzt,:,nx+1) |
---|
| 1151 | v_p(nzt+1,:,nx+1) = v_p(nzt,:,nx+1) |
---|
| 1152 | ENDIF |
---|
[1742] | 1153 | w_p(nzt:nzt+1,:,nx+1) = 0.0_wp |
---|
[978] | 1154 | |
---|
[1] | 1155 | ENDIF |
---|
| 1156 | |
---|
| 1157 | ENDIF |
---|
| 1158 | |
---|
| 1159 | END SUBROUTINE boundary_conds |
---|