Merge pull request #4915 from vkip/network_multi_root

Support computation of network pressures in networks with multiple roots
This commit is contained in:
Kai Bao 2023-11-13 14:39:07 +01:00 committed by GitHub
commit bbdad520d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -788,6 +788,9 @@ namespace WellGroupHelpers
return {};
}
std::map<std::string, double> node_pressures;
auto roots = network.roots();
for (const auto& root : roots) {
// Fixed pressure nodes of the network are the roots of trees.
// Leaf nodes must correspond to groups in the group structure.
// Let us first find all leaf nodes of the network. We also
@ -796,7 +799,8 @@ namespace WellGroupHelpers
std::stack<std::string> children;
std::set<std::string> leaf_nodes;
std::vector<std::string> root_to_child_nodes;
children.push(network.root().name());
//children.push(network.root().name());
children.push(root.get().name());
while (!children.empty()) {
const auto node = children.top();
children.pop();
@ -860,7 +864,7 @@ namespace WellGroupHelpers
// Going the other way (from roots to leafs), calculate the pressure
// at each node using VFP tables and rates.
std::map<std::string, double> node_pressures;
//std::map<std::string, double> node_pressures;
for (const auto& node : root_to_child_nodes) {
auto press = network.node(node).terminal_pressure();
if (press) {
@ -901,7 +905,7 @@ namespace WellGroupHelpers
}
}
}
}
return node_pressures;
}