include wells under individual control when accumulating guiderates

This commit is contained in:
Tor Harald Sandve 2020-04-02 20:16:24 +02:00 committed by Atgeirr Flø Rasmussen
parent 70b7bed057
commit 97876530e3
2 changed files with 6 additions and 7 deletions

View File

@ -718,7 +718,7 @@ namespace WellGroupHelpers
{
const double my_guide_rate = guideRate(name, always_included_child);
const Group& parent_group = schedule_.getGroup(parent(name), report_step_);
const double total_guide_rate = guideRateSum(parent_group, always_included_child);
const double total_guide_rate = guideRateSum(parent_group, always_included_child, false);
assert(total_guide_rate >= my_guide_rate);
const double guide_rate_epsilon = 1e-12;
return (total_guide_rate > guide_rate_epsilon) ? my_guide_rate / total_guide_rate : 0.0;
@ -731,20 +731,20 @@ namespace WellGroupHelpers
return schedule_.getGroup(name, report_step_).parent();
}
}
double FractionCalculator::guideRateSum(const Group& group, const std::string& always_included_child)
double FractionCalculator::guideRateSum(const Group& group, const std::string& always_included_child, const bool include_all)
{
double total_guide_rate = 0.0;
for (const std::string& child_group : group.groups()) {
const auto ctrl = well_state_.currentProductionGroupControl(child_group);
const bool included = (ctrl == Group::ProductionCMode::FLD) || (ctrl == Group::ProductionCMode::NONE)
|| (child_group == always_included_child);
if (included) {
if (included || include_all) {
total_guide_rate += guideRate(child_group, always_included_child);
}
}
for (const std::string& child_well : group.wells()) {
const bool included = (well_state_.isProductionGrup(child_well)) || (child_well == always_included_child);
if (included) {
if (included || include_all) {
total_guide_rate += guideRate(child_well, always_included_child);
}
}
@ -761,9 +761,8 @@ namespace WellGroupHelpers
} else {
// We are a group, with default guide rate.
// Compute guide rate by accumulating our children's guide rates.
// (only children not under individual control though).
const Group& group = schedule_.getGroup(name, report_step_);
return guideRateSum(group, always_included_child);
return guideRateSum(group, always_included_child, true);
}
} else {
// No group-controlled subordinate wells.

View File

@ -301,7 +301,7 @@ namespace WellGroupHelpers
private:
std::string parent(const std::string& name);
double guideRateSum(const Group& group, const std::string& always_included_child);
double guideRateSum(const Group& group, const std::string& always_included_child, const bool include_all);
double guideRate(const std::string& name, const std::string& always_included_child);
int groupControlledWells(const std::string& group_name, const std::string& always_included_child);
GuideRate::RateVector getGroupRateVector(const std::string& group_name);