From ce05406483540e936e5625cc43bc5cdc959c2ebc Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 1 Jul 2024 21:58:18 +0200 Subject: [PATCH] make sure a well exists in the process before closing it due to group action --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 6354bfcf4..d2b78414a 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2226,10 +2226,10 @@ namespace Opm { DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm); for (const auto& [group_name, to] : this->closed_offending_wells_) { - if (!this->wasDynamicallyShutThisTimeStep(to.second)) { + if (this->hasWell(to.second) && !this->wasDynamicallyShutThisTimeStep(to.second)) { wellTestState.close_well(to.second, WellTestConfig::Reason::GROUP, simulationTime); this->updateClosedWellsThisStep(to.second); - const std::string msg = + const std::string msg = fmt::format("Procedure on exceeding {} limit is WELL for group {}. Well {} is {}.", to.first, group_name,