mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-24 16:30:02 -06:00
Merge pull request #3594 from joakim-hove/wtest-rst
load WellTestState from restart file
This commit is contained in:
commit
4b85fc74ae
@ -33,6 +33,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
@ -62,6 +63,7 @@ std::shared_ptr<Schedule> EclGenericVanguard::externalEclSchedule_;
|
||||
std::shared_ptr<SummaryConfig> EclGenericVanguard::externalEclSummaryConfig_;
|
||||
std::unique_ptr<UDQState> EclGenericVanguard::externalUDQState_;
|
||||
std::unique_ptr<Action::State> EclGenericVanguard::externalActionState_;
|
||||
std::unique_ptr<WellTestState> EclGenericVanguard::externalWTestState_;
|
||||
std::unique_ptr<Parallel::Communication> EclGenericVanguard::comm_;
|
||||
|
||||
EclGenericVanguard::EclGenericVanguard()
|
||||
@ -135,6 +137,11 @@ void EclGenericVanguard::setExternalActionState(std::unique_ptr<Action::State> a
|
||||
externalActionState_ = std::move(actionState);
|
||||
}
|
||||
|
||||
void EclGenericVanguard::setExternalWTestState(std::unique_ptr<WellTestState> wtestState)
|
||||
{
|
||||
externalWTestState_ = std::move(wtestState);
|
||||
}
|
||||
|
||||
std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName)
|
||||
{
|
||||
const auto fileExists = [](const filesystem::path& f) -> bool
|
||||
@ -289,7 +296,7 @@ void EclGenericVanguard::init()
|
||||
parseContext_ = createParseContext(ignoredKeywords_, eclStrictParsing_);
|
||||
}
|
||||
|
||||
readDeck(EclGenericVanguard::comm(), fileName_, deck_, eclState_, eclSchedule_, udqState_, actionState_,
|
||||
readDeck(EclGenericVanguard::comm(), fileName_, deck_, eclState_, eclSchedule_, udqState_, actionState_, wtestState_,
|
||||
eclSummaryConfig_, std::move(errorGuard), python,
|
||||
std::move(parseContext_), /* initFromRestart = */ false,
|
||||
/* checkDeck = */ enableExperiments_, outputInterval_);
|
||||
@ -304,6 +311,11 @@ void EclGenericVanguard::init()
|
||||
else
|
||||
this->actionState_ = std::make_unique<Action::State>();
|
||||
|
||||
if (EclGenericVanguard::externalWTestState_)
|
||||
this->wtestState_ = std::move(EclGenericVanguard::externalWTestState_);
|
||||
else
|
||||
this->wtestState_ = std::make_unique<WellTestState>();
|
||||
|
||||
this->summaryState_ = std::make_unique<SummaryState>( TimeService::from_time_t(this->eclSchedule_->getStartTime() ));
|
||||
|
||||
// Initialize parallelWells with all local wells
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define EWOMS_ECL_GENERIC_VANGUARD_HH
|
||||
|
||||
#include <opm/grid/common/GridEnums.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
||||
#include <dune/common/parallel/collectivecommunication.hh>
|
||||
|
||||
@ -57,6 +57,7 @@ class Python;
|
||||
class SummaryConfig;
|
||||
class SummaryState;
|
||||
class UDQState;
|
||||
class WellTestState;
|
||||
|
||||
class EclGenericVanguard {
|
||||
public:
|
||||
@ -152,6 +153,9 @@ public:
|
||||
|
||||
static void setExternalUDQState(std::unique_ptr<UDQState> udqState);
|
||||
static void setExternalActionState(std::unique_ptr<Action::State> actionState);
|
||||
static void setExternalWTestState(std::unique_ptr<WellTestState> wtestState);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Return a reference to the parsed ECL deck.
|
||||
*/
|
||||
@ -221,6 +225,11 @@ public:
|
||||
const UDQState& udqState() const
|
||||
{ return *udqState_; }
|
||||
|
||||
WellTestState transferWTestState() {
|
||||
return *this->wtestState_.release();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Returns the name of the case.
|
||||
*
|
||||
@ -304,6 +313,7 @@ protected:
|
||||
static bool externalDeckSet_;
|
||||
static std::unique_ptr<UDQState> externalUDQState_;
|
||||
static std::unique_ptr<Action::State> externalActionState_;
|
||||
static std::unique_ptr<WellTestState> externalWTestState_;
|
||||
static std::unique_ptr<Parallel::Communication> comm_;
|
||||
|
||||
std::string caseName_;
|
||||
@ -320,8 +330,14 @@ protected:
|
||||
bool enableExperiments_;
|
||||
|
||||
std::unique_ptr<SummaryState> summaryState_;
|
||||
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.
|
||||
std::unique_ptr<WellTestState> wtestState_;
|
||||
|
||||
// these attributes point either to the internal or to the external version of the
|
||||
// parser objects.
|
||||
|
@ -35,6 +35,7 @@ void flowEbosBlackoilSetDeck(double setupTime, std::shared_ptr<Deck> deck,
|
||||
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)
|
||||
{
|
||||
using TypeTag = Properties::TTag::EclFlowProblem;
|
||||
@ -46,6 +47,7 @@ void flowEbosBlackoilSetDeck(double setupTime, std::shared_ptr<Deck> deck,
|
||||
Vanguard::setExternalSchedule(std::move(schedule));
|
||||
Vanguard::setExternalUDQState(std::move(udqState));
|
||||
Vanguard::setExternalActionState(std::move(actionState));
|
||||
Vanguard::setExternalWTestState(std::move(wtestState));
|
||||
Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ template<class TypeTag> class FlowMainEbos;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class UDQState;
|
||||
class WellTestState;
|
||||
namespace Action {
|
||||
class State;
|
||||
}
|
||||
@ -37,6 +38,7 @@ void flowEbosBlackoilSetDeck(double setupTime, std::shared_ptr<Deck> deck,
|
||||
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);
|
||||
|
||||
int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles);
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
#include <opm/models/utils/parametersystem.hh>
|
||||
@ -264,6 +265,7 @@ namespace Opm
|
||||
schedule_,
|
||||
std::move(udqState_),
|
||||
std::move(this->actionState_),
|
||||
std::move(this->wtestState_),
|
||||
summaryConfig_);
|
||||
return flowEbosBlackoilMainInit(
|
||||
argc_, argv_, outputCout_, outputFiles_);
|
||||
@ -455,7 +457,7 @@ namespace Opm
|
||||
if (output_param >= 0)
|
||||
outputInterval = output_param;
|
||||
|
||||
readDeck(EclGenericVanguard::comm(), deckFilename, deck_, eclipseState_, schedule_, udqState_, actionState_,
|
||||
readDeck(EclGenericVanguard::comm(), deckFilename, deck_, eclipseState_, schedule_, udqState_, actionState_, wtestState_,
|
||||
summaryConfig_, nullptr, python, std::move(parseContext),
|
||||
init_from_restart_file, outputCout_, outputInterval);
|
||||
|
||||
@ -653,6 +655,7 @@ namespace Opm
|
||||
this->schedule_,
|
||||
std::move(this->udqState_),
|
||||
std::move(this->actionState_),
|
||||
std::move(this->wtestState_),
|
||||
this->summaryConfig_);
|
||||
|
||||
return flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
@ -668,6 +671,7 @@ namespace Opm
|
||||
char *saveArgs_[3]{nullptr};
|
||||
std::unique_ptr<UDQState> udqState_{};
|
||||
std::unique_ptr<Action::State> actionState_{};
|
||||
std::unique_ptr<WellTestState> wtestState_{};
|
||||
|
||||
// These variables may be owned by both Python and the simulator
|
||||
std::shared_ptr<Deck> deck_{};
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
#include <ebos/eclmpiserializer.hh>
|
||||
@ -44,7 +45,8 @@ namespace Opm {
|
||||
void eclStateBroadcast(Parallel::Communication comm, EclipseState& eclState, Schedule& schedule,
|
||||
SummaryConfig& summaryConfig,
|
||||
UDQState& udqState,
|
||||
Action::State& actionState)
|
||||
Action::State& actionState,
|
||||
WellTestState& wtestState)
|
||||
{
|
||||
Opm::EclMpiSerializer ser(comm);
|
||||
ser.broadcast(eclState);
|
||||
@ -52,6 +54,7 @@ void eclStateBroadcast(Parallel::Communication comm, EclipseState& eclState, Sch
|
||||
ser.broadcast(summaryConfig);
|
||||
ser.broadcast(udqState);
|
||||
ser.broadcast(actionState);
|
||||
//ser.broadcast(wtestState);
|
||||
}
|
||||
|
||||
void eclScheduleBroadcast(Parallel::Communication comm, Schedule& schedule)
|
||||
|
@ -27,6 +27,7 @@ class EclipseState;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class UDQState;
|
||||
class WellTestState;
|
||||
|
||||
namespace Action {
|
||||
class State;
|
||||
@ -41,7 +42,8 @@ class State;
|
||||
void eclStateBroadcast(Parallel::Communication comm, EclipseState& eclState, Schedule& schedule,
|
||||
SummaryConfig& summaryConfig,
|
||||
UDQState& udqState,
|
||||
Action::State& actionState);
|
||||
Action::State& actionState,
|
||||
WellTestState& wtestState);
|
||||
|
||||
/// \brief Broadcasts an schedule from root node in parallel runs.
|
||||
void eclScheduleBroadcast(Parallel::Communication comm, Schedule& schedule);
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
@ -117,6 +118,7 @@ namespace {
|
||||
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,
|
||||
Opm::ErrorGuard& errorGuard)
|
||||
{
|
||||
// Analytic aquifers must always be loaded from the restart file in
|
||||
@ -167,6 +169,8 @@ namespace {
|
||||
|
||||
actionState = std::make_unique<Opm::Action::State>();
|
||||
actionState->load_rst((*schedule)[report_step].actions(), rst_state);
|
||||
|
||||
wtestState = std::make_unique<Opm::WellTestState>(schedule->runspec().start_time(), rst_state);
|
||||
}
|
||||
|
||||
void createNonRestartDynamicObjects(const Opm::Deck& deck,
|
||||
@ -236,6 +240,7 @@ namespace {
|
||||
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,
|
||||
std::shared_ptr<Opm::Python> python,
|
||||
const bool initFromRestart,
|
||||
@ -265,13 +270,13 @@ namespace {
|
||||
loadObjectsFromRestart(*deck, parser, *parseContext,
|
||||
initFromRestart, outputInterval,
|
||||
*eclipseState, std::move(python),
|
||||
schedule, udqState, actionState,
|
||||
schedule, udqState, actionState, wtestState,
|
||||
errorGuard);
|
||||
}
|
||||
else {
|
||||
createNonRestartDynamicObjects(*deck, *eclipseState,
|
||||
*parseContext, std::move(python),
|
||||
schedule, udqState, actionState,
|
||||
schedule, udqState, actionState,
|
||||
errorGuard);
|
||||
}
|
||||
|
||||
@ -423,6 +428,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
||||
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,
|
||||
std::unique_ptr<ErrorGuard> errorGuard,
|
||||
std::shared_ptr<Python> python,
|
||||
@ -441,7 +447,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
||||
if (comm.rank() == 0) { // Always true when !HAVE_MPI
|
||||
try {
|
||||
readOnIORank(comm, deckFilename, parseContext.get(), deck,
|
||||
eclipseState, schedule, udqState, actionState,
|
||||
eclipseState, schedule, udqState, actionState, wtestState,
|
||||
summaryConfig, std::move(python), initFromRestart,
|
||||
checkDeck, outputInterval, *errorGuard);
|
||||
}
|
||||
@ -469,7 +475,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
||||
try {
|
||||
if (parseSuccess) {
|
||||
eclStateBroadcast(comm, *eclipseState, *schedule,
|
||||
*summaryConfig, *udqState, *actionState);
|
||||
*summaryConfig, *udqState, *actionState, *wtestState);
|
||||
}
|
||||
}
|
||||
catch (const std::exception& broadcast_error) {
|
||||
|
@ -37,6 +37,7 @@ namespace Opm {
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class UDQState;
|
||||
class WellTestState;
|
||||
} // end namespace Opm
|
||||
|
||||
namespace Opm {
|
||||
@ -76,6 +77,7 @@ void readDeck(Parallel::Communication comm,
|
||||
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,
|
||||
std::unique_ptr<ErrorGuard> errorGuard,
|
||||
std::shared_ptr<Python> python,
|
||||
|
@ -220,6 +220,7 @@ namespace Opm {
|
||||
void initFromRestartFile(const RestartValue& restartValues)
|
||||
{
|
||||
initFromRestartFile(restartValues,
|
||||
this->ebosSimulator_.vanguard().transferWTestState(),
|
||||
UgGridHelpers::numCells(grid()),
|
||||
param_.use_multisegment_well_);
|
||||
}
|
||||
|
@ -255,6 +255,7 @@ loadRestartData(const data::Wells& rst_wells,
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
initFromRestartFile(const RestartValue& restartValues,
|
||||
WellTestState wtestState,
|
||||
const size_t numCells,
|
||||
bool handle_ms_well)
|
||||
{
|
||||
@ -277,6 +278,8 @@ initFromRestartFile(const RestartValue& restartValues,
|
||||
loadRestartData(restartValues.wells, restartValues.grp_nwrk, phase_usage_, handle_ms_well, this->wellState());
|
||||
}
|
||||
|
||||
|
||||
this->active_wgstate_.well_test_state = std::move(wtestState);
|
||||
this->commitWGState();
|
||||
initial_step_ = false;
|
||||
}
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
WellState& well_state);
|
||||
|
||||
void initFromRestartFile(const RestartValue& restartValues,
|
||||
WellTestState wtestState,
|
||||
const size_t numCells,
|
||||
bool handle_ms_well);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user