Exchanges owned cell scalar values to ranks that keep them as ghosts.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(flow_mpi_t), | intent(inout) | :: | flow | |||
| real(kind=rk), | intent(inout) | :: | field(:) |
subroutine flow_exchange_cell_scalar(flow, field) use mod_profiling, only : profiler_start, profiler_stop type(flow_mpi_t), intent(inout) :: flow real(rk), intent(inout) :: field(:) integer, parameter :: cell_halo_tag = 9281 integer :: i, j, nreq, ierr, offset, count if (.not. allocated(flow%cell_sendbuf)) return if (flow%ncell_recv_ranks + flow%ncell_send_ranks == 0) return do i = 1, flow%ncell_send_ranks offset = flow%cell_send_displs(i) count = flow%cell_send_counts(i) do j = 1, count flow%cell_sendbuf(offset + j) = field(flow%cell_send_cells(offset + j)) end do end do call profiler_start('MPI_Communication') nreq = 0 do i = 1, flow%ncell_recv_ranks offset = flow%cell_recv_displs(i) count = flow%cell_recv_counts(i) nreq = nreq + 1 call MPI_Irecv(flow%cell_recvbuf(offset + 1), count, MPI_DOUBLE_PRECISION, & flow%cell_recv_ranks(i), cell_halo_tag, flow%comm, flow%cell_requests(nreq), ierr) call check_mpi(ierr, 'cell scalar halo irecv') end do do i = 1, flow%ncell_send_ranks offset = flow%cell_send_displs(i) count = flow%cell_send_counts(i) nreq = nreq + 1 call MPI_Isend(flow%cell_sendbuf(offset + 1), count, MPI_DOUBLE_PRECISION, & flow%cell_send_ranks(i), cell_halo_tag, flow%comm, flow%cell_requests(nreq), ierr) call check_mpi(ierr, 'cell scalar halo isend') end do call MPI_Waitall(nreq, flow%cell_requests(1:nreq), MPI_STATUSES_IGNORE, ierr) call check_mpi(ierr, 'cell scalar halo waitall') call profiler_stop('MPI_Communication') do i = 1, size(flow%cell_recv_cells) field(flow%cell_recv_cells(i)) = flow%cell_recvbuf(i) end do end subroutine flow_exchange_cell_scalar