Updating equality operator and update network computation tests to new return signature.

This commit is contained in:
Vegard Kippe committed 2026-06-05 17:51:43 +02:00
1 parent 2ed88b7a32
commit fbd5ac34ff
3 files changed
+9 -7

No files matched your search

@@ -372,7 +372,9 @@ operator==(const BlackoilWellModelNetworkGeneric<Scalar,IndexTraits>& rhs) const
return
this->active_ == rhs.active_
&& this->node_pressures_ == rhs.node_pressures_
&& this->last_valid_node_pressures_ == rhs.last_valid_node_pressures_;
&& this->last_valid_node_pressures_ == rhs.last_valid_node_pressures_
&& this->branch_data_ == rhs.branch_data_
&& this->last_valid_branch_data_ == rhs.last_valid_branch_data_;
}
template class BlackoilWellModelNetworkGeneric<double, BlackOilDefaultFluidSystemIndices>;
@@ -291,7 +291,7 @@ private:
const std::map<std::string, std::vector<Scalar>>& node_inflows)
{
for (const auto& node : root_to_child_nodes) {
// Do no traverse subtree more than once
// Do not traverse subtree more than once
if (node_pressures_.find(node) != node_pressures_.end()) {
continue;
}
@@ -304,13 +304,13 @@ private:
if (terminal_pressure) {
node_pressures_[node] = *terminal_pressure;
if (upbranch) {
// If terminal pressure is specified on a non-root node, we still want to calculate the branch data for the uptree branch, but we set the pressure drop to zero since the terminal pressure overrides the VFP calculation.
// If terminal pressure is specified on a non-root node, we still want to calculate the branch data for the uptree branch.
const Scalar up_press = node_pressures_[(*upbranch).uptree_node()];
auto rates = node_inflows.at(node);
Calc::prepareRates(rates);
branch_data_.emplace(node, data::BranchData{*terminal_pressure - up_press, -rates[IndexTraits::oilPhaseIdx], -rates[IndexTraits::waterPhaseIdx], -rates[IndexTraits::gasPhaseIdx]});
} else {
// Root node with terminal pressure and no uptree branch, so no branch data.
// Root node with terminal pressure and no uptree branch, inserting a zero-valued placeholder.
branch_data_.emplace(node, data::BranchData{0.0, 0.0, 0.0, 0.0});
}
continue;
+3 -3
View File
@@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE(gas_injection_pressure_computation)
// Test using mock setup.
NetworkPressureComputation<MockWellModel, VFPInjProperties<double>, Comm> comp(
s.well_model, s.network, s.vfp_inj_props, UnitSystem {}, 0, Comm{});
const auto pressures = comp.run();
const auto [pressures, branch_data] = comp.run();
BOOST_REQUIRE(pressures.find("G1") != pressures.end());
const auto expected_pressure = convert::from(463.483, bars);
BOOST_CHECK_CLOSE(pressures.at("G1"), expected_pressure, 1e-7);
@@ -355,7 +355,7 @@ BOOST_AUTO_TEST_CASE(water_injection_pressure_computation)
using Comm = Dune::Communication<int>;
NetworkPressureComputation<MockWellModel, VFPInjProperties<double>, Comm> comp(
s.well_model, s.network, s.vfp_inj_props, UnitSystem {}, 0, Comm{});
const auto pressures = comp.run();
const auto [pressures, branch_data] = comp.run();
BOOST_REQUIRE(pressures.find("G1") != pressures.end());
const auto expected_pressure = convert::from(150.488, bars);
BOOST_CHECK_CLOSE(pressures.at("G1"), expected_pressure, 1e-7);
@@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(production_pressure_computation)
using Comm = Dune::Communication<int>;
NetworkPressureComputation<MockWellModel, VFPProdProperties<double>, Comm> comp(
s.well_model, s.network, s.vfp_prod_props, UnitSystem {}, 0, Comm{});
const auto pressures = comp.run();
const auto [pressures, branch_data] = comp.run();
BOOST_REQUIRE(pressures.find("G1") != pressures.end());
const auto expected_pressure = convert::from(31.0, bars);
BOOST_CHECK_CLOSE(pressures.at("G1"), expected_pressure, 1e-7);