mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-20 11:48:25 -06:00
Merge pull request #4419 from akva2/eclgenericvanguard_setup_params
changed: introduce EclGenericVanguard::SetupParams
This commit is contained in:
commit
e89b28c9a2
@ -53,37 +53,26 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
double EclGenericVanguard::setupTime_ = 0.0;
|
||||
std::shared_ptr<EclipseState> EclGenericVanguard::eclState_;
|
||||
std::shared_ptr<Schedule> EclGenericVanguard::eclSchedule_;
|
||||
std::shared_ptr<SummaryConfig> EclGenericVanguard::eclSummaryConfig_;
|
||||
std::unique_ptr<UDQState> EclGenericVanguard::udqState_;
|
||||
std::unique_ptr<Action::State> EclGenericVanguard::actionState_;
|
||||
std::unique_ptr<WellTestState> EclGenericVanguard::wtestState_;
|
||||
std::unique_ptr<Parallel::Communication> EclGenericVanguard::comm_;
|
||||
EclGenericVanguard::SimulationModelParams EclGenericVanguard::modelParams_;
|
||||
|
||||
EclGenericVanguard::EclGenericVanguard()
|
||||
: python(std::make_shared<Python>())
|
||||
{
|
||||
defineSimulationModel(std::move(modelParams_));
|
||||
}
|
||||
|
||||
EclGenericVanguard::~EclGenericVanguard() = default;
|
||||
|
||||
void EclGenericVanguard::defineSimulationModel(double setupTime,
|
||||
std::shared_ptr<EclipseState> eclState,
|
||||
std::shared_ptr<Schedule> schedule,
|
||||
std::unique_ptr<UDQState> udqState,
|
||||
std::unique_ptr<Action::State> actionState,
|
||||
std::unique_ptr<WellTestState> wtestState,
|
||||
std::shared_ptr<SummaryConfig> summaryConfig)
|
||||
void EclGenericVanguard::defineSimulationModel(SimulationModelParams&& params)
|
||||
{
|
||||
EclGenericVanguard::setupTime_ = setupTime;
|
||||
EclGenericVanguard::eclState_ = std::move(eclState);
|
||||
EclGenericVanguard::eclSchedule_ = std::move(schedule);
|
||||
EclGenericVanguard::udqState_ = std::move(udqState);
|
||||
EclGenericVanguard::actionState_ = std::move(actionState);
|
||||
EclGenericVanguard::wtestState_ = std::move(wtestState);
|
||||
EclGenericVanguard::eclSummaryConfig_ = std::move(summaryConfig);
|
||||
actionState_ = std::move(params.actionState_);
|
||||
eclSchedule_ = std::move(params.eclSchedule_);
|
||||
eclState_ = std::move(params.eclState_);
|
||||
eclSummaryConfig_ = std::move(params.eclSummaryConfig_);
|
||||
setupTime_ = params.setupTime_;
|
||||
udqState_ = std::move(params.udqState_);
|
||||
wtestState_ = std::move(params.wtestState_);
|
||||
}
|
||||
|
||||
void EclGenericVanguard::readDeck(const std::string& filename)
|
||||
@ -91,24 +80,16 @@ void EclGenericVanguard::readDeck(const std::string& filename)
|
||||
Dune::Timer setupTimer;
|
||||
setupTimer.start();
|
||||
|
||||
std::shared_ptr<Opm::EclipseState> eclipseState;
|
||||
std::shared_ptr<Opm::Schedule> schedule;
|
||||
std::unique_ptr<Opm::UDQState> udqState;
|
||||
std::unique_ptr<Opm::Action::State> actionState;
|
||||
std::unique_ptr<Opm::WellTestState> wtestState;
|
||||
std::shared_ptr<Opm::SummaryConfig> summaryConfig;
|
||||
|
||||
Opm::readDeck(EclGenericVanguard::comm(),
|
||||
filename, eclipseState, schedule, udqState,
|
||||
actionState, wtestState,
|
||||
summaryConfig, nullptr, false,
|
||||
false, false, {});
|
||||
|
||||
EclGenericVanguard::defineSimulationModel(setupTimer.elapsed(),
|
||||
eclipseState, schedule,
|
||||
std::move(udqState),
|
||||
std::move(actionState),
|
||||
std::move(wtestState), summaryConfig);
|
||||
filename,
|
||||
modelParams_.eclState_,
|
||||
modelParams_.eclSchedule_,
|
||||
modelParams_.udqState_,
|
||||
modelParams_.actionState_,
|
||||
modelParams_.wtestState_,
|
||||
modelParams_.eclSummaryConfig_,
|
||||
nullptr, false, false, false, {});
|
||||
modelParams_.setupTime_ = setupTimer.stop();
|
||||
}
|
||||
|
||||
std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName)
|
||||
|
@ -66,6 +66,19 @@ class EclGenericVanguard {
|
||||
public:
|
||||
using ParallelWellStruct = std::vector<std::pair<std::string,bool>>;
|
||||
|
||||
struct SimulationModelParams {
|
||||
double setupTime_;
|
||||
std::unique_ptr<Parallel::Communication> comm_;
|
||||
std::unique_ptr<UDQState> udqState_;
|
||||
std::unique_ptr<Action::State> actionState_;
|
||||
std::unique_ptr<WellTestState> wtestState_;
|
||||
std::shared_ptr<EclipseState> eclState_;
|
||||
std::shared_ptr<Schedule> eclSchedule_;
|
||||
std::shared_ptr<SummaryConfig> eclSummaryConfig_;
|
||||
};
|
||||
|
||||
static SimulationModelParams modelParams_;
|
||||
|
||||
/*!
|
||||
* \brief Constructor.
|
||||
* \details Needs to be in compile unit.
|
||||
@ -89,7 +102,7 @@ public:
|
||||
/*!
|
||||
* \brief Returns the wall time required to set up the simulator before it was born.
|
||||
*/
|
||||
static double setupTime()
|
||||
double setupTime()
|
||||
{ return setupTime_; }
|
||||
|
||||
/*!
|
||||
@ -101,13 +114,7 @@ public:
|
||||
/*!
|
||||
* \brief Set the simulation configuration objects.
|
||||
*/
|
||||
static void defineSimulationModel(double setupTime,
|
||||
std::shared_ptr<EclipseState> eclState,
|
||||
std::shared_ptr<Schedule> schedule,
|
||||
std::unique_ptr<UDQState> udqState,
|
||||
std::unique_ptr<Action::State> actionState,
|
||||
std::unique_ptr<WellTestState> wtestState,
|
||||
std::shared_ptr<SummaryConfig> summaryConfig);
|
||||
void defineSimulationModel(SimulationModelParams&& params);
|
||||
|
||||
/*!
|
||||
* \brief Return a reference to the internalized ECL deck.
|
||||
@ -258,7 +265,7 @@ protected:
|
||||
|
||||
void init();
|
||||
|
||||
static double setupTime_;
|
||||
double setupTime_;
|
||||
|
||||
// These variables may be owned by both Python and the simulator
|
||||
static std::unique_ptr<Parallel::Communication> comm_;
|
||||
@ -285,22 +292,22 @@ protected:
|
||||
bool enableExperiments_;
|
||||
|
||||
std::unique_ptr<SummaryState> summaryState_;
|
||||
static std::unique_ptr<UDQState> udqState_;
|
||||
static std::unique_ptr<Action::State> actionState_;
|
||||
std::unique_ptr<UDQState> udqState_;
|
||||
std::unique_ptr<Action::State> actionState_;
|
||||
|
||||
// Observe that this instance is handled differently from the other state
|
||||
// variables, it will only be initialized for a restart run. While
|
||||
// initializing a restarted run this instance is transferred to the WGState
|
||||
// member in the well model.
|
||||
static std::unique_ptr<WellTestState> wtestState_;
|
||||
std::unique_ptr<WellTestState> wtestState_;
|
||||
|
||||
// these attributes point either to the internal or to the external version of the
|
||||
// parser objects.
|
||||
std::shared_ptr<Python> python;
|
||||
// These variables may be owned by both Python and the simulator
|
||||
static std::shared_ptr<EclipseState> eclState_;
|
||||
static std::shared_ptr<Schedule> eclSchedule_;
|
||||
static std::shared_ptr<SummaryConfig> eclSummaryConfig_;
|
||||
std::shared_ptr<EclipseState> eclState_;
|
||||
std::shared_ptr<Schedule> eclSchedule_;
|
||||
std::shared_ptr<SummaryConfig> eclSummaryConfig_;
|
||||
|
||||
/*! \brief Information about wells in parallel
|
||||
*
|
||||
|
@ -211,13 +211,13 @@ void Main::readDeck(const std::string& deckFilename,
|
||||
|
||||
void Main::setupVanguard()
|
||||
{
|
||||
EclGenericVanguard::defineSimulationModel(this->setupTime_,
|
||||
this->eclipseState_,
|
||||
this->schedule_,
|
||||
std::move(this->udqState_),
|
||||
std::move(this->actionState_),
|
||||
std::move(this->wtestState_),
|
||||
this->summaryConfig_);
|
||||
EclGenericVanguard::modelParams_.setupTime_ = this->setupTime_;
|
||||
EclGenericVanguard::modelParams_.actionState_ = std::move(this->actionState_);
|
||||
EclGenericVanguard::modelParams_.eclSchedule_ = this->schedule_;
|
||||
EclGenericVanguard::modelParams_.eclState_ = this->eclipseState_;
|
||||
EclGenericVanguard::modelParams_.eclSummaryConfig_ = this->summaryConfig_;
|
||||
EclGenericVanguard::modelParams_.udqState_ = std::move(udqState_);
|
||||
EclGenericVanguard::modelParams_.wtestState_ = std::move(wtestState_);
|
||||
}
|
||||
|
||||
#if HAVE_DAMARIS
|
||||
|
Loading…
Reference in New Issue
Block a user