Merge pull request #5919 from vkip/network_empty_leaf_nodes

Allow empty leaf nodes that do not exist in GRUPTREE
This commit is contained in:
Kai Bao 2025-01-28 10:05:04 +01:00 committed by GitHub
commit ff29f04cdb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -920,7 +920,14 @@ computeNetworkPressures(const Network::ExtNetwork& network,
// Starting with the leaf nodes of the network, get the flow rates
// from the corresponding groups.
std::map<std::string, std::vector<Scalar>> node_inflows;
const std::vector<Scalar> zero_rates(3, 0.0);
for (const auto& node : leaf_nodes) {
// Guard against empty leaf nodes (may not be present in GRUPTREE)
if (!group_state.has_production_rates(node)) {
node_inflows[node] = zero_rates;
continue;
}
node_inflows[node] = group_state.production_rates(node);
// Add the ALQ amounts to the gas rates if requested.
if (network.node(node).add_gas_lift_gas()) {