move solveWellEquation inside prepareTimeStep

This commit is contained in:
Tor Harald Sandve 2021-04-23 08:40:14 +02:00
parent 045abb3f80
commit 62d902435a

View File

@ -1055,13 +1055,6 @@ namespace Opm {
// Set the well primary variables based on the value of well solutions
initPrimaryVariablesEvaluation();
if (param_.solve_welleq_initially_ && iterationIdx == 0) {
for (auto& well : well_container_) {
well->solveWellEquation(ebosSimulator_, this->wellState(), this->groupState(), local_deferredLogger);
}
updateWellControls(local_deferredLogger, /* check group controls */ false);
}
maybeDoGasLiftOptimize(local_deferredLogger);
assembleWellEq(dt, local_deferredLogger);
} catch (const std::runtime_error& e) {
@ -1681,10 +1674,7 @@ namespace Opm {
try {
for (const auto& well : well_container_) {
well->checkWellOperability(ebosSimulator_, this->wellState(), deferred_logger);
}
// since the controls are all updated, we should update well_state accordingly
for (const auto& well : well_container_) {
const int w = well->indexOfWell();
if (!well->isOperable() ) continue;
auto& events = this->wellState().events();
@ -1694,7 +1684,13 @@ namespace Opm {
// so next time step, the well does not consider to have effective events anymore.
events.clearEvent(well->name(), WellStateFullyImplicitBlackoil::event_mask);
}
}
// solve the well equation initially to improve the initial solution of the well model
if (param_.solve_welleq_initially_) {
well->solveWellEquation(ebosSimulator_, this->wellState(), this->groupState(), deferred_logger);
}
} // end of for (const auto& well : well_container_)
updatePrimaryVariables(deferred_logger);
} catch (const std::runtime_error& e) {
exc_type = ExceptionType::RUNTIME_ERROR;