make sure a well exists in the process

before closing it due to group action
This commit is contained in:
Kai Bao 2024-07-01 21:58:18 +02:00
parent b55cc972c2
commit ce05406483

View File

@ -2226,10 +2226,10 @@ namespace Opm {
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm); DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm);
for (const auto& [group_name, to] : this->closed_offending_wells_) { 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); wellTestState.close_well(to.second, WellTestConfig::Reason::GROUP, simulationTime);
this->updateClosedWellsThisStep(to.second); this->updateClosedWellsThisStep(to.second);
const std::string msg = const std::string msg =
fmt::format("Procedure on exceeding {} limit is WELL for group {}. Well {} is {}.", fmt::format("Procedure on exceeding {} limit is WELL for group {}. Well {} is {}.",
to.first, to.first,
group_name, group_name,