Only update target of group-controlled wells during updateAndCommunicate

This commit is contained in:
Stein Krogstad 2024-11-19 12:57:42 +01:00
parent 5b002b2a77
commit 9b54245d9a

View File

@ -2437,8 +2437,12 @@ namespace Opm {
OPM_BEGIN_PARALLEL_TRY_CATCH()
// if a well or group change control it affects all wells that are under the same group
for (const auto& well : well_container_) {
well->updateWellStateWithTarget(simulator_, this->groupState(),
this->wellState(), deferred_logger);
// We only want to update wells under group-control here
auto& ws = this->wellState().well(well->indexOfWell());
if (ws.production_cmode == Well::ProducerCMode::GRUP || ws.injection_cmode == Well::InjectorCMode::GRUP) {
well->updateWellStateWithTarget(simulator_, this->groupState(),
this->wellState(), deferred_logger);
}
}
OPM_END_PARALLEL_TRY_CATCH("BlackoilWellModel::updateAndCommunicate failed: ",
simulator_.gridView().comm())