functions for indicating injection and production upating.

it is for WellCollection, which is logically wrong. It should be done in
the group level, while things will be different for multi-level groups.

The current implementation basically works for current needs, that we
only have one group.
This commit is contained in:
Kai Bao 2016-10-07 14:54:53 +02:00
parent 86e41a8937
commit df745bafef
2 changed files with 39 additions and 7 deletions

View File

@ -193,22 +193,51 @@ namespace Opm
//TODO: later, it should be extended to update group targets
bool WellCollection::needUpdateWellTargets() const
{
return needUpdateInjectionTargets() || needUpdateProductionTargets();
}
bool WellCollection::needUpdateInjectionTargets() const
{
bool any_group_control_node = false;
bool any_should_update_node = false;
for (size_t i = 0; i < leaf_nodes_.size(); ++i) {
std::cout << " well " << leaf_nodes_[i]->name() << " under group control ? " << !leaf_nodes_[i]->individualControl() << " should update well target? " << leaf_nodes_[i]->shouldUpdateWellTargets() << std::endl;
if (leaf_nodes_[i]->shouldUpdateWellTargets()) {
any_should_update_node = true;
}
if (!leaf_nodes_[i]->individualControl()) {
any_group_control_node = true;
if (leaf_nodes_[i]->isInjector()) {
if (leaf_nodes_[i]->shouldUpdateWellTargets()) {
any_should_update_node = true;
}
if (leaf_nodes_[i]->individualControl()) {
any_group_control_node = true;
}
}
}
std::cout << " any_group_control_node " << any_group_control_node << " any_should_update_node " << any_should_update_node << std::endl;
return (any_group_control_node && any_should_update_node);
}
bool WellCollection::needUpdateProductionTargets() const {
bool any_group_control_node = false;
bool any_should_update_node = false;
for (size_t i = 0; i < leaf_nodes_.size(); ++i) {
if (leaf_nodes_[i]->isProducer()) {
if (leaf_nodes_[i]->shouldUpdateWellTargets()) {
any_should_update_node = true;
}
if (leaf_nodes_[i]->individualControl()) {
any_group_control_node = true;
}
}
}
return (any_group_control_node && any_should_update_node);
}
const size_t WellCollection::numNode() const
{

View File

@ -117,6 +117,9 @@ namespace Opm
/// strategy might be required.
bool needUpdateWellTargets() const;
bool needUpdateInjectionTargets() const;
bool needUpdateProductionTargets() const;
const size_t numNode() const;
WellNode* getNode(size_t i) const;