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

View File

@ -301,7 +301,7 @@ namespace WellGroupHelpers
private: private:
std::string parent(const std::string& name); 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); 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); int groupControlledWells(const std::string& group_name, const std::string& always_included_child);
GuideRate::RateVector getGroupRateVector(const std::string& group_name); GuideRate::RateVector getGroupRateVector(const std::string& group_name);