adding flag to tell when using well potential for guide rate

for WellNode.
This commit is contained in:
Kai Bao 2017-04-07 10:59:46 +02:00
parent 29372e287c
commit e77f726906
7 changed files with 41 additions and 4 deletions

View File

@ -34,7 +34,7 @@ namespace Opm
BHP_limit_(-1e100), BHP_limit_(-1e100),
reinjection_fraction_target_(1), reinjection_fraction_target_(1),
voidage_replacment_fraction_(1), voidage_replacment_fraction_(1),
guide_rate_(1.0), guide_rate_(-1.0),
guide_rate_type_(NONE_GRT) guide_rate_type_(NONE_GRT)
{ {

View File

@ -36,7 +36,7 @@ namespace Opm
liquid_max_rate_(-1e100), liquid_max_rate_(-1e100),
reservoir_flow_max_rate_(-1e100), reservoir_flow_max_rate_(-1e100),
BHP_limit_(-1e100), BHP_limit_(-1e100),
guide_rate_(1.0), guide_rate_(-1.0),
guide_rate_type_(NONE_GRT) guide_rate_type_(NONE_GRT)
{ {
} }

View File

@ -482,4 +482,15 @@ namespace Opm
} // end of for (int w = 0; w < nw; ++w) } // end of for (int w = 0; w < nw; ++w)
} }
bool WellCollection::requireWellPotentials() const
{
for (const auto& well_node : leaf_nodes_) {
if (well_node->isGuideRateWellPotential()) {
return true;
}
}
return false;
}
} }

View File

@ -155,6 +155,9 @@ namespace Opm
const PhaseUsage& phase_usage, const PhaseUsage& phase_usage,
const std::vector<double>& well_potentials) const; const std::vector<double>& well_potentials) const;
bool requireWellPotentials() const;
private: private:
// To account for the possibility of a forest // To account for the possibility of a forest
std::vector<std::shared_ptr<WellsGroupInterface> > roots_; std::vector<std::shared_ptr<WellsGroupInterface> > roots_;

View File

@ -921,7 +921,8 @@ namespace Opm
self_index_(-1), self_index_(-1),
group_control_index_(-1), group_control_index_(-1),
shut_well_(true), // This is default for now shut_well_(true), // This is default for now
target_updated_(false) // This is default for now, not sure whether to use the default value target_updated_(false), // This is default for now, not sure whether to use the default value
is_guiderate_wellpotential_(false)
{ {
} }
@ -1651,6 +1652,18 @@ namespace Opm
} }
bool WellNode::isGuideRateWellPotential() const
{
return is_guiderate_wellpotential_;
}
void WellNode::setIsGuideRateWellPotential(const bool flag)
{
is_guiderate_wellpotential_ = flag;
}
bool WellNode::canProduceMore() const bool WellNode::canProduceMore() const
{ {
return (isProducer() && !individualControl()); return (isProducer() && !individualControl());

View File

@ -514,6 +514,10 @@ namespace Opm
bool targetUpdated() const; bool targetUpdated() const;
bool isGuideRateWellPotential() const;
void setIsGuideRateWellPotential(const bool flag);
virtual void setTargetUpdated(const bool flag); virtual void setTargetUpdated(const bool flag);
virtual bool canProduceMore() const; virtual bool canProduceMore() const;
@ -527,6 +531,10 @@ namespace Opm
bool shut_well_; bool shut_well_;
// TODO: used when updating well targets // TODO: used when updating well targets
bool target_updated_; bool target_updated_;
// whether the guide rate is specified with well potential
// TODO: we have never handle the guide rates for groups, maybe this
// is something will go to WellsGroupInterface later
bool is_guiderate_wellpotential_;
}; };
/// Creates the WellsGroupInterface for the given well /// Creates the WellsGroupInterface for the given well

View File

@ -748,7 +748,7 @@ namespace Opm
WellNode& wellnode = *well_collection_.getLeafNodes()[wix]; WellNode& wellnode = *well_collection_.getLeafNodes()[wix];
// TODO: looks like only handling OIL phase guide rate for producers // TODO: looks like only handling OIL phase guide rate for producers
if (well->getGuideRatePhase(timeStep) != GuideRate::UNDEFINED) { if (well->getGuideRatePhase(timeStep) != GuideRate::UNDEFINED && well->getGuideRate(timeStep) >= 0.) {
if (well_data[wix].type == PRODUCER) { if (well_data[wix].type == PRODUCER) {
wellnode.prodSpec().guide_rate_ = well->getGuideRate(timeStep); wellnode.prodSpec().guide_rate_ = well->getGuideRate(timeStep);
if (well->getGuideRatePhase(timeStep) == GuideRate::OIL) { if (well->getGuideRatePhase(timeStep) == GuideRate::OIL) {
@ -768,6 +768,8 @@ namespace Opm
} else { } else {
OPM_THROW(std::runtime_error, "Unknown well type " << well_data[wix].type << " for well " << well->name()); OPM_THROW(std::runtime_error, "Unknown well type " << well_data[wix].type << " for well " << well->name());
} }
} else {
wellnode.setIsGuideRateWellPotential(true);
} }
} }
} }