diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 8a25703c4..f34d94cf5 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -128,6 +128,7 @@ namespace Opm const ParseContext& parseContext, ErrorGuard& errors, std::shared_ptr python, + const std::optional& output_interval = {}, const RestartIO::RstState* rst = nullptr); template @@ -138,6 +139,7 @@ namespace Opm const ParseContext& parseContext, T&& errors, std::shared_ptr python, + const std::optional& 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 python, + const std::optional& 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 python, + const std::optional& output_interval = {}, const RestartIO::RstState* rst = nullptr); template @@ -160,16 +164,19 @@ namespace Opm const ParseContext& parseContext, T&& errors, std::shared_ptr python, + const std::optional& output_interval = {}, const RestartIO::RstState* rst = nullptr); Schedule(const Deck& deck, const EclipseState& es, std::shared_ptr python, + const std::optional& 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& 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& 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& 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 = {}); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index e72fbf1c1..b1bd35333 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -105,6 +105,7 @@ namespace { const ParseContext& parseContext, ErrorGuard& errors, [[maybe_unused]] std::shared_ptr python, + const std::optional& 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 python, + const std::optional& 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 python, + const std::optional& 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 python, const RestartIO::RstState * rst) : + Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, std::shared_ptr python, const std::optional& 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 - Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, std::shared_ptr python, const RestartIO::RstState * rst) : + Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, std::shared_ptr python, const std::optional& 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 python, const RestartIO::RstState * rst) : - Schedule(deck, es, ParseContext(), ErrorGuard(), python, rst) - {} +Schedule::Schedule(const Deck& deck, const EclipseState& es, std::shared_ptr python, const std::optional& 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(), rst) +Schedule::Schedule(const Deck& deck, const EclipseState& es, const std::optional& output_interval, const RestartIO::RstState * rst) : + Schedule(deck, es, ParseContext(), ErrorGuard(), std::make_shared(), output_interval, rst) {} Schedule::Schedule(std::shared_ptr python_handle) : diff --git a/tests/msim/test_msim.cpp b/tests/msim/test_msim.cpp index 42a4eb053..367bd8c9a 100644 --- a/tests/msim/test_msim.cpp +++ b/tests/msim/test_msim.cpp @@ -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); diff --git a/tests/parser/ScheduleRestartTests.cpp b/tests/parser/ScheduleRestartTests.cpp index 35b439d18..68d314643 100644 --- a/tests/parser/ScheduleRestartTests.cpp +++ b/tests/parser/ScheduleRestartTests.cpp @@ -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. } diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index e55f59aef..ef65b474b 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -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) ); } diff --git a/tests/rst_test.cpp b/tests/rst_test.cpp index 8f23f2ac8..6da33cf8d 100644 --- a/tests/rst_test.cpp +++ b/tests/rst_test.cpp @@ -78,7 +78,7 @@ Opm::Schedule load_schedule(std::shared_ptr 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); }