use the REQUEST_OPEN_WELL event to open closed wells

This commit is contained in:
Kai Bao 2023-10-11 13:15:57 +02:00
parent e9645ada24
commit 83ed0f01e5

View File

@ -794,17 +794,17 @@ namespace Opm {
// TODO: more checking here, to make sure this standard more specific and complete // TODO: more checking here, to make sure this standard more specific and complete
// maybe there is some WCON keywords will not open the well // maybe there is some WCON keywords will not open the well
auto& events = this->wellState().well(w).events; auto& events = this->wellState().well(w).events;
if (events.hasEvent(WellState::event_mask)) { if (events.hasEvent(ScheduleEvents::REQUEST_OPEN_WELL)) {
if (wellTestState().lastTestTime(well_name) == ebosSimulator_.time()) { if (wellTestState().lastTestTime(well_name) == ebosSimulator_.time()) {
// The well was shut this timestep, we are most likely retrying // The well was shut this timestep, we are most likely retrying
// a timestep without the well in question, after it caused // a timestep without the well in question, after it caused
// repeated timestep cuts. It should therefore not be opened, // repeated timestep cuts. It should therefore not be opened,
// even if it was new or received new targets this report step. // even if it was new or received new targets this report step.
events.clearEvent(WellState::event_mask);
} else { } else {
wellTestState().open_well(well_name); wellTestState().open_well(well_name);
wellTestState().open_completions(well_name); wellTestState().open_completions(well_name);
} }
events.clearEvent(ScheduleEvents::REQUEST_OPEN_WELL);
} }
} }
@ -2258,6 +2258,10 @@ namespace Opm {
// so next time step, the well does not consider to have effective events anymore. // so next time step, the well does not consider to have effective events anymore.
events.clearEvent(WellState::event_mask); events.clearEvent(WellState::event_mask);
} }
// these events only work for the first time step within the report step
if (events.hasEvent(ScheduleEvents::REQUEST_OPEN_WELL)) {
events.clearEvent(ScheduleEvents::REQUEST_OPEN_WELL);
}
// solve the well equation initially to improve the initial solution of the well model // solve the well equation initially to improve the initial solution of the well model
if (param_.solve_welleq_initially_ && well->isOperableAndSolvable()) { if (param_.solve_welleq_initially_ && well->isOperableAndSolvable()) {
try { try {