Fix the fix on how the group reduction works

This commit is contained in:
Tor Harald Sandve 2020-04-23 09:39:28 +02:00
parent 0df3a96fa6
commit 3b479af9c4
2 changed files with 9 additions and 11 deletions

View File

@ -262,10 +262,6 @@ namespace WellGroupHelpers
}
}
for (const std::string& wellName : group.wells()) {
const auto& wellTmp = schedule.getWell(wellName, reportStepIdx);
@ -734,7 +730,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, false);
const double total_guide_rate = guideRateSum(parent_group, always_included_child);
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;
@ -747,20 +743,20 @@ namespace WellGroupHelpers
return schedule_.getGroup(name, report_step_).parent();
}
}
double FractionCalculator::guideRateSum(const Group& group, const std::string& always_included_child, const bool include_all)
double FractionCalculator::guideRateSum(const Group& group, const std::string& always_included_child)
{
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 || include_all) {
if (included) {
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 || include_all) {
if (included) {
total_guide_rate += guideRate(child_well, always_included_child);
}
}
@ -778,7 +774,7 @@ namespace WellGroupHelpers
// We are a group, with default guide rate.
// Compute guide rate by accumulating our children's guide rates.
const Group& group = schedule_.getGroup(name, report_step_);
return guideRateSum(group, always_included_child, false);
return guideRateSum(group, always_included_child);
}
} else {
// No group-controlled subordinate wells.
@ -1169,7 +1165,9 @@ namespace WellGroupHelpers
// calculation of reductions.
const int num_gr_ctrl = groupControlledWells(schedule, wellState, reportStepIdx, chain[ii + 1], "");
if (num_gr_ctrl == 0) {
target += localReduction(chain[ii + 1]);
if (guideRate->has(chain[ii + 1])) {
target += localReduction(chain[ii + 1]);
}
}
}
target *= localFraction(chain[ii + 1]);

View File

@ -302,7 +302,7 @@ namespace WellGroupHelpers
private:
std::string parent(const std::string& name);
double guideRateSum(const Group& group, const std::string& always_included_child, const bool include_all);
double guideRateSum(const Group& group, 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);
GuideRate::RateVector getGroupRateVector(const std::string& group_name);