mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use the ParallelEclipseState and ParallelFieldPropsManager
with these in place, we now only parse the deck on the root process.
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <opm/grid/CpGrid.hpp>
|
#include <opm/grid/CpGrid.hpp>
|
||||||
#include <opm/grid/cpgrid/GridHelpers.hpp>
|
#include <opm/grid/cpgrid/GridHelpers.hpp>
|
||||||
|
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
||||||
|
|
||||||
#include <dune/grid/common/mcmgmapper.hh>
|
#include <dune/grid/common/mcmgmapper.hh>
|
||||||
|
|
||||||
@@ -206,8 +207,18 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
cartesianIndexMapper_.reset(new CartesianIndexMapper(*grid_));
|
cartesianIndexMapper_.reset(new CartesianIndexMapper(*grid_));
|
||||||
|
|
||||||
this->updateGridView_();
|
this->updateGridView_();
|
||||||
|
if (mpiSize > 1) {
|
||||||
|
std::vector<int> cartIndices;
|
||||||
|
cartIndices.reserve(grid_->numCells());
|
||||||
|
auto locElemIt = this->gridView().template begin</*codim=*/0>();
|
||||||
|
const auto& locElemEndIt = this->gridView().template end</*codim=*/0>();
|
||||||
|
for (; locElemIt != locElemEndIt; ++locElemIt) {
|
||||||
|
cartIndices.push_back(cartesianIndexMapper_->cartesianIndex(locElemIt->index()));
|
||||||
|
}
|
||||||
|
static_cast<ParallelEclipseState&>(this->eclState()).setupLocalProps(cartIndices);
|
||||||
|
static_cast<ParallelEclipseState&>(this->eclState()).switchToDistributedProps();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <ebos/eclmpiserializer.hh>
|
||||||
|
|
||||||
#include <flow/flow_ebos_blackoil.hpp>
|
#include <flow/flow_ebos_blackoil.hpp>
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
|
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
|
||||||
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
||||||
#include <opm/simulators/utils/moduleVersion.hpp>
|
#include <opm/simulators/utils/moduleVersion.hpp>
|
||||||
|
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
||||||
#include <opm/models/utils/propertysystem.hh>
|
#include <opm/models/utils/propertysystem.hh>
|
||||||
#include <opm/models/utils/parametersystem.hh>
|
#include <opm/models/utils/parametersystem.hh>
|
||||||
#include <opm/simulators/flow/MissingFeatures.hpp>
|
#include <opm/simulators/flow/MissingFeatures.hpp>
|
||||||
@@ -348,13 +350,21 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
Opm::FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout);
|
Opm::FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout);
|
||||||
|
|
||||||
deck.reset( new Opm::Deck( parser.parseFile(deckFilename , parseContext, errorGuard)));
|
#ifdef HAVE_MPI
|
||||||
Opm::MissingFeatures::checkKeywords(*deck, parseContext, errorGuard);
|
Opm::ParallelEclipseState* parState;
|
||||||
if ( outputCout )
|
#endif
|
||||||
Opm::checkDeck(*deck, parser, parseContext, errorGuard);
|
|
||||||
|
|
||||||
eclipseState.reset( new Opm::EclipseState(*deck));
|
|
||||||
if (mpiRank == 0) {
|
if (mpiRank == 0) {
|
||||||
|
deck.reset( new Opm::Deck( parser.parseFile(deckFilename , parseContext, errorGuard)));
|
||||||
|
Opm::MissingFeatures::checkKeywords(*deck, parseContext, errorGuard);
|
||||||
|
if ( outputCout )
|
||||||
|
Opm::checkDeck(*deck, parser, parseContext, errorGuard);
|
||||||
|
|
||||||
|
#ifdef HAVE_MPI
|
||||||
|
parState = new Opm::ParallelEclipseState(*deck);
|
||||||
|
eclipseState.reset(parState);
|
||||||
|
#else
|
||||||
|
eclipseState.reset(new Opm::EclipseState(*deck);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
For the time being initializing wells and groups from the
|
For the time being initializing wells and groups from the
|
||||||
restart file is not possible, but work is underways and it is
|
restart file is not possible, but work is underways and it is
|
||||||
@@ -382,9 +392,13 @@ int main(int argc, char** argv)
|
|||||||
else {
|
else {
|
||||||
summaryConfig.reset(new Opm::SummaryConfig);
|
summaryConfig.reset(new Opm::SummaryConfig);
|
||||||
schedule.reset(new Opm::Schedule);
|
schedule.reset(new Opm::Schedule);
|
||||||
Opm::Mpi::receiveAndUnpack(*summaryConfig, Dune::MPIHelper::getCollectiveCommunication());
|
parState = new Opm::ParallelEclipseState;
|
||||||
Opm::Mpi::receiveAndUnpack(*schedule, Dune::MPIHelper::getCollectiveCommunication());
|
Opm::Mpi::receiveAndUnpack(*summaryConfig, mpiHelper.getCollectiveCommunication());
|
||||||
|
Opm::Mpi::receiveAndUnpack(*schedule, mpiHelper.getCollectiveCommunication());
|
||||||
|
eclipseState.reset(parState);
|
||||||
}
|
}
|
||||||
|
Opm::EclMpiSerializer ser(mpiHelper.getCollectiveCommunication());
|
||||||
|
ser.broadcast(*parState);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Opm::checkConsistentArrayDimensions(*eclipseState, *schedule, parseContext, errorGuard);
|
Opm::checkConsistentArrayDimensions(*eclipseState, *schedule, parseContext, errorGuard);
|
||||||
|
|||||||
@@ -450,11 +450,15 @@ namespace Opm
|
|||||||
// Run relperm diagnostics if we have more than one phase.
|
// Run relperm diagnostics if we have more than one phase.
|
||||||
if (FluidSystem::numActivePhases() > 1) {
|
if (FluidSystem::numActivePhases() > 1) {
|
||||||
RelpermDiagnostics diagnostic;
|
RelpermDiagnostics diagnostic;
|
||||||
if (mpi_size_ > 1)
|
if (mpi_size_ > 1) {
|
||||||
this->grid().switchToGlobalView();
|
this->grid().switchToGlobalView();
|
||||||
|
static_cast<ParallelEclipseState&>(this->eclState()).switchToGlobalProps();
|
||||||
|
}
|
||||||
diagnostic.diagnosis(eclState(), deck(), this->grid());
|
diagnostic.diagnosis(eclState(), deck(), this->grid());
|
||||||
if (mpi_size_ > 1)
|
if (mpi_size_ > 1) {
|
||||||
this->grid().switchToDistributedView();
|
this->grid().switchToDistributedView();
|
||||||
|
static_cast<ParallelEclipseState&>(this->eclState()).switchToDistributedProps();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user