subroutine init2decomp use decomp_2d use modglobal, only : itot, jtot, ktot, BCxm, BCym, BCxm_periodic, Bcym_periodic use modmpi, only : comm3d, myid, myidx, myidy, cmyidx, cmyidy, nprocx, nprocy, & nbreast, nbrwest, nbrnorth, nbrsouth, mpierr implicit none logical, dimension(3) :: periodic_bc integer, dimension(2) :: myids if (BCxm .eq. BCxm_periodic .and. nprocx > 1) then periodic_bc(1) = .true. else periodic_bc(1) = .false. end if if (BCym .eq. BCym_periodic .and. nprocy > 1) then periodic_bc(2) = .true. else periodic_bc(2) = .false. end if periodic_bc(3) = .false. call decomp_2d_init(itot,jtot,ktot,nprocx,nprocy,periodic_bc) comm3d = DECOMP_2D_COMM_CART_Z call MPI_CART_COORDS(comm3d,myid,2,myids,mpierr) myidx = myids(1) myidy = myids(2) write(cmyidx,'(i3.3)') myidx write(cmyidy,'(i3.3)') myidy call MPI_CART_SHIFT(comm3d, 0, 1, nbrwest, nbreast , mpierr) call MPI_CART_SHIFT(comm3d, 1, 1, nbrsouth, nbrnorth, mpierr) end subroutine init2decomp