From 0312190f7d26dc0a4c4f0b1d0c2de8379044a37d Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 16 Jan 2017 11:15:22 +0100 Subject: [PATCH] adding canProdueMore() function to wellsGroup to indicate whether the group can produce more to match the group target when they are not producing enough compared with the group target. --- opm/core/wells/WellsGroup.cpp | 29 +++++++++++++++++++++++++---- opm/core/wells/WellsGroup.hpp | 8 ++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 75873a3d4..5419e9fc9 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -820,6 +820,17 @@ namespace Opm // do nothing } + + bool WellsGroup::canProduceMore() const + { + for (const std::shared_ptr& child_node : children_) { + if (child_node->canProduceMore()) { + return true; + } + } + return false; + } + double WellsGroup::getProductionRate(const std::vector& well_rates, const ProductionSpecification::ControlMode prod_mode) const { @@ -1504,7 +1515,8 @@ namespace Opm - double WellNode::getAccumulativeEfficiencyFactor() const { + double WellNode::getAccumulativeEfficiencyFactor() const + { // TODO: not sure whether a well can be exempted from repsponding to the efficiency factor // for the parent group. double efficiency_factor = efficiencyFactor(); @@ -1518,18 +1530,27 @@ namespace Opm } - int WellNode::selfIndex() const { + int WellNode::selfIndex() const + { return self_index_; } - bool WellNode::targetUpdated() const { + bool WellNode::targetUpdated() const + { return target_updated_; } - void WellNode::setTargetUpdated(const bool flag) { + void WellNode::setTargetUpdated(const bool flag) + { target_updated_ = flag; } + + bool WellNode::canProduceMore() const + { + return (isProducer() && !individualControl()); + } + } diff --git a/opm/core/wells/WellsGroup.hpp b/opm/core/wells/WellsGroup.hpp index 057f71515..f1dbd927c 100644 --- a/opm/core/wells/WellsGroup.hpp +++ b/opm/core/wells/WellsGroup.hpp @@ -235,6 +235,10 @@ namespace Opm virtual void setTargetUpdated(const bool flag) = 0; + // bascially, for the group or wells under group control + // they have the potential to adjust their targets to produce more to match the higher level target + virtual bool canProduceMore() const = 0; + double efficiencyFactor() const; void setEfficiencyFactor(const double efficiency_factor); @@ -369,6 +373,8 @@ namespace Opm virtual double getProductionRate(const std::vector& well_rates, const ProductionSpecification::ControlMode prod_mode) const; + virtual bool canProduceMore() const; + private: std::vector > children_; }; @@ -497,6 +503,8 @@ namespace Opm virtual void setTargetUpdated(const bool flag); + virtual bool canProduceMore() const; + private: Wells* wells_; int self_index_;