Merge pull request #4924 from GitPaean/fixing_gecon_welopen

use the WELL_SET_TO_OPEN event to open closed wells
This commit is contained in:
Bård Skaflestad 2023-11-01 10:24:18 +01:00 committed by GitHub
commit 17886f934c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -799,17 +799,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);
} }
} }
@ -2263,6 +2263,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 {