Updates the ghostcells in the z direction with non-blocking mpi directives.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(eulerian_obj_base), | intent(inout) | :: | this |
An Eulerian object |
impure subroutine eulerian_obj_UpdateGhostCells_z(this) !> Updates the ghostcells in the z direction ! with non-blocking mpi directives. implicit none class(eulerian_obj_base), intent(inout) :: this !! An Eulerian object ! Work variables integer :: Ng(3) integer :: recvL(3),recvR(3) integer :: sendL(3),sendR(3) integer :: i type(MPI_STATUS) :: statuses(4) type(MPI_REQUEST) :: requests(4) integer :: ierr associate (lo => this%block%lo, hi => this%block%hi, & ngc=> this%block%ngc, mpi => this%parallel, & gc_slab_r => this%block%gc_slab_r, & gc_slab_i => this%block%gc_slab_i) ! Number of grid points (including ghostcells) Ng=hi-lo+1+2*ngc ! 2D/1D and pseudo-2D/1D exceptions: ! more ghost cells than internal cells if (Ng(3)-2*ngc.le.ngc) then select type (this) type is (eulerian_obj_r) do i=1,ngc this%cell(:,:,hi(3)+i) = this%cell(:,:,lo(3)+i-1) this%cell(:,:,lo(3)-i) = this%cell(:,:,hi(3)-i+1) end do type is (eulerian_obj_i) do i=1,ngc this%cell(:,:,hi(3)+i) = this%cell(:,:,lo(3)+i-1) this%cell(:,:,lo(3)-i) = this%cell(:,:,hi(3)-i+1) end do end select return end if ! Address of first element in buffer recvL(1)=lo(1)-ngc ; recvL(2)=lo(2)-ngc ; recvL(3)=lo(3)-ngc recvR(1)=lo(1)-ngc ; recvR(2)=lo(2)-ngc ; recvR(3)=hi(3)+1 sendL(1)=lo(1)-ngc ; sendL(2)=lo(2)-ngc ; sendL(3)=lo(3) sendR(1)=lo(1)-ngc ; sendR(2)=lo(2)-ngc ; sendR(3)=hi(3)-ngc+1 select type (this) type is (eulerian_obj_r) ! Post receives from Left and right ranks call MPI_IRECV( this%cell(recvL(1),recvL(2),recvL(3)), 1, gc_slab_r(3), & mpi%rank%L(3)-1, 0, mpi%comm%g, requests(1), ierr) call MPI_IRECV( this%cell(recvR(1),recvR(2),recvR(3)), 1, gc_slab_r(3), & mpi%rank%R(3)-1, 0, mpi%comm%g, requests(2), ierr) ! Send buffers to left and right ranks call MPI_ISEND( this%cell(sendR(1),sendR(2),sendR(3)), 1, gc_slab_r(3), & mpi%rank%R(3)-1, 0, mpi%comm%g, requests(4), ierr) call MPI_ISEND( this%cell(sendL(1),sendL(2),sendL(3)), 1, gc_slab_r(3), & mpi%rank%L(3)-1, 0, mpi%comm%g, requests(3), ierr) type is (eulerian_obj_i) ! Post receives from Left and right ranks call MPI_IRECV( this%cell(recvL(1),recvL(2),recvL(3)), 1, gc_slab_i(3), & mpi%rank%L(3)-1, 0, mpi%comm%g, requests(1), ierr) call MPI_IRECV( this%cell(recvR(1),recvR(2),recvR(3)), 1, gc_slab_i(3), & mpi%rank%R(3)-1, 0, mpi%comm%g, requests(2), ierr) ! Send buffers to left and right ranks call MPI_ISEND( this%cell(sendR(1),sendR(2),sendR(3)), 1, gc_slab_i(3), & mpi%rank%R(3)-1, 0, mpi%comm%g, requests(4), ierr) call MPI_ISEND( this%cell(sendL(1),sendL(2),sendL(3)), 1, gc_slab_i(3), & mpi%rank%L(3)-1, 0, mpi%comm%g, requests(3), ierr) end select ! Synchronize call MPI_WAITALL( 4, requests, statuses, ierr ) end associate return end subroutine eulerian_obj_UpdateGhostCells_z