Gathers locally-updated cell values and broadcasts to the global mesh.
This routine uses MPI_Allgatherv to synchronize the "owned"
partition results across all ranks.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(flow_mpi_t), | intent(inout) | :: | flow | |||
| real(kind=rk), | intent(in) | :: | local_global(:) | |||
| real(kind=rk), | intent(out) | :: | global(:) |
subroutine flow_allgather_owned_scalar(flow, local_global, global) use mod_profiler, only : profiler_start, profiler_stop type(flow_mpi_t), intent(inout) :: flow real(rk), intent(in) :: local_global(:) real(rk), intent(out) :: global(:) integer :: ierr, r, first if (.not. allocated(flow%gather_sendbuf)) then call fatal_error('mpi_flow', 'owned gather buffers are not initialized') end if flow%gather_sendbuf = local_global(flow%first_cell:flow%last_cell) call profiler_start('MPI_Communication') call MPI_Allgatherv(flow%gather_sendbuf, flow%nlocal, MPI_DOUBLE_PRECISION, & flow%gather_recvbuf, flow%gather_counts, flow%gather_displs, & MPI_DOUBLE_PRECISION, flow%comm, ierr) call check_mpi(ierr, 'MPI_Allgatherv owned scalar') call profiler_stop('MPI_Communication') global = zero do r = 1, flow%nprocs first = flow%gather_firsts(r) global(first:first + flow%gather_counts(r) - 1) = & flow%gather_recvbuf(flow%gather_displs(r) + 1: & flow%gather_displs(r) + flow%gather_counts(r)) end do end subroutine flow_allgather_owned_scalar