Merge pull request #3594 from joakim-hove/wtest-rst

load WellTestState from restart file
This commit is contained in:
Joakim Hove
2021-10-13 11:27:41 +02:00
committed by GitHub
12 changed files with 64 additions and 10 deletions

View File

@@ -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_{};

View File

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

View File

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

View File

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

View File

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

View File

@@ -220,6 +220,7 @@ namespace Opm {
void initFromRestartFile(const RestartValue& restartValues)
{
initFromRestartFile(restartValues,
this->ebosSimulator_.vanguard().transferWTestState(),
UgGridHelpers::numCells(grid()),
param_.use_multisegment_well_);
}

View File

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

View File

@@ -135,6 +135,7 @@ public:
WellState& well_state);
void initFromRestartFile(const RestartValue& restartValues,
WellTestState wtestState,
const size_t numCells,
bool handle_ms_well);