diff --git a/ebos/eclcpgridvanguard.hh b/ebos/eclcpgridvanguard.hh index 01c579ff7..e635570a2 100644 --- a/ebos/eclcpgridvanguard.hh +++ b/ebos/eclcpgridvanguard.hh @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -346,6 +347,21 @@ protected: equilGrid().size(0)); this->schedule().filterConnections(activeCells); } +#if HAVE_MPI + try + { + // Broadcast another time to remove inactive peforations on + // slave processors. + Opm::eclScheduleBroadcast(this->schedule()); + } + catch(const std::exception& broadcast_error) + { + OpmLog::error(fmt::format("Distributing properties to all processes failed\n" + "Internal error message: {}", broadcast_error.what())); + MPI_Finalize(); + std::exit(EXIT_FAILURE); + } +#endif } std::unique_ptr grid_; diff --git a/opm/simulators/utils/ParallelSerialization.cpp b/opm/simulators/utils/ParallelSerialization.cpp index 1d40acc9b..2a84f506d 100644 --- a/opm/simulators/utils/ParallelSerialization.cpp +++ b/opm/simulators/utils/ParallelSerialization.cpp @@ -49,4 +49,9 @@ void eclStateBroadcast(EclipseState& eclState, Schedule& schedule, ser.broadcast(summaryConfig); } +void eclScheduleBroadcast(Schedule& schedule) +{ + Opm::EclMpiSerializer ser(Dune::MPIHelper::getCollectiveCommunication()); + ser.broadcast(schedule); +} } diff --git a/opm/simulators/utils/ParallelSerialization.hpp b/opm/simulators/utils/ParallelSerialization.hpp index fc78222b9..e60b4ff8f 100644 --- a/opm/simulators/utils/ParallelSerialization.hpp +++ b/opm/simulators/utils/ParallelSerialization.hpp @@ -33,6 +33,9 @@ class SummaryConfig; void eclStateBroadcast(EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); +/// \brief Broadcasts an schedule from root node in parallel runs. +void eclScheduleBroadcast(Schedule& schedule); + } // end namespace Opm #endif // PARALLEL_SERIALIZATION_HPP