| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in) | :: | local_value | |||
| real(kind=rk), | intent(out) | :: | global_value | |||
| type(flow_mpi_t), | intent(in) | :: | flow |
subroutine reduce_sum(local_value, global_value, flow) real(rk), intent(in) :: local_value real(rk), intent(out) :: global_value type(flow_mpi_t), intent(in) :: flow integer :: ierr real(rk) :: send_val, recv_val send_val = local_value call MPI_Allreduce(send_val, recv_val, 1, MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr) if (ierr /= MPI_SUCCESS) call fatal_error('output', 'MPI failure in reduce_sum') global_value = recv_val end subroutine reduce_sum