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