Broadcast schedule another time after filtering connection on rank 0

Only after rank zero does the filtering the schedule the well
definitions in there are guarateed to have no perforations to inactive
cells. Therefore we broadcast the schedule another time to publish
this to all processes.

Previously, we did the filtering locally on these processes bit that
did also remove perforations to cells that are active globally but
not locally. That seems very hard to work with when allowing
distributed wells.
This commit is contained in:
Markus Blatt 2020-11-23 20:15:15 +01:00
parent d8eaef3271
commit 19bebcefe2
3 changed files with 24 additions and 0 deletions

View File

@ -35,6 +35,7 @@
#include <opm/grid/cpgrid/GridHelpers.hpp>
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/simulators/utils/PropsCentroidsDataHandle.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
#include <dune/grid/common/mcmgmapper.hh>
@ -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> grid_;

View File

@ -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);
}
}

View File

@ -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