Commit wellstate after appplyActions

This commit is contained in:
Joakim Hove
2021-03-26 22:58:21 +01:00
parent 98f6a9a7ac
commit b71a273ada

View File

@@ -1377,6 +1377,7 @@ public:
pyaction->run(ecl_state, schedule, reportStep, summaryState);
}
bool commit_wellstate = false;
auto simTime = schedule.simTime(reportStep);
for (const auto& action : actions.pending(actionState, simTime)) {
auto actionResult = action->eval(context);
@@ -1396,12 +1397,21 @@ public:
auto affected_wells = schedule.applyAction(reportStep, Opm::TimeService::from_time_t(simTime), *action, actionResult, wellpi);
actionState.add_run(*action, simTime);
this->wellModel_.updateEclWells(reportStep, affected_wells);
if (!affected_wells.empty())
commit_wellstate = true;
} else {
std::string msg = "The action: " + action->name() + " evaluated to false at " + ts;
Opm::OpmLog::info(msg);
}
}
/*
The well state has been stored in a previous object when the time step
has completed successfully, the action process might have modified the
well state, and to be certain that is not overwritten when starting
the next timestep we must commit it.
*/
if (commit_wellstate)
this->wellModel_.commitWellState();
}