[1682] | 1 | !> @file exchange_horiz_2d.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 | ! |
---|
[3655] | 17 | ! Copyright 1997-2019 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1683] | 22 | ! |
---|
[3543] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: exchange_horiz_2d.f90 3761 2019-02-25 15:31:42Z suehring $ |
---|
[3761] | 27 | ! variables moved to serial branch to avoid compiler warnings about unused variables |
---|
| 28 | ! |
---|
| 29 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3543] | 30 | ! - New routine for exchange of 8-bit integer arrays |
---|
| 31 | ! - Set Neumann conditions also at radiation boundary |
---|
| 32 | ! |
---|
| 33 | ! 3542 2018-11-20 17:04:13Z suehring |
---|
[3183] | 34 | ! Rename variables in offline nesting mode and flags indicating lateral |
---|
| 35 | ! boundary conditions |
---|
| 36 | ! |
---|
| 37 | ! 3182 2018-07-27 13:36:03Z suehring |
---|
[2716] | 38 | ! Corrected "Former revisions" section |
---|
| 39 | ! |
---|
| 40 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 41 | ! Change in file header (GPL part) |
---|
[2696] | 42 | ! Forcing implemented (MS) |
---|
| 43 | ! |
---|
| 44 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
[1321] | 45 | ! |
---|
[2001] | 46 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 47 | ! Forced header and separation lines into 80 columns |
---|
| 48 | ! |
---|
[1969] | 49 | ! 1968 2016-07-18 12:01:49Z suehring |
---|
| 50 | ! 2D-INTEGER exchange adopted for different multigrid level |
---|
| 51 | ! |
---|
[1933] | 52 | ! 1818 2016-04-06 15:53:27Z maronga |
---|
| 53 | ! Initial version of purely vertical nesting introduced. |
---|
| 54 | ! |
---|
[1805] | 55 | ! 1804 2016-04-05 16:30:18Z maronga |
---|
| 56 | ! Removed code for parameter file check (__check) |
---|
| 57 | ! |
---|
[1763] | 58 | ! 1762 2016-02-25 12:31:13Z hellstea |
---|
| 59 | ! Introduction of nested domain feature |
---|
| 60 | ! |
---|
[1683] | 61 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 62 | ! Code annotations made doxygen readable |
---|
| 63 | ! |
---|
[1349] | 64 | ! 1348 2014-03-27 18:01:03Z raasch |
---|
| 65 | ! bugfix: bc_lr_cyc and bc_ns_cyc added to ONLY-list |
---|
| 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 | ! |
---|
[1093] | 75 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 76 | ! unused variables removed |
---|
| 77 | ! |
---|
[1037] | 78 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 79 | ! code put under GPL (PALM 3.9) |
---|
| 80 | ! |
---|
[842] | 81 | ! 841 2012-02-28 12:29:49Z maronga |
---|
| 82 | ! Excluded routine from compilation of namelist_file_check |
---|
| 83 | ! |
---|
[1] | 84 | ! Revision 1.1 1998/01/23 09:58:21 raasch |
---|
| 85 | ! Initial revision |
---|
| 86 | ! |
---|
| 87 | ! |
---|
| 88 | ! Description: |
---|
| 89 | ! ------------ |
---|
[1682] | 90 | !> Exchange of lateral (ghost) boundaries (parallel computers) and cyclic |
---|
| 91 | !> boundary conditions, respectively, for 2D-arrays. |
---|
[1] | 92 | !------------------------------------------------------------------------------! |
---|
[1682] | 93 | SUBROUTINE exchange_horiz_2d( ar ) |
---|
| 94 | |
---|
[1] | 95 | |
---|
[1320] | 96 | USE control_parameters, & |
---|
[3182] | 97 | ONLY : bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, & |
---|
[3761] | 98 | bc_dirichlet_s, bc_radiation_l, & |
---|
[3182] | 99 | bc_radiation_n, bc_radiation_r, bc_radiation_s |
---|
[1320] | 100 | |
---|
| 101 | USE cpulog, & |
---|
| 102 | ONLY : cpu_log, log_point_s |
---|
| 103 | |
---|
| 104 | USE indices, & |
---|
| 105 | ONLY : nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg |
---|
| 106 | |
---|
| 107 | USE kinds |
---|
| 108 | |
---|
[1] | 109 | USE pegrid |
---|
| 110 | |
---|
[1933] | 111 | USE pmc_interface, & |
---|
| 112 | ONLY : nesting_mode |
---|
| 113 | |
---|
[3761] | 114 | #if ! defined( __parallel ) |
---|
| 115 | USE control_parameters, & |
---|
| 116 | ONLY: bc_lr_cyc, bc_ns_cyc |
---|
| 117 | #endif |
---|
[1933] | 118 | |
---|
[3761] | 119 | |
---|
[1] | 120 | IMPLICIT NONE |
---|
| 121 | |
---|
[841] | 122 | |
---|
[1682] | 123 | INTEGER(iwp) :: i !< |
---|
[1320] | 124 | |
---|
[1682] | 125 | REAL(wp) :: ar(nysg:nyng,nxlg:nxrg) !< |
---|
[1320] | 126 | |
---|
[1] | 127 | |
---|
| 128 | CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'start' ) |
---|
| 129 | |
---|
| 130 | #if defined( __parallel ) |
---|
| 131 | |
---|
| 132 | ! |
---|
| 133 | !-- Exchange of lateral boundary values for parallel computers |
---|
| 134 | IF ( pdims(1) == 1 ) THEN |
---|
| 135 | |
---|
| 136 | ! |
---|
| 137 | !-- One-dimensional decomposition along y, boundary values can be exchanged |
---|
| 138 | !-- within the PE memory |
---|
[702] | 139 | ar(:,nxlg:nxl-1) = ar(:,nxr-nbgp+1:nxr) |
---|
| 140 | ar(:,nxr+1:nxrg) = ar(:,nxl:nxl+nbgp-1) |
---|
[1] | 141 | |
---|
| 142 | ELSE |
---|
| 143 | ! |
---|
| 144 | !-- Send left boundary, receive right one |
---|
[667] | 145 | |
---|
[702] | 146 | CALL MPI_SENDRECV( ar(nysg,nxl), 1, type_y, pleft, 0, & |
---|
| 147 | ar(nysg,nxr+1), 1, type_y, pright, 0, & |
---|
[1] | 148 | comm2d, status, ierr ) |
---|
| 149 | ! |
---|
| 150 | !-- Send right boundary, receive left one |
---|
[702] | 151 | CALL MPI_SENDRECV( ar(nysg,nxr+1-nbgp), 1, type_y, pright, 1, & |
---|
| 152 | ar(nysg,nxlg), 1, type_y, pleft, 1, & |
---|
[1] | 153 | comm2d, status, ierr ) |
---|
[702] | 154 | |
---|
| 155 | |
---|
[1] | 156 | ENDIF |
---|
| 157 | |
---|
| 158 | IF ( pdims(2) == 1 ) THEN |
---|
| 159 | ! |
---|
| 160 | !-- One-dimensional decomposition along x, boundary values can be exchanged |
---|
| 161 | !-- within the PE memory |
---|
[702] | 162 | ar(nysg:nys-1,:) = ar(nyn-nbgp+1:nyn,:) |
---|
| 163 | ar(nyn+1:nyng,:) = ar(nys:nys+nbgp-1,:) |
---|
[1] | 164 | |
---|
| 165 | ELSE |
---|
| 166 | ! |
---|
| 167 | !-- Send front boundary, receive rear one |
---|
[667] | 168 | |
---|
[702] | 169 | CALL MPI_SENDRECV( ar(nys,nxlg), 1, type_x, psouth, 0, & |
---|
| 170 | ar(nyn+1,nxlg), 1, type_x, pnorth, 0, & |
---|
[1] | 171 | comm2d, status, ierr ) |
---|
| 172 | ! |
---|
| 173 | !-- Send rear boundary, receive front one |
---|
[702] | 174 | CALL MPI_SENDRECV( ar(nyn+1-nbgp,nxlg), 1, type_x, pnorth, 1, & |
---|
| 175 | ar(nysg,nxlg), 1, type_x, psouth, 1, & |
---|
[1] | 176 | comm2d, status, ierr ) |
---|
[667] | 177 | |
---|
[1] | 178 | ENDIF |
---|
| 179 | |
---|
| 180 | #else |
---|
| 181 | |
---|
| 182 | ! |
---|
| 183 | !-- Lateral boundary conditions in the non-parallel case |
---|
[707] | 184 | IF ( bc_lr_cyc ) THEN |
---|
[702] | 185 | ar(:,nxlg:nxl-1) = ar(:,nxr-nbgp+1:nxr) |
---|
| 186 | ar(:,nxr+1:nxrg) = ar(:,nxl:nxl+nbgp-1) |
---|
[1] | 187 | ENDIF |
---|
| 188 | |
---|
[707] | 189 | IF ( bc_ns_cyc ) THEN |
---|
[702] | 190 | ar(nysg:nys-1,:) = ar(nyn-nbgp+1:nyn,:) |
---|
| 191 | ar(nyn+1:nyng,:) = ar(nys:nys+nbgp-1,:) |
---|
[1] | 192 | ENDIF |
---|
| 193 | |
---|
[667] | 194 | |
---|
[1] | 195 | #endif |
---|
| 196 | |
---|
[73] | 197 | ! |
---|
[1762] | 198 | !-- Neumann-conditions at inflow/outflow/nested boundaries |
---|
[1933] | 199 | IF ( nesting_mode /= 'vertical' ) THEN |
---|
[3182] | 200 | IF ( bc_dirichlet_l .OR. bc_radiation_l ) THEN |
---|
[1933] | 201 | DO i = nbgp, 1, -1 |
---|
| 202 | ar(:,nxl-i) = ar(:,nxl) |
---|
| 203 | ENDDO |
---|
| 204 | ENDIF |
---|
[3182] | 205 | IF ( bc_dirichlet_r .OR. bc_radiation_r ) THEN |
---|
[1933] | 206 | DO i = 1, nbgp |
---|
| 207 | ar(:,nxr+i) = ar(:,nxr) |
---|
| 208 | ENDDO |
---|
| 209 | ENDIF |
---|
[3182] | 210 | IF ( bc_dirichlet_s .OR. bc_radiation_s ) THEN |
---|
[1933] | 211 | DO i = nbgp, 1, -1 |
---|
| 212 | ar(nys-i,:) = ar(nys,:) |
---|
| 213 | ENDDO |
---|
| 214 | ENDIF |
---|
[3182] | 215 | IF ( bc_dirichlet_n .OR. bc_radiation_n ) THEN |
---|
[1933] | 216 | DO i = 1, nbgp |
---|
| 217 | ar(nyn+i,:) = ar(nyn,:) |
---|
| 218 | ENDDO |
---|
| 219 | ENDIF |
---|
[1762] | 220 | ENDIF |
---|
| 221 | |
---|
[1] | 222 | CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'stop' ) |
---|
| 223 | |
---|
| 224 | END SUBROUTINE exchange_horiz_2d |
---|
| 225 | |
---|
| 226 | |
---|
[3542] | 227 | !------------------------------------------------------------------------------! |
---|
| 228 | ! Description: |
---|
| 229 | ! ------------ |
---|
| 230 | !> Exchange of lateral (ghost) boundaries (parallel computers) and cyclic |
---|
| 231 | !> boundary conditions, respectively, for 2D 8-bit integer arrays. |
---|
| 232 | !------------------------------------------------------------------------------! |
---|
| 233 | SUBROUTINE exchange_horiz_2d_byte( ar, nys_l, nyn_l, nxl_l, nxr_l, nbgp_local ) |
---|
[1] | 234 | |
---|
[3542] | 235 | |
---|
| 236 | USE control_parameters, & |
---|
| 237 | ONLY: bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, & |
---|
| 238 | bc_dirichlet_s, bc_radiation_l, bc_radiation_n, bc_radiation_r, & |
---|
| 239 | bc_radiation_s, bc_lr_cyc, bc_ns_cyc, bc_radiation_l, & |
---|
[3761] | 240 | bc_radiation_n, bc_radiation_r, bc_radiation_s |
---|
[3542] | 241 | |
---|
| 242 | USE cpulog, & |
---|
| 243 | ONLY: cpu_log, log_point_s |
---|
| 244 | |
---|
| 245 | USE kinds |
---|
| 246 | |
---|
| 247 | USE pegrid |
---|
| 248 | |
---|
| 249 | IMPLICIT NONE |
---|
| 250 | |
---|
| 251 | INTEGER(iwp) :: i !< dummy index to zero-gradient conditions at in/outflow boundaries |
---|
| 252 | INTEGER(iwp) :: nxl_l !< local index bound at current grid level, left side |
---|
| 253 | INTEGER(iwp) :: nxr_l !< local index bound at current grid level, right side |
---|
| 254 | INTEGER(iwp) :: nyn_l !< local index bound at current grid level, north side |
---|
| 255 | INTEGER(iwp) :: nys_l !< local index bound at current grid level, south side |
---|
| 256 | INTEGER(iwp) :: nbgp_local !< number of ghost layers to be exchanged |
---|
| 257 | |
---|
| 258 | INTEGER(KIND=1), DIMENSION(nys_l-nbgp_local:nyn_l+nbgp_local, & |
---|
| 259 | nxl_l-nbgp_local:nxr_l+nbgp_local) :: ar !< treated array |
---|
| 260 | |
---|
| 261 | CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'start' ) |
---|
| 262 | |
---|
| 263 | #if defined( __parallel ) |
---|
| 264 | |
---|
| 265 | ! |
---|
| 266 | !-- Exchange of lateral boundary values for parallel computers |
---|
| 267 | IF ( pdims(1) == 1 ) THEN |
---|
| 268 | |
---|
| 269 | ! |
---|
| 270 | !-- One-dimensional decomposition along y, boundary values can be exchanged |
---|
| 271 | !-- within the PE memory |
---|
| 272 | ar(:,nxl_l-nbgp_local:nxl_l-1) = ar(:,nxr_l-nbgp_local+1:nxr_l) |
---|
| 273 | ar(:,nxr_l+1:nxr_l+nbgp_local) = ar(:,nxl_l:nxl_l+nbgp_local-1) |
---|
| 274 | |
---|
| 275 | ELSE |
---|
| 276 | ! |
---|
| 277 | !-- Send left boundary, receive right one |
---|
| 278 | CALL MPI_SENDRECV( ar(nys_l-nbgp_local,nxl_l), 1, & |
---|
| 279 | type_y_byte, pleft, 0, & |
---|
| 280 | ar(nys_l-nbgp_local,nxr_l+1), 1, & |
---|
| 281 | type_y_byte, pright, 0, & |
---|
| 282 | comm2d, status, ierr ) |
---|
| 283 | ! |
---|
| 284 | !-- Send right boundary, receive left one |
---|
| 285 | CALL MPI_SENDRECV( ar(nys_l-nbgp_local,nxr_l+1-nbgp_local), 1, & |
---|
| 286 | type_y_byte, pright, 1, & |
---|
| 287 | ar(nys_l-nbgp_local,nxl_l-nbgp_local), 1, & |
---|
| 288 | type_y_byte, pleft, 1, & |
---|
| 289 | comm2d, status, ierr ) |
---|
| 290 | |
---|
| 291 | ENDIF |
---|
| 292 | |
---|
| 293 | IF ( pdims(2) == 1 ) THEN |
---|
| 294 | ! |
---|
| 295 | !-- One-dimensional decomposition along x, boundary values can be exchanged |
---|
| 296 | !-- within the PE memory |
---|
| 297 | ar(nys_l-nbgp_local:nys_l-1,:) = ar(nyn_l+1-nbgp_local:nyn_l,:) |
---|
| 298 | ar(nyn_l+1:nyn_l+nbgp_local,:) = ar(nys_l:nys_l-1+nbgp_local,:) |
---|
| 299 | |
---|
| 300 | |
---|
| 301 | ELSE |
---|
| 302 | ! |
---|
| 303 | !-- Send front boundary, receive rear one |
---|
| 304 | CALL MPI_SENDRECV( ar(nys_l,nxl_l-nbgp_local), 1, & |
---|
| 305 | type_x_byte, psouth, 0, & |
---|
| 306 | ar(nyn_l+1,nxl_l-nbgp_local), 1, & |
---|
| 307 | type_x_byte, pnorth, 0, & |
---|
| 308 | comm2d, status, ierr ) |
---|
| 309 | |
---|
| 310 | ! |
---|
| 311 | !-- Send rear boundary, receive front one |
---|
| 312 | CALL MPI_SENDRECV( ar(nyn_l+1-nbgp_local,nxl_l-nbgp_local), 1, & |
---|
| 313 | type_x_byte, pnorth, 1, & |
---|
| 314 | ar(nys_l-nbgp_local,nxl_l-nbgp_local), 1, & |
---|
| 315 | type_x_byte, psouth, 1, & |
---|
| 316 | comm2d, status, ierr ) |
---|
| 317 | |
---|
| 318 | ENDIF |
---|
| 319 | |
---|
| 320 | #else |
---|
| 321 | |
---|
| 322 | ! |
---|
| 323 | !-- Lateral boundary conditions in the non-parallel case |
---|
| 324 | IF ( bc_lr_cyc ) THEN |
---|
| 325 | ar(:,nxl_l-nbgp_local:nxl_l-1) = ar(:,nxr_l-nbgp_local+1:nxr_l) |
---|
| 326 | ar(:,nxr_l+1:nxr_l+nbgp_local) = ar(:,nxl_l:nxl_l+nbgp_local-1) |
---|
| 327 | ENDIF |
---|
| 328 | |
---|
| 329 | IF ( bc_ns_cyc ) THEN |
---|
| 330 | ar(nys_l-nbgp_local:nys_l-1,:) = ar(nyn_l+1-nbgp_local:nyn_l,:) |
---|
| 331 | ar(nyn_l+1:nyn_l+nbgp_local,:) = ar(nys_l:nys_l-1+nbgp_local,:) |
---|
| 332 | ENDIF |
---|
| 333 | |
---|
| 334 | #endif |
---|
| 335 | ! |
---|
| 336 | !-- Neumann-conditions at inflow/outflow/nested boundaries |
---|
| 337 | IF ( bc_dirichlet_l .OR. bc_radiation_l ) THEN |
---|
| 338 | DO i = nbgp_local, 1, -1 |
---|
| 339 | ar(:,nxl_l-i) = ar(:,nxl_l) |
---|
| 340 | ENDDO |
---|
| 341 | ENDIF |
---|
| 342 | IF ( bc_dirichlet_r .OR. bc_radiation_r ) THEN |
---|
| 343 | DO i = 1, nbgp_local |
---|
| 344 | ar(:,nxr_l+i) = ar(:,nxr_l) |
---|
| 345 | ENDDO |
---|
| 346 | ENDIF |
---|
| 347 | IF ( bc_dirichlet_s .OR. bc_radiation_s ) THEN |
---|
| 348 | DO i = nbgp_local, 1, -1 |
---|
| 349 | ar(nys_l-i,:) = ar(nys_l,:) |
---|
| 350 | ENDDO |
---|
| 351 | ENDIF |
---|
| 352 | IF ( bc_dirichlet_n .OR. bc_radiation_n ) THEN |
---|
| 353 | DO i = 1, nbgp_local |
---|
| 354 | ar(nyn_l+i,:) = ar(nyn_l,:) |
---|
| 355 | ENDDO |
---|
| 356 | ENDIF |
---|
| 357 | |
---|
| 358 | CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'stop' ) |
---|
| 359 | |
---|
| 360 | END SUBROUTINE exchange_horiz_2d_byte |
---|
| 361 | |
---|
| 362 | |
---|
[1] | 363 | !------------------------------------------------------------------------------! |
---|
| 364 | ! Description: |
---|
| 365 | ! ------------ |
---|
[1682] | 366 | !> Exchange of lateral (ghost) boundaries (parallel computers) and cyclic |
---|
[3542] | 367 | !> boundary conditions, respectively, for 2D 32-bit integer arrays. |
---|
[1] | 368 | !------------------------------------------------------------------------------! |
---|
[1968] | 369 | SUBROUTINE exchange_horiz_2d_int( ar, nys_l, nyn_l, nxl_l, nxr_l, nbgp_local ) |
---|
[1] | 370 | |
---|
[1682] | 371 | |
---|
[1320] | 372 | USE control_parameters, & |
---|
[3182] | 373 | ONLY: bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, & |
---|
[3542] | 374 | bc_dirichlet_s, bc_radiation_l, bc_radiation_n, bc_radiation_r, & |
---|
| 375 | bc_radiation_s, bc_lr_cyc, bc_ns_cyc, bc_radiation_l, & |
---|
[3182] | 376 | bc_radiation_n, bc_radiation_r, bc_radiation_s, grid_level |
---|
[1320] | 377 | |
---|
| 378 | USE cpulog, & |
---|
| 379 | ONLY: cpu_log, log_point_s |
---|
[1968] | 380 | |
---|
[1320] | 381 | USE kinds |
---|
| 382 | |
---|
[1] | 383 | USE pegrid |
---|
| 384 | |
---|
| 385 | IMPLICIT NONE |
---|
| 386 | |
---|
[1968] | 387 | INTEGER(iwp) :: i !< dummy index to zero-gradient conditions at in/outflow boundaries |
---|
| 388 | INTEGER(iwp) :: nxl_l !< local index bound at current grid level, left side |
---|
| 389 | INTEGER(iwp) :: nxr_l !< local index bound at current grid level, right side |
---|
| 390 | INTEGER(iwp) :: nyn_l !< local index bound at current grid level, north side |
---|
| 391 | INTEGER(iwp) :: nys_l !< local index bound at current grid level, south side |
---|
| 392 | INTEGER(iwp) :: nbgp_local !< number of ghost layers to be exchanged |
---|
[1] | 393 | |
---|
[1968] | 394 | INTEGER(iwp), DIMENSION(nys_l-nbgp_local:nyn_l+nbgp_local, & |
---|
| 395 | nxl_l-nbgp_local:nxr_l+nbgp_local) :: ar !< treated array |
---|
| 396 | |
---|
[1] | 397 | CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'start' ) |
---|
| 398 | |
---|
| 399 | #if defined( __parallel ) |
---|
| 400 | |
---|
| 401 | ! |
---|
| 402 | !-- Exchange of lateral boundary values for parallel computers |
---|
| 403 | IF ( pdims(1) == 1 ) THEN |
---|
| 404 | |
---|
| 405 | ! |
---|
| 406 | !-- One-dimensional decomposition along y, boundary values can be exchanged |
---|
| 407 | !-- within the PE memory |
---|
[1968] | 408 | ar(:,nxl_l-nbgp_local:nxl_l-1) = ar(:,nxr_l-nbgp_local+1:nxr_l) |
---|
| 409 | ar(:,nxr_l+1:nxr_l+nbgp_local) = ar(:,nxl_l:nxl_l+nbgp_local-1) |
---|
[1] | 410 | |
---|
| 411 | ELSE |
---|
| 412 | ! |
---|
| 413 | !-- Send left boundary, receive right one |
---|
[1968] | 414 | CALL MPI_SENDRECV( ar(nys_l-nbgp_local,nxl_l), 1, & |
---|
| 415 | type_y_int(grid_level), pleft, 0, & |
---|
| 416 | ar(nys_l-nbgp_local,nxr_l+1), 1, & |
---|
| 417 | type_y_int(grid_level), pright, 0, & |
---|
[1] | 418 | comm2d, status, ierr ) |
---|
| 419 | ! |
---|
| 420 | !-- Send right boundary, receive left one |
---|
[1968] | 421 | CALL MPI_SENDRECV( ar(nys_l-nbgp_local,nxr_l+1-nbgp_local), 1, & |
---|
| 422 | type_y_int(grid_level), pright, 1, & |
---|
| 423 | ar(nys_l-nbgp_local,nxl_l-nbgp_local), 1, & |
---|
| 424 | type_y_int(grid_level), pleft, 1, & |
---|
| 425 | comm2d, status, ierr ) |
---|
[667] | 426 | |
---|
[1] | 427 | ENDIF |
---|
| 428 | |
---|
| 429 | IF ( pdims(2) == 1 ) THEN |
---|
| 430 | ! |
---|
| 431 | !-- One-dimensional decomposition along x, boundary values can be exchanged |
---|
| 432 | !-- within the PE memory |
---|
[1968] | 433 | ar(nys_l-nbgp_local:nys_l-1,:) = ar(nyn_l+1-nbgp_local:nyn_l,:) |
---|
| 434 | ar(nyn_l+1:nyn_l+nbgp_local,:) = ar(nys_l:nys_l-1+nbgp_local,:) |
---|
[1] | 435 | |
---|
[667] | 436 | |
---|
[1] | 437 | ELSE |
---|
| 438 | ! |
---|
| 439 | !-- Send front boundary, receive rear one |
---|
[1968] | 440 | CALL MPI_SENDRECV( ar(nys_l,nxl_l-nbgp_local), 1, & |
---|
| 441 | type_x_int(grid_level), psouth, 0, & |
---|
| 442 | ar(nyn_l+1,nxl_l-nbgp_local), 1, & |
---|
| 443 | type_x_int(grid_level), pnorth, 0, & |
---|
[702] | 444 | comm2d, status, ierr ) |
---|
[667] | 445 | |
---|
[1] | 446 | ! |
---|
| 447 | !-- Send rear boundary, receive front one |
---|
[1968] | 448 | CALL MPI_SENDRECV( ar(nyn_l+1-nbgp_local,nxl_l-nbgp_local), 1, & |
---|
| 449 | type_x_int(grid_level), pnorth, 1, & |
---|
| 450 | ar(nys_l-nbgp_local,nxl_l-nbgp_local), 1, & |
---|
| 451 | type_x_int(grid_level), psouth, 1, & |
---|
[1] | 452 | comm2d, status, ierr ) |
---|
[667] | 453 | |
---|
[1] | 454 | ENDIF |
---|
| 455 | |
---|
| 456 | #else |
---|
| 457 | |
---|
| 458 | ! |
---|
| 459 | !-- Lateral boundary conditions in the non-parallel case |
---|
[707] | 460 | IF ( bc_lr_cyc ) THEN |
---|
[1968] | 461 | ar(:,nxl_l-nbgp_local:nxl_l-1) = ar(:,nxr_l-nbgp_local+1:nxr_l) |
---|
| 462 | ar(:,nxr_l+1:nxr_l+nbgp_local) = ar(:,nxl_l:nxl_l+nbgp_local-1) |
---|
[1] | 463 | ENDIF |
---|
| 464 | |
---|
[707] | 465 | IF ( bc_ns_cyc ) THEN |
---|
[1968] | 466 | ar(nys_l-nbgp_local:nys_l-1,:) = ar(nyn_l+1-nbgp_local:nyn_l,:) |
---|
| 467 | ar(nyn_l+1:nyn_l+nbgp_local,:) = ar(nys_l:nys_l-1+nbgp_local,:) |
---|
[1] | 468 | ENDIF |
---|
| 469 | |
---|
| 470 | #endif |
---|
[1762] | 471 | ! |
---|
| 472 | !-- Neumann-conditions at inflow/outflow/nested boundaries |
---|
[3542] | 473 | IF ( bc_dirichlet_l .OR. bc_radiation_l ) THEN |
---|
[1968] | 474 | DO i = nbgp_local, 1, -1 |
---|
| 475 | ar(:,nxl_l-i) = ar(:,nxl_l) |
---|
[1762] | 476 | ENDDO |
---|
| 477 | ENDIF |
---|
[3542] | 478 | IF ( bc_dirichlet_r .OR. bc_radiation_r ) THEN |
---|
[1968] | 479 | DO i = 1, nbgp_local |
---|
| 480 | ar(:,nxr_l+i) = ar(:,nxr_l) |
---|
[1762] | 481 | ENDDO |
---|
| 482 | ENDIF |
---|
[3542] | 483 | IF ( bc_dirichlet_s .OR. bc_radiation_s ) THEN |
---|
[1968] | 484 | DO i = nbgp_local, 1, -1 |
---|
| 485 | ar(nys_l-i,:) = ar(nys_l,:) |
---|
[1762] | 486 | ENDDO |
---|
| 487 | ENDIF |
---|
[3542] | 488 | IF ( bc_dirichlet_n .OR. bc_radiation_n ) THEN |
---|
[1968] | 489 | DO i = 1, nbgp_local |
---|
| 490 | ar(nyn_l+i,:) = ar(nyn_l,:) |
---|
[1762] | 491 | ENDDO |
---|
| 492 | ENDIF |
---|
| 493 | |
---|
[1] | 494 | CALL cpu_log( log_point_s(13), 'exchange_horiz_2d', 'stop' ) |
---|
| 495 | |
---|
| 496 | END SUBROUTINE exchange_horiz_2d_int |
---|