Add Schedule::runPyAction() to be called from the simulator

This commit is contained in:
Joakim Hove 2022-01-20 09:28:12 +01:00
parent 9ce5ca2b21
commit 34d71e0c2e
2 changed files with 7 additions and 0 deletions

View File

@ -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<std::string>& matching_wells, const std::unordered_map<std::string, double>& 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);

View File

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