Ignore:
Timestamp:
Mar 12, 2020 4:51:59 PM (4 years ago)
Author:
raasch
Message:

extensions to allow usage of alternative communicators in exchange_horiz

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/init_pegrid.f90

    r4444 r4461  
    2525! -----------------
    2626! $Id$
     27! communicator configurations for four virtual pe grids defined
     28!
     29! 4444 2020-03-05 15:59:50Z raasch
    2730! bugfix: cpp-directives for serial mode added
    2831!
     
    242245
    243246!
     247!-- Create four default MPI communicators for the 2d virtual PE grid. One of them will be used
     248!-- as the main communicator for this run, while others might be used for specific quantities like
     249!-- aerosol, chemical species, or passive scalars), if their horizontal boundary conditions shall
     250!-- be different from those of the other quantities (e.g. non-cyclic conditions for aerosols, and
     251!-- cyclic conditions for all others).
     252    DO  i = 1, 4
     253
     254       IF ( i == 1 )  cyclic = (/  .TRUE., .TRUE.  /)   ! cyclic along x and y
     255       IF ( i == 2 )  cyclic = (/  .TRUE., .FALSE. /)   ! cyclic along x
     256       IF ( i == 3 )  cyclic = (/ .FALSE., .TRUE.  /)   ! cyllic along y
     257       IF ( i == 4 )  cyclic = (/ .FALSE., .FALSE. /)   ! non-cyclic
     258
     259       CALL MPI_CART_CREATE( comm_palm, ndim, pdims, cyclic, reorder,                              &
     260                             communicator_configurations(i)%mpi_communicator, ierr )
     261
     262       CALL MPI_CART_SHIFT( communicator_configurations(i)%mpi_communicator, 0, 1,                 &
     263                            communicator_configurations(i)%pleft,                                  &
     264                            communicator_configurations(i)%pright, ierr )
     265
     266       CALL MPI_CART_SHIFT( communicator_configurations(i)%mpi_communicator, 1, 1,                 &
     267                            communicator_configurations(i)%psouth,                                 &
     268                            communicator_configurations(i)%pnorth, ierr )
     269
     270    ENDDO
     271
     272!
    244273!-- If necessary, set horizontal boundary conditions to non-cyclic
    245274    IF ( bc_lr /= 'cyclic' )  cyclic(1) = .FALSE.
     
    248277
    249278!
    250 !-- Create the virtual processor grid
    251     CALL MPI_CART_CREATE( comm_palm, ndim, pdims, cyclic, reorder, &
    252                           comm2d, ierr )
     279!-- Set the main communicator (virtual pe grid) for this run
     280    IF ( bc_lr == 'cyclic'  .AND.  bc_ns == 'cyclic' )  i = 1
     281    IF ( bc_lr == 'cyclic'  .AND.  bc_ns /= 'cyclic' )  i = 2
     282    IF ( bc_lr /= 'cyclic'  .AND.  bc_ns == 'cyclic' )  i = 3
     283    IF ( bc_lr /= 'cyclic'  .AND.  bc_ns /= 'cyclic' )  i = 4
     284
     285    comm2d = communicator_configurations(i)%mpi_communicator
     286    pleft  = communicator_configurations(i)%pleft
     287    pright = communicator_configurations(i)%pright
     288    psouth = communicator_configurations(i)%psouth
     289    pnorth = communicator_configurations(i)%pnorth
     290
     291!
     292!-- Set rank and coordinates of the main communicator
    253293    CALL MPI_COMM_RANK( comm2d, myid, ierr )
    254294    WRITE (myid_char,'(''_'',I6.6)')  myid
    255295
    256296    CALL MPI_CART_COORDS( comm2d, myid, ndim, pcoord, ierr )
    257     CALL MPI_CART_SHIFT( comm2d, 0, 1, pleft, pright, ierr )
    258     CALL MPI_CART_SHIFT( comm2d, 1, 1, psouth, pnorth, ierr )
     297
    259298!
    260299!-- In case of cyclic boundary conditions, a y-shift at the boundaries in
     
    316355       ENDIF
    317356    ENDIF
     357
    318358!
    319359!-- Vertical nesting: store four lists that identify partner ranks to exchange
Note: See TracChangeset for help on using the changeset viewer.