updating the thp of the wells during the network update iteration

This commit is contained in:
Kai Bao 2023-04-21 14:12:04 +02:00
parent bb7ed4d78e
commit ee77fa122c

View File

@ -988,13 +988,17 @@ updateNetworkPressures(const int reportStepIdx)
// set the dynamic THP constraint of the well accordingly.
const double new_limit = it->second;
well->setDynamicThpLimit(new_limit);
const SingleWellState& ws = this->wellState()[well->indexOfWell()];
SingleWellState& ws = this->wellState()[well->indexOfWell()];
const bool thp_is_limit = ws.production_cmode == Well::ProducerCMode::THP;
const bool will_switch_to_thp = ws.thp < new_limit;
if (thp_is_limit || will_switch_to_thp) {
active_limit_change = true;
network_imbalance = std::max(network_imbalance, std::fabs(new_limit - ws.thp));
}
if (thp_is_limit) {
ws.thp = well->getTHPConstraint(summaryState_);
}
}
}
}