From 34d71e0c2e0b3ecadf2503f650be7d80faf57296 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 20 Jan 2022 09:28:12 +0100 Subject: [PATCH] Add Schedule::runPyAction() to be called from the simulator --- opm/input/eclipse/Schedule/Schedule.hpp | 1 + src/opm/input/eclipse/Schedule/Schedule.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/opm/input/eclipse/Schedule/Schedule.hpp b/opm/input/eclipse/Schedule/Schedule.hpp index e10c358f2..3f8991791 100644 --- a/opm/input/eclipse/Schedule/Schedule.hpp +++ b/opm/input/eclipse/Schedule/Schedule.hpp @@ -280,6 +280,7 @@ namespace Opm const std::map< std::string, int >& rst_keywords( size_t timestep ) const; SimulatorUpdate applyAction(std::size_t reportStep, const Action::ActionX& action, const std::vector& matching_wells, const std::unordered_map& wellpi); + SimulatorUpdate runPyAction(std::size_t reportStep, const Action::PyAction& pyaction, EclipseState& ecl_state, SummaryState& summary_state); void applyWellProdIndexScaling(const std::string& well_name, const std::size_t reportStep, const double scalingFactor); diff --git a/src/opm/input/eclipse/Schedule/Schedule.cpp b/src/opm/input/eclipse/Schedule/Schedule.cpp index 45417eda3..09ee4eedd 100644 --- a/src/opm/input/eclipse/Schedule/Schedule.cpp +++ b/src/opm/input/eclipse/Schedule/Schedule.cpp @@ -1332,6 +1332,12 @@ File {} line {}.)", pattern, location.keyword, location.filename, location.linen + SimulatorUpdate Schedule::runPyAction(std::size_t reportStep, const Action::PyAction& pyaction, EclipseState& ecl_state, SummaryState& summary_state) { + SimulatorUpdate sim_update; + pyaction.run(ecl_state, *this, reportStep, summary_state); + return sim_update; + } + void Schedule::applyWellProdIndexScaling(const std::string& well_name, const std::size_t reportStep, const double newWellPI) { if (reportStep >= this->snapshots.size()) return;