#include "include/finclude/petscdef.h" c********************************************************************* subroutine findneighbours use sharedvars implicit none integer :: ierr integer :: i xsdomains(rank+1)=xs call MPI_ALLGATHER(xs,1,MPI_INTEGER, & xsdomains ,1,MPI_INTEGER, & MPI_COMM_WORLD,ierr) CHKERRQ(ierr) call MPI_ALLGATHER(xe,1,MPI_INTEGER, & xedomains ,1,MPI_INTEGER, & MPI_COMM_WORLD,ierr) CHKERRQ(ierr) call MPI_ALLGATHER(ys,1,MPI_INTEGER, & ysdomains ,1,MPI_INTEGER, & MPI_COMM_WORLD,ierr) CHKERRQ(ierr) call MPI_ALLGATHER(ye,1,MPI_INTEGER, & yedomains ,1,MPI_INTEGER, & MPI_COMM_WORLD,ierr) CHKERRQ(ierr) call MPI_ALLGATHER(zs,1,MPI_INTEGER, & zsdomains ,1,MPI_INTEGER, & MPI_COMM_WORLD,ierr) CHKERRQ(ierr) call MPI_ALLGATHER(ze,1,MPI_INTEGER, & zedomains ,1,MPI_INTEGER, & MPI_COMM_WORLD,ierr) CHKERRQ(ierr) write(logfile,*)'xs',xsdomains write(logfile,*)'xe',xedomains write(logfile,*)'ys',ysdomains write(logfile,*)'ye',yedomains write(logfile,*)'zs',zsdomains write(logfile,*)'ze',zedomains xleftdomainrank=-10 yleftdomainrank=-10 zleftdomainrank=-10 xrightdomainrank=-10 yrightdomainrank=-10 zrightdomainrank=-10 do i=1,domainsize if(xs==1)then xleftdomainrank=-10 endif if(ys==1)then yleftdomainrank=-10 endif if(zs==1)then zleftdomainrank=-10 endif if(xe==nx)then xrightdomainrank=-10 endif if(ye==ny)then yrightdomainrank=-10 endif if(ze==nz)then zrightdomainrank=-10 endif enddo do i=1,domainsize if((xs-1)==xedomains(i) .and. & ys==ysdomains(i) .and. ye==yedomains(i) .and. & zs==zsdomains(i) .and. ze==zedomains(i) & )then xleftdomainrank=i-1 endif if((ys-1)==yedomains(i) .and. & xs==xsdomains(i) .and. xe==xedomains(i) .and. & zs==zsdomains(i) .and. ze==zedomains(i) & )then yleftdomainrank=i-1 endif if((zs-1)==zedomains(i) .and. & xs==xsdomains(i) .and. xe==xedomains(i) .and. & ys==ysdomains(i) .and. ye==yedomains(i) & )then zleftdomainrank=i-1 endif enddo do i=1,domainsize if((xe+1)==xsdomains(i) .and. & ys==ysdomains(i) .and. ye==yedomains(i) .and. & zs==zsdomains(i) .and. ze==zedomains(i) & )then xrightdomainrank=i-1 endif if((ye+1)==ysdomains(i) .and. & xs==xsdomains(i) .and. xe==xedomains(i) .and. & zs==zsdomains(i) .and. ze==zedomains(i) & )then yrightdomainrank=i-1 endif if((ze+1)==zsdomains(i) .and. & xs==xsdomains(i) .and. xe==xedomains(i) .and. & ys==ysdomains(i) .and. ye==yedomains(i) & )then zrightdomainrank=i-1 endif enddo return end c*********************************************************************