adding groupTargetConverged() to WellCollection

This commit is contained in:
Kai Bao
2017-01-16 15:55:35 +01:00
parent 31465c732c
commit e0143f85fd
3 changed files with 24 additions and 9 deletions

View File

@@ -282,7 +282,7 @@ namespace Opm
void WellCollection::updateWellTargets(const std::vector<double>& well_rates)
{
if ( !needUpdateWellTargets() ) {
if ( !needUpdateWellTargets() && groupTargetConverged(well_rates)) {
return;
}
@@ -323,4 +323,17 @@ namespace Opm
return group_control_active_;
}
bool WellCollection::groupTargetConverged(const std::vector<double>& well_rates) const
{
// TODO: eventually, there should be only one root node
// TODO: we also need to check the injection target, while we have not done that.
for (const std::shared_ptr<WellsGroupInterface>& root_node : roots_) {
if ( !root_node->groupProdTargetConverged(well_rates) ) {
return false;
}
}
return true;
}
}