Merge pull request #5900 from totto82/improve_well_shutting

Improve well shutting logic
This commit is contained in:
Atgeirr Flø Rasmussen
2025-01-28 10:46:10 +01:00
committed by GitHub
3 changed files with 15 additions and 10 deletions

View File

@@ -33,7 +33,7 @@ void logTimer(const AdaptiveSimulatorTimer& substepTimer)
}
std::set<std::string>
consistentlyFailingWells(const std::vector<StepReport>& sr)
consistentlyFailingWells(const std::vector<StepReport>& sr, bool requireRepeatedFailures)
{
// If there are wells that cause repeated failures, we
// close them, and restart the un-chopped timestep.
@@ -60,10 +60,10 @@ consistentlyFailingWells(const std::vector<StepReport>& sr)
const int rep_step = sr.back().report_step;
const int sub_step = sr.back().current_step;
const int sr_size = sr.size();
if (sr_size >= num_steps) {
for (const auto& wf : wfs) {
failing_wells.insert(wf.wellName());
}
for (const auto& wf : wfs) {
failing_wells.insert(wf.wellName());
}
if (requireRepeatedFailures && sr_size >= num_steps) {
for (int s = 1; s < num_steps; ++s) {
const auto& srep = sr[sr_size - 1 - s];
// Report must be from same report step and substep, otherwise we have

View File

@@ -68,7 +68,7 @@ struct StepReport;
namespace detail {
void logTimer(const AdaptiveSimulatorTimer& substep_timer);
std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr);
std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr, bool requireRepeatedFailures);
void registerAdaptiveParameters();
std::tuple<TimeStepControlType, std::unique_ptr<TimeStepControlInterface>, bool>

View File

@@ -906,10 +906,15 @@ AdaptiveTimeStepping<TypeTag>::SubStepIteration<Solver>::
chopTimeStepOrCloseFailingWells_(const int new_time_step)
{
bool wells_shut = false;
// We are below the threshold, and will check if there are any wells we should close
// rather than chopping again.
std::set<std::string> failing_wells = detail::consistentlyFailingWells(
solver_().model().stepReports());
// We are below the threshold, and will check if there are any
// wells that fails repeatedly (that means that it fails in the last three steps)
// we should close rather than chopping again.
// If we already have chopped the timestep two times that is
// new_time_step < minTimeStepBeforeClosingWells_()*restartFactor_()*restartFactor_()
// We also shut wells that fails only on this step.
bool requireRepeatedFailures = new_time_step > ( minTimeStepBeforeClosingWells_()*restartFactor_()*restartFactor_());
std::set<std::string> failing_wells = detail::consistentlyFailingWells(solver_().model().stepReports(), requireRepeatedFailures);
if (failing_wells.empty()) {
// Found no wells to close, chop the timestep
chopTimeStep_(new_time_step);