adding target_updated_ flag to WellNode
to save some repeated efforts when updating Well Targets.
This commit is contained in:
parent
55eec0b2ed
commit
bf2f9b3f06
@ -294,13 +294,18 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
|
||||
// set the target_updated to be false
|
||||
for (WellNode* well_node : leaf_nodes_) {
|
||||
well_node->setTargetUpdated(false);
|
||||
}
|
||||
|
||||
// TODO: currently, we only handle the level of the well groups for the moment, i.e. the level just above wells
|
||||
// We believe the relations between groups are similar to the relations between different wells inside the same group.
|
||||
// While there will be somre more complication invloved for sure.
|
||||
for (size_t i = 0; i < leaf_nodes_.size(); ++i) {
|
||||
// find a node needs to update targets, then update targets for all the wellls inside the group.
|
||||
// if (leaf_nodes_[i]->shouldUpdateWellTargets() && !leaf_nodes_[i]->individualControl()) {
|
||||
if (!leaf_nodes_[i]->individualControl()) {
|
||||
if (!leaf_nodes_[i]->individualControl() && !leaf_nodes_[i]->targetUpdated()) {
|
||||
WellsGroupInterface* parent_node = leaf_nodes_[i]->getParent();
|
||||
// update the target within this group.
|
||||
if (leaf_nodes_[i]->isProducer()) {
|
||||
|
@ -792,6 +792,7 @@ namespace Opm
|
||||
if (!children_[i]->individualControl() && children_[i]->isProducer()) {
|
||||
const double children_guide_rate = children_[i]->productionGuideRate(true);
|
||||
children_[i]->applyProdGroupControl(prod_mode, (children_guide_rate / my_guide_rate) * rate_for_group_control, true);
|
||||
children_[i]->setTargetUpdated(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -802,6 +803,11 @@ namespace Opm
|
||||
// Will finish it when having an examples with more than one injection wells within same injection group.
|
||||
}
|
||||
|
||||
void WellsGroup::setTargetUpdated(const bool /* flag */)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
bool WellsGroup::isProducer() const
|
||||
{
|
||||
@ -833,7 +839,8 @@ namespace Opm
|
||||
wells_(0),
|
||||
self_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
|
||||
{
|
||||
}
|
||||
|
||||
@ -1510,4 +1517,14 @@ namespace Opm
|
||||
return self_index_;
|
||||
}
|
||||
|
||||
|
||||
bool WellNode::targetUpdated() const {
|
||||
return target_updated_;
|
||||
}
|
||||
|
||||
|
||||
void WellNode::setTargetUpdated(const bool flag) {
|
||||
target_updated_ = flag;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -241,6 +241,8 @@ namespace Opm
|
||||
|
||||
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates) = 0;
|
||||
|
||||
virtual void setTargetUpdated(const bool flag) = 0;
|
||||
|
||||
double efficiencyFactor() const;
|
||||
|
||||
void setEfficiencyFactor(const double efficiency_factor);
|
||||
@ -370,6 +372,8 @@ namespace Opm
|
||||
|
||||
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates);
|
||||
|
||||
virtual void setTargetUpdated(const bool flag);
|
||||
|
||||
/// Whether it is a production well
|
||||
/// Should only appy for WellNode
|
||||
virtual bool isProducer() const;
|
||||
@ -505,11 +509,17 @@ namespace Opm
|
||||
|
||||
int selfIndex() const;
|
||||
|
||||
bool targetUpdated() const;
|
||||
|
||||
virtual void setTargetUpdated(const bool flag);
|
||||
|
||||
private:
|
||||
Wells* wells_;
|
||||
int self_index_;
|
||||
int group_control_index_;
|
||||
bool shut_well_;
|
||||
// TODO: used when updating well targets
|
||||
bool target_updated_;
|
||||
};
|
||||
|
||||
/// Creates the WellsGroupInterface for the given well
|
||||
|
Loading…
Reference in New Issue
Block a user