Research Article

MPI to Coarray Fortran: Experiences with a CFD Solver for Unstructured Meshes

Listing 7

exhboundhigher subroutine from the MPI version of the code. Note that only the code responsible for communication is shown.
subroutine exhboundhigher( n, iexchanger, iexchanges,
iexboundhir, iexboundhis, itestcase, numberofpoints2,
isize )
...
if (itestcase  .eq. 4) then
  do i=0, isize-1
   if (i  .ne. n) then
    do k=1, indl
     if (iexboundhir(k)%procid  .eq. i) then
      do j=1, tndl
       if (iexboundhir(k)procid  .eq. iexboundhis(j)
         %procid) then
        call mpi_sendrecv( iexboundhis(j)%facesol
          (1:iexchanges(j)%muchtheyneed(1), 1:1,
          1:numberofpoints2, 1:5), &
         iexchanges(j)%muchtheyneed(1)*1*
           numberofpoints2*5,
           mpi_double_precision, iexboundhis(j)%
           procid, n, &
         iexboundhir(k)%facesol(1:iexchanger(k)%
           muchineed(1), 1:1, 1:numberofpoints2,
           1:5), &
         iexchanger(k)%muchineed(1)*1*
           numberofpoints2*5,
           mpi_double_precision, iexboundhir(k)%
           procid, &
         iexboundhir(k)%procid, icommunicator,
           status, ierror )
        call mpi_sendrecv( iexboundhis(j)%facesolv
          (1:iexchanges(j)%muchtheyneed(1), 1:1,
          1:numberofpoints2, 1:8), &
         iexchanges(j)%muchtheyneed(1)*1*
           numberofpoints2*8,
           mpi_double_precision, iexboundhis(j)%
           procid, n, &
         iexboundhir(k)%facesolv(1:iexchanger(k)%
           muchineed(1), 1:1, 1:numberofpoints2,
           1:8), &
         iexchanger(k)%muchineed(1)*1*
           numberofpoints2*8,
           mpi_double_precision, iexboundhir(k)%
           procid, &
         iexboundhir(k)%procid, icommunicator,
           status, ierror )
       end if
      end do
     end if
    end do
   end if
  end do
end if
...
end subroutine exhboundhigher