[1] | 1 | SUBROUTINE init_pegrid |
---|
| 2 | |
---|
| 3 | !------------------------------------------------------------------------------! |
---|
[254] | 4 | ! Current revisions: |
---|
[1] | 5 | ! ----------------- |
---|
[668] | 6 | ! |
---|
[710] | 7 | ! |
---|
[668] | 8 | ! ATTENTION: nnz_x undefined problem still has to be solved!!!!!!!! |
---|
| 9 | ! TEST OUTPUT (TO BE REMOVED) logging mpi2 ierr values |
---|
[667] | 10 | ! |
---|
[668] | 11 | ! Former revisions: |
---|
| 12 | ! ----------------- |
---|
| 13 | ! $Id: init_pegrid.f90 724 2011-04-11 06:42:09Z hoffmann $ |
---|
| 14 | ! |
---|
[724] | 15 | ! 722 2011-04-11 06:21:09Z raasch |
---|
| 16 | ! Bugfix: bc_lr/ns_cyc/dirrad/raddir replaced by bc_lr/ns, because variables |
---|
| 17 | ! are not yet set here; grid_level set to 0 |
---|
| 18 | ! |
---|
[710] | 19 | ! 709 2011-03-30 09:31:40Z raasch |
---|
| 20 | ! formatting adjustments |
---|
| 21 | ! |
---|
[708] | 22 | ! 707 2011-03-29 11:39:40Z raasch |
---|
| 23 | ! bc_lr/ns replaced by bc_lr/ns_cyc/dirrad/raddir |
---|
| 24 | ! |
---|
[668] | 25 | ! 667 2010-12-23 12:06:00Z suehring/gryschka |
---|
[667] | 26 | ! Moved determination of target_id's from init_coupling |
---|
[669] | 27 | ! Determination of parameters needed for coupling (coupling_topology, ngp_a, |
---|
| 28 | ! ngp_o) with different grid/processor-topology in ocean and atmosphere |
---|
[667] | 29 | ! Adaption of ngp_xy, ngp_y to a dynamic number of ghost points. |
---|
| 30 | ! The maximum_grid_level changed from 1 to 0. 0 is the normal grid, 1 to |
---|
| 31 | ! maximum_grid_level the grids for multigrid, in which 0 and 1 are normal grids. |
---|
| 32 | ! This distinction is due to reasons of data exchange and performance for the |
---|
| 33 | ! normal grid and grids in poismg. |
---|
| 34 | ! The definition of MPI-Vectors adapted to a dynamic numer of ghost points. |
---|
| 35 | ! New MPI-Vectors for data exchange between left and right boundaries added. |
---|
| 36 | ! This is due to reasons of performance (10% faster). |
---|
[77] | 37 | ! |
---|
[647] | 38 | ! 646 2010-12-15 13:03:52Z raasch |
---|
| 39 | ! lctit is now using a 2d decomposition by default |
---|
| 40 | ! |
---|
[623] | 41 | ! 622 2010-12-10 08:08:13Z raasch |
---|
| 42 | ! optional barriers included in order to speed up collective operations |
---|
| 43 | ! |
---|
[482] | 44 | ! 438 2010-02-01 04:32:43Z raasch |
---|
| 45 | ! 2d-decomposition is default for Cray-XT machines |
---|
[77] | 46 | ! |
---|
[392] | 47 | ! 274 2009-03-26 15:11:21Z heinze |
---|
| 48 | ! Output of messages replaced by message handling routine. |
---|
| 49 | ! |
---|
[226] | 50 | ! 206 2008-10-13 14:59:11Z raasch |
---|
| 51 | ! Implementation of a MPI-1 coupling: added __parallel within the __mpi2 part |
---|
| 52 | ! 2d-decomposition is default on SGI-ICE systems |
---|
| 53 | ! |
---|
[198] | 54 | ! 197 2008-09-16 15:29:03Z raasch |
---|
| 55 | ! multigrid levels are limited by subdomains if mg_switch_to_pe0_level = -1, |
---|
| 56 | ! nz is used instead nnz for calculating mg-levels |
---|
| 57 | ! Collect on PE0 horizontal index bounds from all other PEs, |
---|
| 58 | ! broadcast the id of the inflow PE (using the respective communicator) |
---|
| 59 | ! |
---|
[139] | 60 | ! 114 2007-10-10 00:03:15Z raasch |
---|
| 61 | ! Allocation of wall flag arrays for multigrid solver |
---|
| 62 | ! |
---|
[110] | 63 | ! 108 2007-08-24 15:10:38Z letzel |
---|
| 64 | ! Intercommunicator (comm_inter) and derived data type (type_xy) for |
---|
| 65 | ! coupled model runs created, assign coupling_mode_remote, |
---|
| 66 | ! indices nxlu and nysv are calculated (needed for non-cyclic boundary |
---|
| 67 | ! conditions) |
---|
| 68 | ! |
---|
[83] | 69 | ! 82 2007-04-16 15:40:52Z raasch |
---|
| 70 | ! Cpp-directive lcmuk changed to intel_openmp_bug, setting of host on lcmuk by |
---|
| 71 | ! cpp-directive removed |
---|
| 72 | ! |
---|
[77] | 73 | ! 75 2007-03-22 09:54:05Z raasch |
---|
[73] | 74 | ! uxrp, vynp eliminated, |
---|
[75] | 75 | ! dirichlet/neumann changed to dirichlet/radiation, etc., |
---|
| 76 | ! poisfft_init is only called if fft-solver is switched on |
---|
[1] | 77 | ! |
---|
[3] | 78 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 79 | ! |
---|
[1] | 80 | ! Revision 1.28 2006/04/26 13:23:32 raasch |
---|
| 81 | ! lcmuk does not understand the !$ comment so a cpp-directive is required |
---|
| 82 | ! |
---|
| 83 | ! Revision 1.1 1997/07/24 11:15:09 raasch |
---|
| 84 | ! Initial revision |
---|
| 85 | ! |
---|
| 86 | ! |
---|
| 87 | ! Description: |
---|
| 88 | ! ------------ |
---|
| 89 | ! Determination of the virtual processor topology (if not prescribed by the |
---|
| 90 | ! user)and computation of the grid point number and array bounds of the local |
---|
| 91 | ! domains. |
---|
| 92 | !------------------------------------------------------------------------------! |
---|
| 93 | |
---|
| 94 | USE control_parameters |
---|
| 95 | USE fft_xy |
---|
[163] | 96 | USE grid_variables |
---|
[1] | 97 | USE indices |
---|
| 98 | USE pegrid |
---|
| 99 | USE poisfft_mod |
---|
| 100 | USE poisfft_hybrid_mod |
---|
| 101 | USE statistics |
---|
| 102 | USE transpose_indices |
---|
| 103 | |
---|
| 104 | |
---|
[667] | 105 | |
---|
[1] | 106 | IMPLICIT NONE |
---|
| 107 | |
---|
[163] | 108 | INTEGER :: gathered_size, i, id_inflow_l, id_recycling_l, ind(5), j, k, & |
---|
[151] | 109 | maximum_grid_level_l, mg_switch_to_pe0_level_l, mg_levels_x, & |
---|
| 110 | mg_levels_y, mg_levels_z, nnx_y, nnx_z, nny_x, nny_z, nnz_x, & |
---|
| 111 | nnz_y, numproc_sqr, nx_total, nxl_l, nxr_l, nyn_l, nys_l, & |
---|
| 112 | nzb_l, nzt_l, omp_get_num_threads, subdomain_size |
---|
[1] | 113 | |
---|
| 114 | INTEGER, DIMENSION(:), ALLOCATABLE :: ind_all, nxlf, nxrf, nynf, nysf |
---|
| 115 | |
---|
[667] | 116 | INTEGER, DIMENSION(2) :: pdims_remote |
---|
| 117 | |
---|
[1] | 118 | LOGICAL :: found |
---|
| 119 | |
---|
| 120 | ! |
---|
| 121 | !-- Get the number of OpenMP threads |
---|
| 122 | !$OMP PARALLEL |
---|
[82] | 123 | #if defined( __intel_openmp_bug ) |
---|
[1] | 124 | threads_per_task = omp_get_num_threads() |
---|
| 125 | #else |
---|
| 126 | !$ threads_per_task = omp_get_num_threads() |
---|
| 127 | #endif |
---|
| 128 | !$OMP END PARALLEL |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | #if defined( __parallel ) |
---|
[667] | 132 | |
---|
[1] | 133 | ! |
---|
| 134 | !-- Determine the processor topology or check it, if prescribed by the user |
---|
| 135 | IF ( npex == -1 .AND. npey == -1 ) THEN |
---|
| 136 | |
---|
| 137 | ! |
---|
| 138 | !-- Automatic determination of the topology |
---|
| 139 | !-- The default on SMP- and cluster-hosts is a 1d-decomposition along x |
---|
[206] | 140 | IF ( host(1:3) == 'ibm' .OR. host(1:3) == 'nec' .OR. & |
---|
[438] | 141 | ( host(1:2) == 'lc' .AND. host(3:5) /= 'sgi' .AND. & |
---|
[646] | 142 | host(3:4) /= 'xt' .AND. host(3:5) /= 'tit' ) .OR. & |
---|
[206] | 143 | host(1:3) == 'dec' ) THEN |
---|
[1] | 144 | |
---|
| 145 | pdims(1) = numprocs |
---|
| 146 | pdims(2) = 1 |
---|
| 147 | |
---|
| 148 | ELSE |
---|
| 149 | |
---|
| 150 | numproc_sqr = SQRT( REAL( numprocs ) ) |
---|
| 151 | pdims(1) = MAX( numproc_sqr , 1 ) |
---|
| 152 | DO WHILE ( MOD( numprocs , pdims(1) ) /= 0 ) |
---|
| 153 | pdims(1) = pdims(1) - 1 |
---|
| 154 | ENDDO |
---|
| 155 | pdims(2) = numprocs / pdims(1) |
---|
| 156 | |
---|
| 157 | ENDIF |
---|
| 158 | |
---|
| 159 | ELSEIF ( npex /= -1 .AND. npey /= -1 ) THEN |
---|
| 160 | |
---|
| 161 | ! |
---|
| 162 | !-- Prescribed by user. Number of processors on the prescribed topology |
---|
| 163 | !-- must be equal to the number of PEs available to the job |
---|
| 164 | IF ( ( npex * npey ) /= numprocs ) THEN |
---|
[274] | 165 | WRITE( message_string, * ) 'number of PEs of the prescribed ', & |
---|
| 166 | 'topology (', npex*npey,') does not match & the number of ', & |
---|
| 167 | 'PEs available to the job (', numprocs, ')' |
---|
[254] | 168 | CALL message( 'init_pegrid', 'PA0221', 1, 2, 0, 6, 0 ) |
---|
[1] | 169 | ENDIF |
---|
| 170 | pdims(1) = npex |
---|
| 171 | pdims(2) = npey |
---|
| 172 | |
---|
| 173 | ELSE |
---|
| 174 | ! |
---|
| 175 | !-- If the processor topology is prescribed by the user, the number of |
---|
| 176 | !-- PEs must be given in both directions |
---|
[274] | 177 | message_string = 'if the processor topology is prescribed by the, ' // & |
---|
| 178 | ' user& both values of "npex" and "npey" must be given ' // & |
---|
| 179 | 'in the &NAMELIST-parameter file' |
---|
[254] | 180 | CALL message( 'init_pegrid', 'PA0222', 1, 2, 0, 6, 0 ) |
---|
[1] | 181 | |
---|
| 182 | ENDIF |
---|
| 183 | |
---|
| 184 | ! |
---|
| 185 | !-- The hybrid solver can only be used in case of a 1d-decomposition along x |
---|
| 186 | IF ( pdims(2) /= 1 .AND. psolver == 'poisfft_hybrid' ) THEN |
---|
[254] | 187 | message_string = 'psolver = "poisfft_hybrid" can only be' // & |
---|
| 188 | '& used in case of a 1d-decomposition along x' |
---|
| 189 | CALL message( 'init_pegrid', 'PA0223', 1, 2, 0, 6, 0 ) |
---|
[1] | 190 | ENDIF |
---|
| 191 | |
---|
| 192 | ! |
---|
[622] | 193 | !-- For communication speedup, set barriers in front of collective |
---|
| 194 | !-- communications by default on SGI-type systems |
---|
| 195 | IF ( host(3:5) == 'sgi' ) collective_wait = .TRUE. |
---|
| 196 | |
---|
| 197 | ! |
---|
[1] | 198 | !-- If necessary, set horizontal boundary conditions to non-cyclic |
---|
[724] | 199 | IF ( bc_lr /= 'cyclic' ) cyclic(1) = .FALSE. |
---|
| 200 | IF ( bc_ns /= 'cyclic' ) cyclic(2) = .FALSE. |
---|
[1] | 201 | |
---|
| 202 | ! |
---|
| 203 | !-- Create the virtual processor grid |
---|
| 204 | CALL MPI_CART_CREATE( comm_palm, ndim, pdims, cyclic, reorder, & |
---|
| 205 | comm2d, ierr ) |
---|
| 206 | CALL MPI_COMM_RANK( comm2d, myid, ierr ) |
---|
| 207 | WRITE (myid_char,'(''_'',I4.4)') myid |
---|
| 208 | |
---|
| 209 | CALL MPI_CART_COORDS( comm2d, myid, ndim, pcoord, ierr ) |
---|
| 210 | CALL MPI_CART_SHIFT( comm2d, 0, 1, pleft, pright, ierr ) |
---|
| 211 | CALL MPI_CART_SHIFT( comm2d, 1, 1, psouth, pnorth, ierr ) |
---|
| 212 | |
---|
| 213 | ! |
---|
| 214 | !-- Determine sub-topologies for transpositions |
---|
| 215 | !-- Transposition from z to x: |
---|
| 216 | remain_dims(1) = .TRUE. |
---|
| 217 | remain_dims(2) = .FALSE. |
---|
| 218 | CALL MPI_CART_SUB( comm2d, remain_dims, comm1dx, ierr ) |
---|
| 219 | CALL MPI_COMM_RANK( comm1dx, myidx, ierr ) |
---|
| 220 | ! |
---|
| 221 | !-- Transposition from x to y |
---|
| 222 | remain_dims(1) = .FALSE. |
---|
| 223 | remain_dims(2) = .TRUE. |
---|
| 224 | CALL MPI_CART_SUB( comm2d, remain_dims, comm1dy, ierr ) |
---|
| 225 | CALL MPI_COMM_RANK( comm1dy, myidy, ierr ) |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | ! |
---|
| 229 | !-- Find a grid (used for array d) which will match the transposition demands |
---|
| 230 | IF ( grid_matching == 'strict' ) THEN |
---|
| 231 | |
---|
| 232 | nxa = nx; nya = ny; nza = nz |
---|
| 233 | |
---|
| 234 | ELSE |
---|
| 235 | |
---|
| 236 | found = .FALSE. |
---|
| 237 | xn: DO nxa = nx, 2*nx |
---|
| 238 | ! |
---|
| 239 | !-- Meet conditions for nx |
---|
| 240 | IF ( MOD( nxa+1, pdims(1) ) /= 0 .OR. & |
---|
| 241 | MOD( nxa+1, pdims(2) ) /= 0 ) CYCLE xn |
---|
| 242 | |
---|
| 243 | yn: DO nya = ny, 2*ny |
---|
| 244 | ! |
---|
| 245 | !-- Meet conditions for ny |
---|
| 246 | IF ( MOD( nya+1, pdims(2) ) /= 0 .OR. & |
---|
| 247 | MOD( nya+1, pdims(1) ) /= 0 ) CYCLE yn |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | zn: DO nza = nz, 2*nz |
---|
| 251 | ! |
---|
| 252 | !-- Meet conditions for nz |
---|
| 253 | IF ( ( MOD( nza, pdims(1) ) /= 0 .AND. pdims(1) /= 1 .AND. & |
---|
| 254 | pdims(2) /= 1 ) .OR. & |
---|
| 255 | ( MOD( nza, pdims(2) ) /= 0 .AND. dt_dosp /= 9999999.9 & |
---|
| 256 | ) ) THEN |
---|
| 257 | CYCLE zn |
---|
| 258 | ELSE |
---|
| 259 | found = .TRUE. |
---|
| 260 | EXIT xn |
---|
| 261 | ENDIF |
---|
| 262 | |
---|
| 263 | ENDDO zn |
---|
| 264 | |
---|
| 265 | ENDDO yn |
---|
| 266 | |
---|
| 267 | ENDDO xn |
---|
| 268 | |
---|
| 269 | IF ( .NOT. found ) THEN |
---|
[254] | 270 | message_string = 'no matching grid for transpositions found' |
---|
| 271 | CALL message( 'init_pegrid', 'PA0224', 1, 2, 0, 6, 0 ) |
---|
[1] | 272 | ENDIF |
---|
| 273 | |
---|
| 274 | ENDIF |
---|
| 275 | |
---|
| 276 | ! |
---|
| 277 | !-- Calculate array bounds in x-direction for every PE. |
---|
| 278 | !-- The last PE along x may get less grid points than the others |
---|
| 279 | ALLOCATE( nxlf(0:pdims(1)-1), nxrf(0:pdims(1)-1), nynf(0:pdims(2)-1), & |
---|
| 280 | nysf(0:pdims(2)-1), nnx_pe(0:pdims(1)-1), nny_pe(0:pdims(2)-1) ) |
---|
| 281 | |
---|
| 282 | IF ( MOD( nxa+1 , pdims(1) ) /= 0 ) THEN |
---|
[274] | 283 | WRITE( message_string, * ) 'x-direction: gridpoint number (',nx+1,') ',& |
---|
| 284 | 'is not an& integral divisor of the number ', & |
---|
| 285 | 'processors (', pdims(1),')' |
---|
[254] | 286 | CALL message( 'init_pegrid', 'PA0225', 1, 2, 0, 6, 0 ) |
---|
[1] | 287 | ELSE |
---|
| 288 | nnx = ( nxa + 1 ) / pdims(1) |
---|
| 289 | IF ( nnx*pdims(1) - ( nx + 1) > nnx ) THEN |
---|
[274] | 290 | WRITE( message_string, * ) 'x-direction: nx does not match the', & |
---|
| 291 | 'requirements given by the number of PEs &used', & |
---|
| 292 | '& please use nx = ', nx - ( pdims(1) - ( nnx*pdims(1) & |
---|
| 293 | - ( nx + 1 ) ) ), ' instead of nx =', nx |
---|
[254] | 294 | CALL message( 'init_pegrid', 'PA0226', 1, 2, 0, 6, 0 ) |
---|
[1] | 295 | ENDIF |
---|
| 296 | ENDIF |
---|
| 297 | |
---|
| 298 | ! |
---|
| 299 | !-- Left and right array bounds, number of gridpoints |
---|
| 300 | DO i = 0, pdims(1)-1 |
---|
| 301 | nxlf(i) = i * nnx |
---|
| 302 | nxrf(i) = ( i + 1 ) * nnx - 1 |
---|
| 303 | nnx_pe(i) = MIN( nx, nxrf(i) ) - nxlf(i) + 1 |
---|
| 304 | ENDDO |
---|
| 305 | |
---|
| 306 | ! |
---|
| 307 | !-- Calculate array bounds in y-direction for every PE. |
---|
| 308 | IF ( MOD( nya+1 , pdims(2) ) /= 0 ) THEN |
---|
[274] | 309 | WRITE( message_string, * ) 'y-direction: gridpoint number (',ny+1,') ', & |
---|
| 310 | 'is not an& integral divisor of the number of', & |
---|
| 311 | 'processors (', pdims(2),')' |
---|
[254] | 312 | CALL message( 'init_pegrid', 'PA0227', 1, 2, 0, 6, 0 ) |
---|
[1] | 313 | ELSE |
---|
| 314 | nny = ( nya + 1 ) / pdims(2) |
---|
| 315 | IF ( nny*pdims(2) - ( ny + 1) > nny ) THEN |
---|
[274] | 316 | WRITE( message_string, * ) 'y-direction: ny does not match the', & |
---|
| 317 | 'requirements given by the number of PEs &used ', & |
---|
| 318 | '& please use ny = ', ny - ( pdims(2) - ( nnx*pdims(2) & |
---|
[254] | 319 | - ( ny + 1 ) ) ), ' instead of ny =', ny |
---|
| 320 | CALL message( 'init_pegrid', 'PA0228', 1, 2, 0, 6, 0 ) |
---|
[1] | 321 | ENDIF |
---|
| 322 | ENDIF |
---|
| 323 | |
---|
| 324 | ! |
---|
| 325 | !-- South and north array bounds |
---|
| 326 | DO j = 0, pdims(2)-1 |
---|
| 327 | nysf(j) = j * nny |
---|
| 328 | nynf(j) = ( j + 1 ) * nny - 1 |
---|
| 329 | nny_pe(j) = MIN( ny, nynf(j) ) - nysf(j) + 1 |
---|
| 330 | ENDDO |
---|
| 331 | |
---|
| 332 | ! |
---|
| 333 | !-- Local array bounds of the respective PEs |
---|
| 334 | nxl = nxlf(pcoord(1)) |
---|
| 335 | nxra = nxrf(pcoord(1)) |
---|
| 336 | nxr = MIN( nx, nxra ) |
---|
| 337 | nys = nysf(pcoord(2)) |
---|
| 338 | nyna = nynf(pcoord(2)) |
---|
| 339 | nyn = MIN( ny, nyna ) |
---|
| 340 | nzb = 0 |
---|
| 341 | nzta = nza |
---|
| 342 | nzt = MIN( nz, nzta ) |
---|
| 343 | nnz = nza |
---|
| 344 | |
---|
| 345 | ! |
---|
[707] | 346 | !-- Set switches to define if the PE is situated at the border of the virtual |
---|
| 347 | !-- processor grid |
---|
| 348 | IF ( nxl == 0 ) left_border_pe = .TRUE. |
---|
| 349 | IF ( nxr == nx ) right_border_pe = .TRUE. |
---|
| 350 | IF ( nys == 0 ) south_border_pe = .TRUE. |
---|
| 351 | IF ( nyn == ny ) north_border_pe = .TRUE. |
---|
| 352 | |
---|
| 353 | ! |
---|
[1] | 354 | !-- Calculate array bounds and gridpoint numbers for the transposed arrays |
---|
| 355 | !-- (needed in the pressure solver) |
---|
| 356 | !-- For the transposed arrays, cyclic boundaries as well as top and bottom |
---|
| 357 | !-- boundaries are omitted, because they are obstructive to the transposition |
---|
| 358 | |
---|
| 359 | ! |
---|
| 360 | !-- 1. transposition z --> x |
---|
| 361 | !-- This transposition is not neccessary in case of a 1d-decomposition along x, |
---|
| 362 | !-- except that the uptream-spline method is switched on |
---|
| 363 | IF ( pdims(2) /= 1 .OR. momentum_advec == 'ups-scheme' .OR. & |
---|
| 364 | scalar_advec == 'ups-scheme' ) THEN |
---|
| 365 | |
---|
| 366 | IF ( pdims(2) == 1 .AND. ( momentum_advec == 'ups-scheme' .OR. & |
---|
| 367 | scalar_advec == 'ups-scheme' ) ) THEN |
---|
[254] | 368 | message_string = '1d-decomposition along x ' // & |
---|
| 369 | 'chosen but nz restrictions may occur' // & |
---|
| 370 | '& since ups-scheme is activated' |
---|
| 371 | CALL message( 'init_pegrid', 'PA0229', 0, 1, 0, 6, 0 ) |
---|
[1] | 372 | ENDIF |
---|
| 373 | nys_x = nys |
---|
| 374 | nyn_xa = nyna |
---|
| 375 | nyn_x = nyn |
---|
| 376 | nny_x = nny |
---|
| 377 | IF ( MOD( nza , pdims(1) ) /= 0 ) THEN |
---|
[274] | 378 | WRITE( message_string, * ) 'transposition z --> x:', & |
---|
| 379 | '&nz=',nz,' is not an integral divisior of pdims(1)=', & |
---|
| 380 | pdims(1) |
---|
[254] | 381 | CALL message( 'init_pegrid', 'PA0230', 1, 2, 0, 6, 0 ) |
---|
[1] | 382 | ENDIF |
---|
| 383 | nnz_x = nza / pdims(1) |
---|
| 384 | nzb_x = 1 + myidx * nnz_x |
---|
| 385 | nzt_xa = ( myidx + 1 ) * nnz_x |
---|
| 386 | nzt_x = MIN( nzt, nzt_xa ) |
---|
| 387 | |
---|
| 388 | sendrecvcount_zx = nnx * nny * nnz_x |
---|
| 389 | |
---|
[181] | 390 | ELSE |
---|
| 391 | ! |
---|
| 392 | !--- Setting of dummy values because otherwise variables are undefined in |
---|
| 393 | !--- the next step x --> y |
---|
| 394 | !--- WARNING: This case has still to be clarified!!!!!!!!!!!! |
---|
| 395 | nnz_x = 1 |
---|
| 396 | nzb_x = 1 |
---|
| 397 | nzt_xa = 1 |
---|
| 398 | nzt_x = 1 |
---|
| 399 | nny_x = nny |
---|
| 400 | |
---|
[1] | 401 | ENDIF |
---|
| 402 | |
---|
| 403 | ! |
---|
| 404 | !-- 2. transposition x --> y |
---|
| 405 | nnz_y = nnz_x |
---|
| 406 | nzb_y = nzb_x |
---|
| 407 | nzt_ya = nzt_xa |
---|
| 408 | nzt_y = nzt_x |
---|
| 409 | IF ( MOD( nxa+1 , pdims(2) ) /= 0 ) THEN |
---|
[274] | 410 | WRITE( message_string, * ) 'transposition x --> y:', & |
---|
| 411 | '&nx+1=',nx+1,' is not an integral divisor of ',& |
---|
| 412 | 'pdims(2)=',pdims(2) |
---|
[254] | 413 | CALL message( 'init_pegrid', 'PA0231', 1, 2, 0, 6, 0 ) |
---|
[1] | 414 | ENDIF |
---|
| 415 | nnx_y = (nxa+1) / pdims(2) |
---|
| 416 | nxl_y = myidy * nnx_y |
---|
| 417 | nxr_ya = ( myidy + 1 ) * nnx_y - 1 |
---|
| 418 | nxr_y = MIN( nx, nxr_ya ) |
---|
| 419 | |
---|
| 420 | sendrecvcount_xy = nnx_y * nny_x * nnz_y |
---|
| 421 | |
---|
| 422 | ! |
---|
| 423 | !-- 3. transposition y --> z (ELSE: x --> y in case of 1D-decomposition |
---|
| 424 | !-- along x) |
---|
| 425 | IF ( pdims(2) /= 1 .OR. momentum_advec == 'ups-scheme' .OR. & |
---|
| 426 | scalar_advec == 'ups-scheme' ) THEN |
---|
| 427 | ! |
---|
| 428 | !-- y --> z |
---|
| 429 | !-- This transposition is not neccessary in case of a 1d-decomposition |
---|
| 430 | !-- along x, except that the uptream-spline method is switched on |
---|
| 431 | nnx_z = nnx_y |
---|
| 432 | nxl_z = nxl_y |
---|
| 433 | nxr_za = nxr_ya |
---|
| 434 | nxr_z = nxr_y |
---|
| 435 | IF ( MOD( nya+1 , pdims(1) ) /= 0 ) THEN |
---|
[274] | 436 | WRITE( message_string, * ) 'transposition y --> z:', & |
---|
| 437 | '& ny+1=',ny+1,' is not an integral divisor of ',& |
---|
| 438 | 'pdims(1)=',pdims(1) |
---|
[254] | 439 | CALL message( 'init_pegrid', 'PA0232', 1, 2, 0, 6, 0 ) |
---|
[1] | 440 | ENDIF |
---|
| 441 | nny_z = (nya+1) / pdims(1) |
---|
| 442 | nys_z = myidx * nny_z |
---|
| 443 | nyn_za = ( myidx + 1 ) * nny_z - 1 |
---|
| 444 | nyn_z = MIN( ny, nyn_za ) |
---|
| 445 | |
---|
| 446 | sendrecvcount_yz = nnx_y * nny_z * nnz_y |
---|
| 447 | |
---|
| 448 | ELSE |
---|
| 449 | ! |
---|
| 450 | !-- x --> y. This condition must be fulfilled for a 1D-decomposition along x |
---|
| 451 | IF ( MOD( nya+1 , pdims(1) ) /= 0 ) THEN |
---|
[274] | 452 | WRITE( message_string, * ) 'transposition x --> y:', & |
---|
| 453 | '& ny+1=',ny+1,' is not an integral divisor of ',& |
---|
| 454 | 'pdims(1)=',pdims(1) |
---|
[254] | 455 | CALL message( 'init_pegrid', 'PA0233', 1, 2, 0, 6, 0 ) |
---|
[1] | 456 | ENDIF |
---|
| 457 | |
---|
| 458 | ENDIF |
---|
| 459 | |
---|
| 460 | ! |
---|
| 461 | !-- Indices for direct transpositions z --> y (used for calculating spectra) |
---|
| 462 | IF ( dt_dosp /= 9999999.9 ) THEN |
---|
| 463 | IF ( MOD( nza, pdims(2) ) /= 0 ) THEN |
---|
[274] | 464 | WRITE( message_string, * ) 'direct transposition z --> y (needed ', & |
---|
| 465 | 'for spectra):& nz=',nz,' is not an integral divisor of ',& |
---|
| 466 | 'pdims(2)=',pdims(2) |
---|
[254] | 467 | CALL message( 'init_pegrid', 'PA0234', 1, 2, 0, 6, 0 ) |
---|
[1] | 468 | ELSE |
---|
| 469 | nxl_yd = nxl |
---|
| 470 | nxr_yda = nxra |
---|
| 471 | nxr_yd = nxr |
---|
| 472 | nzb_yd = 1 + myidy * ( nza / pdims(2) ) |
---|
| 473 | nzt_yda = ( myidy + 1 ) * ( nza / pdims(2) ) |
---|
| 474 | nzt_yd = MIN( nzt, nzt_yda ) |
---|
| 475 | |
---|
| 476 | sendrecvcount_zyd = nnx * nny * ( nza / pdims(2) ) |
---|
| 477 | ENDIF |
---|
| 478 | ENDIF |
---|
| 479 | |
---|
| 480 | ! |
---|
| 481 | !-- Indices for direct transpositions y --> x (they are only possible in case |
---|
| 482 | !-- of a 1d-decomposition along x) |
---|
| 483 | IF ( pdims(2) == 1 ) THEN |
---|
| 484 | nny_x = nny / pdims(1) |
---|
| 485 | nys_x = myid * nny_x |
---|
| 486 | nyn_xa = ( myid + 1 ) * nny_x - 1 |
---|
| 487 | nyn_x = MIN( ny, nyn_xa ) |
---|
| 488 | nzb_x = 1 |
---|
| 489 | nzt_xa = nza |
---|
| 490 | nzt_x = nz |
---|
| 491 | sendrecvcount_xy = nnx * nny_x * nza |
---|
| 492 | ENDIF |
---|
| 493 | |
---|
| 494 | ! |
---|
| 495 | !-- Indices for direct transpositions x --> y (they are only possible in case |
---|
| 496 | !-- of a 1d-decomposition along y) |
---|
| 497 | IF ( pdims(1) == 1 ) THEN |
---|
| 498 | nnx_y = nnx / pdims(2) |
---|
| 499 | nxl_y = myid * nnx_y |
---|
| 500 | nxr_ya = ( myid + 1 ) * nnx_y - 1 |
---|
| 501 | nxr_y = MIN( nx, nxr_ya ) |
---|
| 502 | nzb_y = 1 |
---|
| 503 | nzt_ya = nza |
---|
| 504 | nzt_y = nz |
---|
| 505 | sendrecvcount_xy = nnx_y * nny * nza |
---|
| 506 | ENDIF |
---|
| 507 | |
---|
| 508 | ! |
---|
| 509 | !-- Arrays for storing the array bounds are needed any more |
---|
| 510 | DEALLOCATE( nxlf , nxrf , nynf , nysf ) |
---|
| 511 | |
---|
[145] | 512 | ! |
---|
| 513 | !-- Collect index bounds from other PEs (to be written to restart file later) |
---|
| 514 | ALLOCATE( hor_index_bounds(4,0:numprocs-1) ) |
---|
| 515 | |
---|
| 516 | IF ( myid == 0 ) THEN |
---|
| 517 | |
---|
| 518 | hor_index_bounds(1,0) = nxl |
---|
| 519 | hor_index_bounds(2,0) = nxr |
---|
| 520 | hor_index_bounds(3,0) = nys |
---|
| 521 | hor_index_bounds(4,0) = nyn |
---|
| 522 | |
---|
| 523 | ! |
---|
| 524 | !-- Receive data from all other PEs |
---|
| 525 | DO i = 1, numprocs-1 |
---|
| 526 | CALL MPI_RECV( ibuf, 4, MPI_INTEGER, i, MPI_ANY_TAG, comm2d, status, & |
---|
| 527 | ierr ) |
---|
| 528 | hor_index_bounds(:,i) = ibuf(1:4) |
---|
| 529 | ENDDO |
---|
| 530 | |
---|
| 531 | ELSE |
---|
| 532 | ! |
---|
| 533 | !-- Send index bounds to PE0 |
---|
| 534 | ibuf(1) = nxl |
---|
| 535 | ibuf(2) = nxr |
---|
| 536 | ibuf(3) = nys |
---|
| 537 | ibuf(4) = nyn |
---|
| 538 | CALL MPI_SEND( ibuf, 4, MPI_INTEGER, 0, myid, comm2d, ierr ) |
---|
| 539 | |
---|
| 540 | ENDIF |
---|
| 541 | |
---|
[1] | 542 | #if defined( __print ) |
---|
| 543 | ! |
---|
| 544 | !-- Control output |
---|
| 545 | IF ( myid == 0 ) THEN |
---|
| 546 | PRINT*, '*** processor topology ***' |
---|
| 547 | PRINT*, ' ' |
---|
| 548 | PRINT*, 'myid pcoord left right south north idx idy nxl: nxr',& |
---|
| 549 | &' nys: nyn' |
---|
| 550 | PRINT*, '------------------------------------------------------------',& |
---|
| 551 | &'-----------' |
---|
| 552 | WRITE (*,1000) 0, pcoord(1), pcoord(2), pleft, pright, psouth, pnorth, & |
---|
| 553 | myidx, myidy, nxl, nxr, nys, nyn |
---|
| 554 | 1000 FORMAT (I4,2X,'(',I3,',',I3,')',3X,I4,2X,I4,3X,I4,2X,I4,2X,I3,1X,I3, & |
---|
| 555 | 2(2X,I4,':',I4)) |
---|
| 556 | |
---|
| 557 | ! |
---|
[108] | 558 | !-- Receive data from the other PEs |
---|
[1] | 559 | DO i = 1,numprocs-1 |
---|
| 560 | CALL MPI_RECV( ibuf, 12, MPI_INTEGER, i, MPI_ANY_TAG, comm2d, status, & |
---|
| 561 | ierr ) |
---|
| 562 | WRITE (*,1000) i, ( ibuf(j) , j = 1,12 ) |
---|
| 563 | ENDDO |
---|
| 564 | ELSE |
---|
| 565 | |
---|
| 566 | ! |
---|
| 567 | !-- Send data to PE0 |
---|
| 568 | ibuf(1) = pcoord(1); ibuf(2) = pcoord(2); ibuf(3) = pleft |
---|
| 569 | ibuf(4) = pright; ibuf(5) = psouth; ibuf(6) = pnorth; ibuf(7) = myidx |
---|
| 570 | ibuf(8) = myidy; ibuf(9) = nxl; ibuf(10) = nxr; ibuf(11) = nys |
---|
| 571 | ibuf(12) = nyn |
---|
| 572 | CALL MPI_SEND( ibuf, 12, MPI_INTEGER, 0, myid, comm2d, ierr ) |
---|
| 573 | ENDIF |
---|
| 574 | #endif |
---|
| 575 | |
---|
[206] | 576 | #if defined( __parallel ) |
---|
[102] | 577 | #if defined( __mpi2 ) |
---|
| 578 | ! |
---|
| 579 | !-- In case of coupled runs, get the port name on PE0 of the atmosphere model |
---|
| 580 | !-- and pass it to PE0 of the ocean model |
---|
| 581 | IF ( myid == 0 ) THEN |
---|
| 582 | |
---|
| 583 | IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
| 584 | |
---|
| 585 | CALL MPI_OPEN_PORT( MPI_INFO_NULL, port_name, ierr ) |
---|
[108] | 586 | |
---|
[102] | 587 | CALL MPI_PUBLISH_NAME( 'palm_coupler', MPI_INFO_NULL, port_name, & |
---|
| 588 | ierr ) |
---|
[108] | 589 | |
---|
| 590 | ! |
---|
[104] | 591 | !-- Write a flag file for the ocean model and the other atmosphere |
---|
| 592 | !-- processes. |
---|
| 593 | !-- There seems to be a bug in MPICH2 which causes hanging processes |
---|
| 594 | !-- in case that execution of LOOKUP_NAME is continued too early |
---|
| 595 | !-- (i.e. before the port has been created) |
---|
| 596 | OPEN( 90, FILE='COUPLING_PORT_OPENED', FORM='FORMATTED' ) |
---|
| 597 | WRITE ( 90, '(''TRUE'')' ) |
---|
| 598 | CLOSE ( 90 ) |
---|
[102] | 599 | |
---|
| 600 | ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
| 601 | |
---|
[104] | 602 | ! |
---|
| 603 | !-- Continue only if the atmosphere model has created the port. |
---|
| 604 | !-- There seems to be a bug in MPICH2 which causes hanging processes |
---|
| 605 | !-- in case that execution of LOOKUP_NAME is continued too early |
---|
| 606 | !-- (i.e. before the port has been created) |
---|
| 607 | INQUIRE( FILE='COUPLING_PORT_OPENED', EXIST=found ) |
---|
| 608 | DO WHILE ( .NOT. found ) |
---|
| 609 | INQUIRE( FILE='COUPLING_PORT_OPENED', EXIST=found ) |
---|
| 610 | ENDDO |
---|
| 611 | |
---|
[102] | 612 | CALL MPI_LOOKUP_NAME( 'palm_coupler', MPI_INFO_NULL, port_name, ierr ) |
---|
| 613 | |
---|
| 614 | ENDIF |
---|
| 615 | |
---|
| 616 | ENDIF |
---|
| 617 | |
---|
| 618 | ! |
---|
| 619 | !-- In case of coupled runs, establish the connection between the atmosphere |
---|
| 620 | !-- and the ocean model and define the intercommunicator (comm_inter) |
---|
| 621 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 622 | IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
| 623 | |
---|
| 624 | CALL MPI_COMM_ACCEPT( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, & |
---|
| 625 | comm_inter, ierr ) |
---|
[108] | 626 | coupling_mode_remote = 'ocean_to_atmosphere' |
---|
| 627 | |
---|
[102] | 628 | ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
| 629 | |
---|
| 630 | CALL MPI_COMM_CONNECT( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, & |
---|
| 631 | comm_inter, ierr ) |
---|
[108] | 632 | coupling_mode_remote = 'atmosphere_to_ocean' |
---|
| 633 | |
---|
[102] | 634 | ENDIF |
---|
[206] | 635 | #endif |
---|
[102] | 636 | |
---|
[667] | 637 | ! |
---|
[709] | 638 | !-- Determine the number of ghost point layers |
---|
| 639 | IF ( scalar_advec == 'ws-scheme' .OR. momentum_advec == 'ws-scheme' ) THEN |
---|
[667] | 640 | nbgp = 3 |
---|
| 641 | ELSE |
---|
| 642 | nbgp = 1 |
---|
[709] | 643 | ENDIF |
---|
[667] | 644 | |
---|
[102] | 645 | ! |
---|
[709] | 646 | !-- Create a new MPI derived datatype for the exchange of surface (xy) data, |
---|
| 647 | !-- which is needed for coupled atmosphere-ocean runs. |
---|
| 648 | !-- First, calculate number of grid points of an xy-plane. |
---|
[667] | 649 | ngp_xy = ( nxr - nxl + 1 + 2 * nbgp ) * ( nyn - nys + 1 + 2 * nbgp ) |
---|
[102] | 650 | CALL MPI_TYPE_VECTOR( ngp_xy, 1, nzt-nzb+2, MPI_REAL, type_xy, ierr ) |
---|
| 651 | CALL MPI_TYPE_COMMIT( type_xy, ierr ) |
---|
[667] | 652 | |
---|
[709] | 653 | IF ( TRIM( coupling_mode ) /= 'uncoupled' ) THEN |
---|
[667] | 654 | |
---|
| 655 | ! |
---|
| 656 | !-- Pass the number of grid points of the atmosphere model to |
---|
| 657 | !-- the ocean model and vice versa |
---|
| 658 | IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
| 659 | |
---|
| 660 | nx_a = nx |
---|
| 661 | ny_a = ny |
---|
| 662 | |
---|
[709] | 663 | IF ( myid == 0 ) THEN |
---|
| 664 | |
---|
| 665 | CALL MPI_SEND( nx_a, 1, MPI_INTEGER, numprocs, 1, comm_inter, & |
---|
| 666 | ierr ) |
---|
| 667 | CALL MPI_SEND( ny_a, 1, MPI_INTEGER, numprocs, 2, comm_inter, & |
---|
| 668 | ierr ) |
---|
| 669 | CALL MPI_SEND( pdims, 2, MPI_INTEGER, numprocs, 3, comm_inter, & |
---|
| 670 | ierr ) |
---|
| 671 | CALL MPI_RECV( nx_o, 1, MPI_INTEGER, numprocs, 4, comm_inter, & |
---|
| 672 | status, ierr ) |
---|
| 673 | CALL MPI_RECV( ny_o, 1, MPI_INTEGER, numprocs, 5, comm_inter, & |
---|
| 674 | status, ierr ) |
---|
| 675 | CALL MPI_RECV( pdims_remote, 2, MPI_INTEGER, numprocs, 6, & |
---|
[667] | 676 | comm_inter, status, ierr ) |
---|
| 677 | ENDIF |
---|
| 678 | |
---|
[709] | 679 | CALL MPI_BCAST( nx_o, 1, MPI_INTEGER, 0, comm2d, ierr ) |
---|
| 680 | CALL MPI_BCAST( ny_o, 1, MPI_INTEGER, 0, comm2d, ierr ) |
---|
| 681 | CALL MPI_BCAST( pdims_remote, 2, MPI_INTEGER, 0, comm2d, ierr ) |
---|
[667] | 682 | |
---|
| 683 | ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
| 684 | |
---|
| 685 | nx_o = nx |
---|
| 686 | ny_o = ny |
---|
| 687 | |
---|
| 688 | IF ( myid == 0 ) THEN |
---|
[709] | 689 | |
---|
| 690 | CALL MPI_RECV( nx_a, 1, MPI_INTEGER, 0, 1, comm_inter, status, & |
---|
| 691 | ierr ) |
---|
| 692 | CALL MPI_RECV( ny_a, 1, MPI_INTEGER, 0, 2, comm_inter, status, & |
---|
| 693 | ierr ) |
---|
| 694 | CALL MPI_RECV( pdims_remote, 2, MPI_INTEGER, 0, 3, comm_inter, & |
---|
| 695 | status, ierr ) |
---|
| 696 | CALL MPI_SEND( nx_o, 1, MPI_INTEGER, 0, 4, comm_inter, ierr ) |
---|
| 697 | CALL MPI_SEND( ny_o, 1, MPI_INTEGER, 0, 5, comm_inter, ierr ) |
---|
| 698 | CALL MPI_SEND( pdims, 2, MPI_INTEGER, 0, 6, comm_inter, ierr ) |
---|
[667] | 699 | ENDIF |
---|
| 700 | |
---|
| 701 | CALL MPI_BCAST( nx_a, 1, MPI_INTEGER, 0, comm2d, ierr) |
---|
| 702 | CALL MPI_BCAST( ny_a, 1, MPI_INTEGER, 0, comm2d, ierr) |
---|
| 703 | CALL MPI_BCAST( pdims_remote, 2, MPI_INTEGER, 0, comm2d, ierr) |
---|
| 704 | |
---|
| 705 | ENDIF |
---|
| 706 | |
---|
[709] | 707 | ngp_a = ( nx_a+1 + 2 * nbgp ) * ( ny_a+1 + 2 * nbgp ) |
---|
| 708 | ngp_o = ( nx_o+1 + 2 * nbgp ) * ( ny_o+1 + 2 * nbgp ) |
---|
[667] | 709 | |
---|
| 710 | ! |
---|
[709] | 711 | !-- Determine if the horizontal grid and the number of PEs in ocean and |
---|
| 712 | !-- atmosphere is same or not |
---|
| 713 | IF ( nx_o == nx_a .AND. ny_o == ny_a .AND. & |
---|
[667] | 714 | pdims(1) == pdims_remote(1) .AND. pdims(2) == pdims_remote(2) ) & |
---|
| 715 | THEN |
---|
| 716 | coupling_topology = 0 |
---|
| 717 | ELSE |
---|
| 718 | coupling_topology = 1 |
---|
| 719 | ENDIF |
---|
| 720 | |
---|
| 721 | ! |
---|
| 722 | !-- Determine the target PEs for the exchange between ocean and |
---|
| 723 | !-- atmosphere (comm2d) |
---|
[709] | 724 | IF ( coupling_topology == 0 ) THEN |
---|
| 725 | ! |
---|
| 726 | !-- In case of identical topologies, every atmosphere PE has exactly one |
---|
| 727 | !-- ocean PE counterpart and vice versa |
---|
| 728 | IF ( TRIM( coupling_mode ) == 'atmosphere_to_ocean' ) THEN |
---|
[667] | 729 | target_id = myid + numprocs |
---|
| 730 | ELSE |
---|
| 731 | target_id = myid |
---|
| 732 | ENDIF |
---|
| 733 | |
---|
| 734 | ELSE |
---|
| 735 | ! |
---|
| 736 | !-- In case of nonequivalent topology in ocean and atmosphere only for |
---|
| 737 | !-- PE0 in ocean and PE0 in atmosphere a target_id is needed, since |
---|
[709] | 738 | !-- data echxchange between ocean and atmosphere will be done only |
---|
| 739 | !-- between these PEs. |
---|
| 740 | IF ( myid == 0 ) THEN |
---|
| 741 | |
---|
| 742 | IF ( TRIM( coupling_mode ) == 'atmosphere_to_ocean' ) THEN |
---|
[667] | 743 | target_id = numprocs |
---|
| 744 | ELSE |
---|
| 745 | target_id = 0 |
---|
| 746 | ENDIF |
---|
[709] | 747 | |
---|
[667] | 748 | ENDIF |
---|
[709] | 749 | |
---|
[667] | 750 | ENDIF |
---|
| 751 | |
---|
| 752 | ENDIF |
---|
| 753 | |
---|
| 754 | |
---|
[102] | 755 | #endif |
---|
| 756 | |
---|
[1] | 757 | #else |
---|
| 758 | |
---|
| 759 | ! |
---|
| 760 | !-- Array bounds when running on a single PE (respectively a non-parallel |
---|
| 761 | !-- machine) |
---|
| 762 | nxl = 0 |
---|
| 763 | nxr = nx |
---|
| 764 | nxra = nx |
---|
| 765 | nnx = nxr - nxl + 1 |
---|
| 766 | nys = 0 |
---|
| 767 | nyn = ny |
---|
| 768 | nyna = ny |
---|
| 769 | nny = nyn - nys + 1 |
---|
| 770 | nzb = 0 |
---|
| 771 | nzt = nz |
---|
| 772 | nzta = nz |
---|
| 773 | nnz = nz |
---|
| 774 | |
---|
[145] | 775 | ALLOCATE( hor_index_bounds(4,0:0) ) |
---|
| 776 | hor_index_bounds(1,0) = nxl |
---|
| 777 | hor_index_bounds(2,0) = nxr |
---|
| 778 | hor_index_bounds(3,0) = nys |
---|
| 779 | hor_index_bounds(4,0) = nyn |
---|
| 780 | |
---|
[1] | 781 | ! |
---|
| 782 | !-- Array bounds for the pressure solver (in the parallel code, these bounds |
---|
| 783 | !-- are the ones for the transposed arrays) |
---|
| 784 | nys_x = nys |
---|
| 785 | nyn_x = nyn |
---|
| 786 | nyn_xa = nyn |
---|
| 787 | nzb_x = nzb + 1 |
---|
| 788 | nzt_x = nzt |
---|
| 789 | nzt_xa = nzt |
---|
| 790 | |
---|
| 791 | nxl_y = nxl |
---|
| 792 | nxr_y = nxr |
---|
| 793 | nxr_ya = nxr |
---|
| 794 | nzb_y = nzb + 1 |
---|
| 795 | nzt_y = nzt |
---|
| 796 | nzt_ya = nzt |
---|
| 797 | |
---|
| 798 | nxl_z = nxl |
---|
| 799 | nxr_z = nxr |
---|
| 800 | nxr_za = nxr |
---|
| 801 | nys_z = nys |
---|
| 802 | nyn_z = nyn |
---|
| 803 | nyn_za = nyn |
---|
| 804 | |
---|
| 805 | #endif |
---|
| 806 | |
---|
| 807 | ! |
---|
| 808 | !-- Calculate number of grid levels necessary for the multigrid poisson solver |
---|
| 809 | !-- as well as the gridpoint indices on each level |
---|
| 810 | IF ( psolver == 'multigrid' ) THEN |
---|
| 811 | |
---|
| 812 | ! |
---|
| 813 | !-- First calculate number of possible grid levels for the subdomains |
---|
| 814 | mg_levels_x = 1 |
---|
| 815 | mg_levels_y = 1 |
---|
| 816 | mg_levels_z = 1 |
---|
| 817 | |
---|
| 818 | i = nnx |
---|
| 819 | DO WHILE ( MOD( i, 2 ) == 0 .AND. i /= 2 ) |
---|
| 820 | i = i / 2 |
---|
| 821 | mg_levels_x = mg_levels_x + 1 |
---|
| 822 | ENDDO |
---|
| 823 | |
---|
| 824 | j = nny |
---|
| 825 | DO WHILE ( MOD( j, 2 ) == 0 .AND. j /= 2 ) |
---|
| 826 | j = j / 2 |
---|
| 827 | mg_levels_y = mg_levels_y + 1 |
---|
| 828 | ENDDO |
---|
| 829 | |
---|
[181] | 830 | k = nz ! do not use nnz because it might be > nz due to transposition |
---|
| 831 | ! requirements |
---|
[1] | 832 | DO WHILE ( MOD( k, 2 ) == 0 .AND. k /= 2 ) |
---|
| 833 | k = k / 2 |
---|
| 834 | mg_levels_z = mg_levels_z + 1 |
---|
| 835 | ENDDO |
---|
| 836 | |
---|
| 837 | maximum_grid_level = MIN( mg_levels_x, mg_levels_y, mg_levels_z ) |
---|
| 838 | |
---|
| 839 | ! |
---|
| 840 | !-- Find out, if the total domain allows more levels. These additional |
---|
[709] | 841 | !-- levels are identically processed on all PEs. |
---|
[197] | 842 | IF ( numprocs > 1 .AND. mg_switch_to_pe0_level /= -1 ) THEN |
---|
[709] | 843 | |
---|
[1] | 844 | IF ( mg_levels_z > MIN( mg_levels_x, mg_levels_y ) ) THEN |
---|
[709] | 845 | |
---|
[1] | 846 | mg_switch_to_pe0_level_l = maximum_grid_level |
---|
| 847 | |
---|
| 848 | mg_levels_x = 1 |
---|
| 849 | mg_levels_y = 1 |
---|
| 850 | |
---|
| 851 | i = nx+1 |
---|
| 852 | DO WHILE ( MOD( i, 2 ) == 0 .AND. i /= 2 ) |
---|
| 853 | i = i / 2 |
---|
| 854 | mg_levels_x = mg_levels_x + 1 |
---|
| 855 | ENDDO |
---|
| 856 | |
---|
| 857 | j = ny+1 |
---|
| 858 | DO WHILE ( MOD( j, 2 ) == 0 .AND. j /= 2 ) |
---|
| 859 | j = j / 2 |
---|
| 860 | mg_levels_y = mg_levels_y + 1 |
---|
| 861 | ENDDO |
---|
| 862 | |
---|
| 863 | maximum_grid_level_l = MIN( mg_levels_x, mg_levels_y, mg_levels_z ) |
---|
| 864 | |
---|
| 865 | IF ( maximum_grid_level_l > mg_switch_to_pe0_level_l ) THEN |
---|
| 866 | mg_switch_to_pe0_level_l = maximum_grid_level_l - & |
---|
| 867 | mg_switch_to_pe0_level_l + 1 |
---|
| 868 | ELSE |
---|
| 869 | mg_switch_to_pe0_level_l = 0 |
---|
| 870 | ENDIF |
---|
[709] | 871 | |
---|
[1] | 872 | ELSE |
---|
[709] | 873 | |
---|
[1] | 874 | mg_switch_to_pe0_level_l = 0 |
---|
| 875 | maximum_grid_level_l = maximum_grid_level |
---|
[709] | 876 | |
---|
[1] | 877 | ENDIF |
---|
| 878 | |
---|
| 879 | ! |
---|
| 880 | !-- Use switch level calculated above only if it is not pre-defined |
---|
| 881 | !-- by user |
---|
| 882 | IF ( mg_switch_to_pe0_level == 0 ) THEN |
---|
| 883 | |
---|
| 884 | IF ( mg_switch_to_pe0_level_l /= 0 ) THEN |
---|
| 885 | mg_switch_to_pe0_level = mg_switch_to_pe0_level_l |
---|
| 886 | maximum_grid_level = maximum_grid_level_l |
---|
| 887 | ENDIF |
---|
| 888 | |
---|
| 889 | ELSE |
---|
| 890 | ! |
---|
| 891 | !-- Check pre-defined value and reset to default, if neccessary |
---|
| 892 | IF ( mg_switch_to_pe0_level < mg_switch_to_pe0_level_l .OR. & |
---|
| 893 | mg_switch_to_pe0_level >= maximum_grid_level_l ) THEN |
---|
[254] | 894 | message_string = 'mg_switch_to_pe0_level ' // & |
---|
| 895 | 'out of range and reset to default (=0)' |
---|
| 896 | CALL message( 'init_pegrid', 'PA0235', 0, 1, 0, 6, 0 ) |
---|
[1] | 897 | mg_switch_to_pe0_level = 0 |
---|
| 898 | ELSE |
---|
| 899 | ! |
---|
| 900 | !-- Use the largest number of possible levels anyway and recalculate |
---|
| 901 | !-- the switch level to this largest number of possible values |
---|
| 902 | maximum_grid_level = maximum_grid_level_l |
---|
| 903 | |
---|
| 904 | ENDIF |
---|
[709] | 905 | |
---|
[1] | 906 | ENDIF |
---|
| 907 | |
---|
| 908 | ENDIF |
---|
| 909 | |
---|
| 910 | ALLOCATE( grid_level_count(maximum_grid_level), & |
---|
| 911 | nxl_mg(maximum_grid_level), nxr_mg(maximum_grid_level), & |
---|
| 912 | nyn_mg(maximum_grid_level), nys_mg(maximum_grid_level), & |
---|
| 913 | nzt_mg(maximum_grid_level) ) |
---|
| 914 | |
---|
| 915 | grid_level_count = 0 |
---|
| 916 | nxl_l = nxl; nxr_l = nxr; nys_l = nys; nyn_l = nyn; nzt_l = nzt |
---|
| 917 | |
---|
| 918 | DO i = maximum_grid_level, 1 , -1 |
---|
| 919 | |
---|
| 920 | IF ( i == mg_switch_to_pe0_level ) THEN |
---|
| 921 | #if defined( __parallel ) |
---|
| 922 | ! |
---|
| 923 | !-- Save the grid size of the subdomain at the switch level, because |
---|
| 924 | !-- it is needed in poismg. |
---|
| 925 | ind(1) = nxl_l; ind(2) = nxr_l |
---|
| 926 | ind(3) = nys_l; ind(4) = nyn_l |
---|
| 927 | ind(5) = nzt_l |
---|
| 928 | ALLOCATE( ind_all(5*numprocs), mg_loc_ind(5,0:numprocs-1) ) |
---|
| 929 | CALL MPI_ALLGATHER( ind, 5, MPI_INTEGER, ind_all, 5, & |
---|
| 930 | MPI_INTEGER, comm2d, ierr ) |
---|
| 931 | DO j = 0, numprocs-1 |
---|
| 932 | DO k = 1, 5 |
---|
| 933 | mg_loc_ind(k,j) = ind_all(k+j*5) |
---|
| 934 | ENDDO |
---|
| 935 | ENDDO |
---|
| 936 | DEALLOCATE( ind_all ) |
---|
| 937 | ! |
---|
[709] | 938 | !-- Calculate the grid size of the total domain |
---|
[1] | 939 | nxr_l = ( nxr_l-nxl_l+1 ) * pdims(1) - 1 |
---|
| 940 | nxl_l = 0 |
---|
| 941 | nyn_l = ( nyn_l-nys_l+1 ) * pdims(2) - 1 |
---|
| 942 | nys_l = 0 |
---|
| 943 | ! |
---|
| 944 | !-- The size of this gathered array must not be larger than the |
---|
| 945 | !-- array tend, which is used in the multigrid scheme as a temporary |
---|
| 946 | !-- array |
---|
| 947 | subdomain_size = ( nxr - nxl + 3 ) * ( nyn - nys + 3 ) * & |
---|
| 948 | ( nzt - nzb + 2 ) |
---|
| 949 | gathered_size = ( nxr_l - nxl_l + 3 ) * ( nyn_l - nys_l + 3 ) * & |
---|
| 950 | ( nzt_l - nzb + 2 ) |
---|
| 951 | |
---|
| 952 | IF ( gathered_size > subdomain_size ) THEN |
---|
[254] | 953 | message_string = 'not enough memory for storing ' // & |
---|
| 954 | 'gathered multigrid data on PE0' |
---|
| 955 | CALL message( 'init_pegrid', 'PA0236', 1, 2, 0, 6, 0 ) |
---|
[1] | 956 | ENDIF |
---|
| 957 | #else |
---|
[254] | 958 | message_string = 'multigrid gather/scatter impossible ' // & |
---|
[1] | 959 | 'in non parallel mode' |
---|
[254] | 960 | CALL message( 'init_pegrid', 'PA0237', 1, 2, 0, 6, 0 ) |
---|
[1] | 961 | #endif |
---|
| 962 | ENDIF |
---|
| 963 | |
---|
| 964 | nxl_mg(i) = nxl_l |
---|
| 965 | nxr_mg(i) = nxr_l |
---|
| 966 | nys_mg(i) = nys_l |
---|
| 967 | nyn_mg(i) = nyn_l |
---|
| 968 | nzt_mg(i) = nzt_l |
---|
| 969 | |
---|
| 970 | nxl_l = nxl_l / 2 |
---|
| 971 | nxr_l = nxr_l / 2 |
---|
| 972 | nys_l = nys_l / 2 |
---|
| 973 | nyn_l = nyn_l / 2 |
---|
| 974 | nzt_l = nzt_l / 2 |
---|
| 975 | ENDDO |
---|
| 976 | |
---|
| 977 | ELSE |
---|
| 978 | |
---|
[667] | 979 | maximum_grid_level = 0 |
---|
[1] | 980 | |
---|
| 981 | ENDIF |
---|
| 982 | |
---|
[724] | 983 | ! |
---|
| 984 | !-- Default level 0 tells exchange_horiz that all ghost planes have to be |
---|
| 985 | !-- exchanged. grid_level is adjusted in poismg, where only one ghost plane |
---|
| 986 | !-- is required. |
---|
| 987 | grid_level = 0 |
---|
[1] | 988 | |
---|
| 989 | #if defined( __parallel ) |
---|
| 990 | ! |
---|
| 991 | !-- Gridpoint number for the exchange of ghost points (y-line for 2D-arrays) |
---|
[667] | 992 | ngp_y = nyn - nys + 1 + 2 * nbgp |
---|
[1] | 993 | |
---|
| 994 | ! |
---|
[709] | 995 | !-- Define new MPI derived datatypes for the exchange of ghost points in |
---|
| 996 | !-- x- and y-direction for 2D-arrays (line) |
---|
| 997 | CALL MPI_TYPE_VECTOR( nxr-nxl+1+2*nbgp, nbgp, ngp_y, MPI_REAL, type_x, & |
---|
| 998 | ierr ) |
---|
[1] | 999 | CALL MPI_TYPE_COMMIT( type_x, ierr ) |
---|
[709] | 1000 | CALL MPI_TYPE_VECTOR( nxr-nxl+1+2*nbgp, nbgp, ngp_y, MPI_INTEGER, & |
---|
| 1001 | type_x_int, ierr ) |
---|
[1] | 1002 | CALL MPI_TYPE_COMMIT( type_x_int, ierr ) |
---|
| 1003 | |
---|
[667] | 1004 | CALL MPI_TYPE_VECTOR( nbgp, ngp_y, ngp_y, MPI_REAL, type_y, ierr ) |
---|
| 1005 | CALL MPI_TYPE_COMMIT( type_y, ierr ) |
---|
| 1006 | CALL MPI_TYPE_VECTOR( nbgp, ngp_y, ngp_y, MPI_INTEGER, type_y_int, ierr ) |
---|
| 1007 | CALL MPI_TYPE_COMMIT( type_y_int, ierr ) |
---|
| 1008 | |
---|
| 1009 | |
---|
[1] | 1010 | ! |
---|
| 1011 | !-- Calculate gridpoint numbers for the exchange of ghost points along x |
---|
| 1012 | !-- (yz-plane for 3D-arrays) and define MPI derived data type(s) for the |
---|
| 1013 | !-- exchange of ghost points in y-direction (xz-plane). |
---|
| 1014 | !-- Do these calculations for the model grid and (if necessary) also |
---|
| 1015 | !-- for the coarser grid levels used in the multigrid method |
---|
[667] | 1016 | ALLOCATE ( ngp_yz(0:maximum_grid_level), type_xz(0:maximum_grid_level),& |
---|
| 1017 | type_yz(0:maximum_grid_level) ) |
---|
[1] | 1018 | |
---|
| 1019 | nxl_l = nxl; nxr_l = nxr; nys_l = nys; nyn_l = nyn; nzb_l = nzb; nzt_l = nzt |
---|
[709] | 1020 | |
---|
[667] | 1021 | ! |
---|
| 1022 | !-- Discern between the model grid, which needs nbgp ghost points and |
---|
| 1023 | !-- grid levels for the multigrid scheme. In the latter case only one |
---|
| 1024 | !-- ghost point is necessary. |
---|
[709] | 1025 | !-- First definition of MPI-datatypes for exchange of ghost layers on normal |
---|
[667] | 1026 | !-- grid. The following loop is needed for data exchange in poismg.f90. |
---|
| 1027 | ! |
---|
| 1028 | !-- Determine number of grid points of yz-layer for exchange |
---|
| 1029 | ngp_yz(0) = (nzt - nzb + 2) * (nyn - nys + 1 + 2 * nbgp) |
---|
[709] | 1030 | |
---|
[667] | 1031 | ! |
---|
[709] | 1032 | !-- Define an MPI-datatype for the exchange of left/right boundaries. |
---|
| 1033 | !-- Although data are contiguous in physical memory (which does not |
---|
| 1034 | !-- necessarily require an MPI-derived datatype), the data exchange between |
---|
| 1035 | !-- left and right PE's using the MPI-derived type is 10% faster than without. |
---|
[667] | 1036 | CALL MPI_TYPE_VECTOR( nxr-nxl+1+2*nbgp, nbgp*(nzt-nzb+2), ngp_yz(0), & |
---|
[709] | 1037 | MPI_REAL, type_xz(0), ierr ) |
---|
[667] | 1038 | CALL MPI_TYPE_COMMIT( type_xz(0), ierr ) |
---|
[1] | 1039 | |
---|
[709] | 1040 | CALL MPI_TYPE_VECTOR( nbgp, ngp_yz(0), ngp_yz(0), MPI_REAL, type_yz(0), & |
---|
| 1041 | ierr ) |
---|
[667] | 1042 | CALL MPI_TYPE_COMMIT( type_yz(0), ierr ) |
---|
[709] | 1043 | |
---|
[667] | 1044 | ! |
---|
[709] | 1045 | !-- Definition of MPI-datatypes for multigrid method (coarser level grids) |
---|
[667] | 1046 | IF ( psolver == 'multigrid' ) THEN |
---|
| 1047 | ! |
---|
[709] | 1048 | !-- Definition of MPI-datatyoe as above, but only 1 ghost level is used |
---|
| 1049 | DO i = maximum_grid_level, 1 , -1 |
---|
| 1050 | |
---|
[667] | 1051 | ngp_yz(i) = (nzt_l - nzb_l + 2) * (nyn_l - nys_l + 3) |
---|
| 1052 | |
---|
| 1053 | CALL MPI_TYPE_VECTOR( nxr_l-nxl_l+3, nzt_l-nzb_l+2, ngp_yz(i), & |
---|
[709] | 1054 | MPI_REAL, type_xz(i), ierr ) |
---|
[667] | 1055 | CALL MPI_TYPE_COMMIT( type_xz(i), ierr ) |
---|
[1] | 1056 | |
---|
[709] | 1057 | CALL MPI_TYPE_VECTOR( 1, ngp_yz(i), ngp_yz(i), MPI_REAL, type_yz(i), & |
---|
| 1058 | ierr ) |
---|
[667] | 1059 | CALL MPI_TYPE_COMMIT( type_yz(i), ierr ) |
---|
| 1060 | |
---|
| 1061 | nxl_l = nxl_l / 2 |
---|
| 1062 | nxr_l = nxr_l / 2 |
---|
| 1063 | nys_l = nys_l / 2 |
---|
| 1064 | nyn_l = nyn_l / 2 |
---|
| 1065 | nzt_l = nzt_l / 2 |
---|
[709] | 1066 | |
---|
[667] | 1067 | ENDDO |
---|
[709] | 1068 | |
---|
| 1069 | ENDIF |
---|
[1] | 1070 | #endif |
---|
| 1071 | |
---|
| 1072 | #if defined( __parallel ) |
---|
| 1073 | ! |
---|
| 1074 | !-- Setting of flags for inflow/outflow conditions in case of non-cyclic |
---|
[106] | 1075 | !-- horizontal boundary conditions. |
---|
[1] | 1076 | IF ( pleft == MPI_PROC_NULL ) THEN |
---|
[724] | 1077 | IF ( bc_lr == 'dirichlet/radiation' ) THEN |
---|
[1] | 1078 | inflow_l = .TRUE. |
---|
[724] | 1079 | ELSEIF ( bc_lr == 'radiation/dirichlet' ) THEN |
---|
[1] | 1080 | outflow_l = .TRUE. |
---|
| 1081 | ENDIF |
---|
| 1082 | ENDIF |
---|
| 1083 | |
---|
| 1084 | IF ( pright == MPI_PROC_NULL ) THEN |
---|
[724] | 1085 | IF ( bc_lr == 'dirichlet/radiation' ) THEN |
---|
[1] | 1086 | outflow_r = .TRUE. |
---|
[724] | 1087 | ELSEIF ( bc_lr == 'radiation/dirichlet' ) THEN |
---|
[1] | 1088 | inflow_r = .TRUE. |
---|
| 1089 | ENDIF |
---|
| 1090 | ENDIF |
---|
| 1091 | |
---|
| 1092 | IF ( psouth == MPI_PROC_NULL ) THEN |
---|
[724] | 1093 | IF ( bc_ns == 'dirichlet/radiation' ) THEN |
---|
[1] | 1094 | outflow_s = .TRUE. |
---|
[724] | 1095 | ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN |
---|
[1] | 1096 | inflow_s = .TRUE. |
---|
| 1097 | ENDIF |
---|
| 1098 | ENDIF |
---|
| 1099 | |
---|
| 1100 | IF ( pnorth == MPI_PROC_NULL ) THEN |
---|
[724] | 1101 | IF ( bc_ns == 'dirichlet/radiation' ) THEN |
---|
[1] | 1102 | inflow_n = .TRUE. |
---|
[724] | 1103 | ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN |
---|
[1] | 1104 | outflow_n = .TRUE. |
---|
| 1105 | ENDIF |
---|
| 1106 | ENDIF |
---|
| 1107 | |
---|
[151] | 1108 | ! |
---|
| 1109 | !-- Broadcast the id of the inflow PE |
---|
| 1110 | IF ( inflow_l ) THEN |
---|
[163] | 1111 | id_inflow_l = myidx |
---|
[151] | 1112 | ELSE |
---|
| 1113 | id_inflow_l = 0 |
---|
| 1114 | ENDIF |
---|
[622] | 1115 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[151] | 1116 | CALL MPI_ALLREDUCE( id_inflow_l, id_inflow, 1, MPI_INTEGER, MPI_SUM, & |
---|
| 1117 | comm1dx, ierr ) |
---|
| 1118 | |
---|
[163] | 1119 | ! |
---|
| 1120 | !-- Broadcast the id of the recycling plane |
---|
| 1121 | !-- WARNING: needs to be adjusted in case of inflows other than from left side! |
---|
[622] | 1122 | IF ( ( recycling_width / dx ) >= nxl .AND. & |
---|
| 1123 | ( recycling_width / dx ) <= nxr ) THEN |
---|
[163] | 1124 | id_recycling_l = myidx |
---|
| 1125 | ELSE |
---|
| 1126 | id_recycling_l = 0 |
---|
| 1127 | ENDIF |
---|
[622] | 1128 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[163] | 1129 | CALL MPI_ALLREDUCE( id_recycling_l, id_recycling, 1, MPI_INTEGER, MPI_SUM, & |
---|
| 1130 | comm1dx, ierr ) |
---|
| 1131 | |
---|
[1] | 1132 | #else |
---|
[724] | 1133 | IF ( bc_lr == 'dirichlet/radiation' ) THEN |
---|
[1] | 1134 | inflow_l = .TRUE. |
---|
| 1135 | outflow_r = .TRUE. |
---|
[724] | 1136 | ELSEIF ( bc_lr == 'radiation/dirichlet' ) THEN |
---|
[1] | 1137 | outflow_l = .TRUE. |
---|
| 1138 | inflow_r = .TRUE. |
---|
| 1139 | ENDIF |
---|
| 1140 | |
---|
[724] | 1141 | IF ( bc_ns == 'dirichlet/radiation' ) THEN |
---|
[1] | 1142 | inflow_n = .TRUE. |
---|
| 1143 | outflow_s = .TRUE. |
---|
[724] | 1144 | ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN |
---|
[1] | 1145 | outflow_n = .TRUE. |
---|
| 1146 | inflow_s = .TRUE. |
---|
| 1147 | ENDIF |
---|
| 1148 | #endif |
---|
[106] | 1149 | ! |
---|
[110] | 1150 | !-- At the outflow, u or v, respectively, have to be calculated for one more |
---|
| 1151 | !-- grid point. |
---|
[106] | 1152 | IF ( outflow_l ) THEN |
---|
| 1153 | nxlu = nxl + 1 |
---|
| 1154 | ELSE |
---|
| 1155 | nxlu = nxl |
---|
| 1156 | ENDIF |
---|
| 1157 | IF ( outflow_s ) THEN |
---|
| 1158 | nysv = nys + 1 |
---|
| 1159 | ELSE |
---|
| 1160 | nysv = nys |
---|
| 1161 | ENDIF |
---|
[1] | 1162 | |
---|
| 1163 | IF ( psolver == 'poisfft_hybrid' ) THEN |
---|
| 1164 | CALL poisfft_hybrid_ini |
---|
[75] | 1165 | ELSEIF ( psolver == 'poisfft' ) THEN |
---|
[1] | 1166 | CALL poisfft_init |
---|
| 1167 | ENDIF |
---|
| 1168 | |
---|
[114] | 1169 | ! |
---|
| 1170 | !-- Allocate wall flag arrays used in the multigrid solver |
---|
| 1171 | IF ( psolver == 'multigrid' ) THEN |
---|
| 1172 | |
---|
| 1173 | DO i = maximum_grid_level, 1, -1 |
---|
| 1174 | |
---|
| 1175 | SELECT CASE ( i ) |
---|
| 1176 | |
---|
| 1177 | CASE ( 1 ) |
---|
| 1178 | ALLOCATE( wall_flags_1(nzb:nzt_mg(i)+1, & |
---|
| 1179 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1180 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1181 | |
---|
| 1182 | CASE ( 2 ) |
---|
| 1183 | ALLOCATE( wall_flags_2(nzb:nzt_mg(i)+1, & |
---|
| 1184 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1185 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1186 | |
---|
| 1187 | CASE ( 3 ) |
---|
| 1188 | ALLOCATE( wall_flags_3(nzb:nzt_mg(i)+1, & |
---|
| 1189 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1190 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1191 | |
---|
| 1192 | CASE ( 4 ) |
---|
| 1193 | ALLOCATE( wall_flags_4(nzb:nzt_mg(i)+1, & |
---|
| 1194 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1195 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1196 | |
---|
| 1197 | CASE ( 5 ) |
---|
| 1198 | ALLOCATE( wall_flags_5(nzb:nzt_mg(i)+1, & |
---|
| 1199 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1200 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1201 | |
---|
| 1202 | CASE ( 6 ) |
---|
| 1203 | ALLOCATE( wall_flags_6(nzb:nzt_mg(i)+1, & |
---|
| 1204 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1205 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1206 | |
---|
| 1207 | CASE ( 7 ) |
---|
| 1208 | ALLOCATE( wall_flags_7(nzb:nzt_mg(i)+1, & |
---|
| 1209 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1210 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1211 | |
---|
| 1212 | CASE ( 8 ) |
---|
| 1213 | ALLOCATE( wall_flags_8(nzb:nzt_mg(i)+1, & |
---|
| 1214 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1215 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1216 | |
---|
| 1217 | CASE ( 9 ) |
---|
| 1218 | ALLOCATE( wall_flags_9(nzb:nzt_mg(i)+1, & |
---|
| 1219 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1220 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1221 | |
---|
| 1222 | CASE ( 10 ) |
---|
| 1223 | ALLOCATE( wall_flags_10(nzb:nzt_mg(i)+1, & |
---|
| 1224 | nys_mg(i)-1:nyn_mg(i)+1, & |
---|
| 1225 | nxl_mg(i)-1:nxr_mg(i)+1) ) |
---|
| 1226 | |
---|
| 1227 | CASE DEFAULT |
---|
[254] | 1228 | message_string = 'more than 10 multigrid levels' |
---|
| 1229 | CALL message( 'init_pegrid', 'PA0238', 1, 2, 0, 6, 0 ) |
---|
[114] | 1230 | |
---|
| 1231 | END SELECT |
---|
| 1232 | |
---|
| 1233 | ENDDO |
---|
| 1234 | |
---|
| 1235 | ENDIF |
---|
| 1236 | |
---|
[1] | 1237 | END SUBROUTINE init_pegrid |
---|