Add optional argument to override output interval - EBOS paramstyle
This commit is contained in:
parent
8a901f2700
commit
9d18afb45e
@ -128,6 +128,7 @@ namespace Opm
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
template<typename T>
|
||||
@ -138,6 +139,7 @@ namespace Opm
|
||||
const ParseContext& parseContext,
|
||||
T&& errors,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
Schedule(const Deck& deck,
|
||||
@ -145,6 +147,7 @@ namespace Opm
|
||||
const FieldPropsManager& fp,
|
||||
const Runspec &runspec,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
Schedule(const Deck& deck,
|
||||
@ -152,6 +155,7 @@ namespace Opm
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
template <typename T>
|
||||
@ -160,16 +164,19 @@ namespace Opm
|
||||
const ParseContext& parseContext,
|
||||
T&& errors,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseState& es,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
// The constructor *without* the Python arg should really only be used from Python itself
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseState& es,
|
||||
const std::optional<int>& output_interval = {},
|
||||
const RestartIO::RstState* rst = nullptr);
|
||||
|
||||
static Schedule serializeObject();
|
||||
@ -250,7 +257,6 @@ namespace Opm
|
||||
int first_rst_step() const;
|
||||
const std::map< std::string, int >& rst_keywords( size_t timestep ) const;
|
||||
bool rst_keyword(std::size_t timestep, const std::string& keyword) const;
|
||||
void rst_override_interval(std::size_t output_interval);
|
||||
|
||||
void applyAction(std::size_t reportStep, const time_point& sim_time, const Action::ActionX& action, const Action::Result& result, const std::unordered_map<std::string, double>& wellpi);
|
||||
void applyWellProdIndexScaling(const std::string& well_name, const std::size_t reportStep, const double scalingFactor);
|
||||
@ -474,7 +480,7 @@ namespace Opm
|
||||
bool updateWPAVE(const std::string& wname, std::size_t report_step, const PAvg& pavg);
|
||||
|
||||
void updateGuideRateModel(const GuideRateModel& new_model, std::size_t report_step);
|
||||
|
||||
void rst_override_interval(std::size_t output_interval);
|
||||
GTNode groupTree(const std::string& root_node, std::size_t report_step, std::size_t level, const std::optional<std::string>& parent_name) const;
|
||||
bool checkGroups(const ParseContext& parseContext, ErrorGuard& errors);
|
||||
bool updateWellStatus( const std::string& well, std::size_t reportStep, Well::Status status, std::optional<KeywordLocation> = {});
|
||||
|
@ -105,6 +105,7 @@ namespace {
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors,
|
||||
[[maybe_unused]] std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval,
|
||||
const RestartIO::RstState * rst)
|
||||
try :
|
||||
m_static( python, deck, runspec ),
|
||||
@ -120,6 +121,8 @@ namespace {
|
||||
} else
|
||||
this->iterateScheduleSection( 0, this->m_sched_deck.size(), parseContext, errors, false, nullptr, &grid, &fp);
|
||||
|
||||
if (output_interval.has_value())
|
||||
this->rst_override_interval(output_interval.value());
|
||||
}
|
||||
catch (const OpmInputError& opm_error) {
|
||||
throw;
|
||||
@ -141,8 +144,9 @@ namespace {
|
||||
const ParseContext& parseContext,
|
||||
T&& errors,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval,
|
||||
const RestartIO::RstState * rst) :
|
||||
Schedule(deck, grid, fp, runspec, parseContext, errors, python, rst)
|
||||
Schedule(deck, grid, fp, runspec, parseContext, errors, python, output_interval, rst)
|
||||
{}
|
||||
|
||||
|
||||
@ -151,12 +155,13 @@ namespace {
|
||||
const FieldPropsManager& fp,
|
||||
const Runspec &runspec,
|
||||
std::shared_ptr<const Python> python,
|
||||
const std::optional<int>& output_interval,
|
||||
const RestartIO::RstState * rst) :
|
||||
Schedule(deck, grid, fp, runspec, ParseContext(), ErrorGuard(), python, rst)
|
||||
Schedule(deck, grid, fp, runspec, ParseContext(), ErrorGuard(), python, output_interval, rst)
|
||||
{}
|
||||
|
||||
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, std::shared_ptr<const Python> python, const RestartIO::RstState * rst) :
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, std::shared_ptr<const Python> python, const std::optional<int>& output_interval, const RestartIO::RstState * rst) :
|
||||
Schedule(deck,
|
||||
es.getInputGrid(),
|
||||
es.fieldProps(),
|
||||
@ -164,12 +169,13 @@ namespace {
|
||||
parse_context,
|
||||
errors,
|
||||
python,
|
||||
output_interval,
|
||||
rst)
|
||||
{}
|
||||
|
||||
|
||||
template <typename T>
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, std::shared_ptr<const Python> python, const RestartIO::RstState * rst) :
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, std::shared_ptr<const Python> python, const std::optional<int>& output_interval, const RestartIO::RstState * rst) :
|
||||
Schedule(deck,
|
||||
es.getInputGrid(),
|
||||
es.fieldProps(),
|
||||
@ -177,17 +183,18 @@ namespace {
|
||||
parse_context,
|
||||
errors,
|
||||
python,
|
||||
output_interval,
|
||||
rst)
|
||||
{}
|
||||
|
||||
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, std::shared_ptr<const Python> python, const RestartIO::RstState * rst) :
|
||||
Schedule(deck, es, ParseContext(), ErrorGuard(), python, rst)
|
||||
{}
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, std::shared_ptr<const Python> python, const std::optional<int>& output_interval, const RestartIO::RstState * rst) :
|
||||
Schedule(deck, es, ParseContext(), ErrorGuard(), python, output_interval, rst)
|
||||
{}
|
||||
|
||||
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const RestartIO::RstState * rst) :
|
||||
Schedule(deck, es, ParseContext(), ErrorGuard(), std::make_shared<const Python>(), rst)
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const std::optional<int>& output_interval, const RestartIO::RstState * rst) :
|
||||
Schedule(deck, es, ParseContext(), ErrorGuard(), std::make_shared<const Python>(), output_interval, rst)
|
||||
{}
|
||||
|
||||
Schedule::Schedule(std::shared_ptr<const Python> python_handle) :
|
||||
|
@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(RUN) {
|
||||
|
||||
const int report_step = 50;
|
||||
const auto& rst_state = Opm::RestartIO::RstState::load(rst, report_step);
|
||||
Schedule sched_rst(deck, state, python, &rst_state);
|
||||
Schedule sched_rst(deck, state, python, {}, &rst_state);
|
||||
const auto& rfti_well = sched_rst.getWell("RFTI", report_step);
|
||||
const auto& rftp_well = sched_rst.getWell("RFTP", report_step);
|
||||
BOOST_CHECK(rftp_well.getStatus() == Well::Status::SHUT);
|
||||
|
@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(LoadRestartSim) {
|
||||
EclIO::ERst rst_file("SPE1CASE2.X0060");
|
||||
auto rst_state = RestartIO::RstState::load(rst_file, 60);
|
||||
EclipseState ecl_state_restart(restart_deck);
|
||||
Schedule restart_sched(restart_deck, ecl_state_restart, python, &rst_state);
|
||||
Schedule restart_sched(restart_deck, ecl_state_restart, python, {}, &rst_state);
|
||||
|
||||
// Verify that sched and restart_sched are identical from report_step 60 and onwords.
|
||||
}
|
||||
|
@ -3584,7 +3584,7 @@ BOOST_AUTO_TEST_CASE(SKIPREST_VFP) {
|
||||
const auto& rst_filename = es.getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false );
|
||||
Opm::EclIO::ERst rst_file(rst_filename);
|
||||
const auto& rst = Opm::RestartIO::RstState::load(rst_file, report_step);
|
||||
const auto sched = Schedule{ deck, es, python , &rst};
|
||||
const auto sched = Schedule{ deck, es, python , {}, &rst};
|
||||
BOOST_CHECK_NO_THROW( sched[3].vfpprod(5) );
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ Opm::Schedule load_schedule(std::shared_ptr<const Opm::Python> python, const std
|
||||
Opm::EclIO::ERst rst_file(rst_filename);
|
||||
|
||||
const auto& rst = Opm::RestartIO::RstState::load(rst_file, report_step);
|
||||
return Opm::Schedule(deck, state, python, &rst);
|
||||
return Opm::Schedule(deck, state, python, {}, &rst);
|
||||
} else
|
||||
return Opm::Schedule(deck, state, python);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user