Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5fc072b
Update injection network leaf node rates.
Jun 4, 2026
0cc984c
Add anyNetworkActive() and activeNetworks() helpers.
Jun 12, 2026
185547c
Make updateActiveState() honor injection networks.
Jun 12, 2026
4b1914b
Check active status of all networks.
Jun 12, 2026
ae06788
WIP stage 1
Jul 31, 2026
c640272
Check well VFP table before setting dynamic THP limit.
Jul 31, 2026
d37fb8e
Check correct rates storage for empty leaf node guard.
Jul 31, 2026
3712b32
Suggestions from copilot
Aug 4, 2026
658cd17
More copilot.
Aug 6, 2026
a926d01
Do not extrapolate VFP tables for network branches
hnil Aug 17, 2026
0e9b4ef
Bracketing update of network node pressures; fix injector coupling
hnil Aug 17, 2026
dbd02dc
Do not shut an injector that cannot operate at the network THP
hnil Aug 17, 2026
aea2944
Store injection network leaf rates per phase
hnil Aug 17, 2026
94491bd
Export injection network node/branch values for GPRG / GPRW
hnil Aug 17, 2026
ca9801f
Restrict the bracketing node-pressure update to injection networks by…
hnil Aug 17, 2026
79d0926
Add GNETINJE_GAS-01 / GNETINJE_WAT-01 regression tests; GNETINJE is s…
hnil Aug 17, 2026
fd4c0f7
Re-solve the production network before the injection networks
hnil Aug 18, 2026
f4f2f1f
Optional Anderson acceleration of the network pressures (off; does no…
hnil Aug 18, 2026
66e5d71
Optional well-index proxy for the network balance (off; does not help…
hnil Aug 18, 2026
032235e
Add a standalone bench for the injection-network solve
hnil Aug 18, 2026
8580c98
Test globalisation in the network bench
hnil Aug 19, 2026
e66b175
Add the full network formulation to the bench, next to the eliminated…
hnil Aug 19, 2026
f147477
Bench: table limits as bounds, a group multiplier, and a case you can…
hnil Aug 19, 2026
36ce497
Bench: build a case from a deck, with the operating point set or read
hnil Aug 19, 2026
ca91ffe
Bench: run the full formulation across both test cases
hnil Aug 19, 2026
a4f5d85
Move the full network formulation into the library
hnil Aug 19, 2026
6455d6d
Solve the injection networks simultaneously, behind --network-solver=…
hnil Aug 19, 2026
5b60da4
Analytic network Jacobian and network group control, both opt in
hnil Aug 19, 2026
faef691
Take network guide rates from well potential, not from the current rate
hnil Aug 19, 2026
12c1424
Build the network solve from data every rank has
hnil Aug 19, 2026
96e196c
Say why the network solve handed back to the relaxed update
hnil Aug 19, 2026
22576bf
Report why a network solve stopped, and record the active set
hnil Aug 19, 2026
fa1f36c
Cover the guide-refresh path in the bench, and rule it out on its own
hnil Aug 20, 2026
78a5f16
Replay failed network solves in the bench, and fix what it found
hnil Aug 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ list (APPEND TEST_SOURCE_FILES
tests/test_milu.cpp
tests/test_multmatrixtransposed.cpp
tests/test_networkpressure.cpp
tests/test_networksolve.cpp
tests/test_nonnc.cpp
tests/test_norne_pvt.cpp
tests/test_OilSatfuncConsistencyChecks.cpp
Expand Down Expand Up @@ -1238,6 +1239,9 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/wells/BlackoilWellModelNetwork_impl.hpp
opm/simulators/wells/BlackoilWellModelNetworkGeneric.hpp
opm/simulators/wells/BlackoilWellModelNetworkPressureComputation.hpp
opm/simulators/wells/NetworkAndersonAcceleration.hpp
opm/simulators/wells/NetworkNodePressureUpdater.hpp
opm/simulators/wells/NetworkSystem.hpp
opm/simulators/wells/BlackoilWellModelNldd.hpp
opm/simulators/wells/BlackoilWellModelNldd_impl.hpp
opm/simulators/wells/BlackoilWellModelRescoup.hpp
Expand Down
35 changes: 35 additions & 0 deletions opm/simulators/flow/BlackoilModelParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ BlackoilModelParameters<Scalar>::BlackoilModelParameters()
rc_network_loose_coupling_ = Parameters::Get<Parameters::RcNetworkLooseCoupling>();
network_pressure_update_damping_factor_ = Parameters::Get<Parameters::NetworkPressureUpdateDampingFactor<Scalar>>();
network_max_pressure_update_in_bars_ = Parameters::Get<Parameters::NetworkMaxPressureUpdateInBars<Scalar>>();
network_pressure_update_secant_ = Parameters::Get<Parameters::NetworkPressureUpdateSecant>();
network_pressure_update_acceleration_ = Parameters::Get<Parameters::NetworkPressureUpdateAcceleration>();
network_anderson_depth_ = Parameters::Get<Parameters::NetworkAndersonDepth>();
network_well_proxy_ = Parameters::Get<Parameters::NetworkWellProxy>();
network_well_proxy_max_iterations_ = Parameters::Get<Parameters::NetworkWellProxyMaxIterations>();
network_solver_ = Parameters::Get<Parameters::NetworkSolver>();
network_analytic_jacobian_ = Parameters::Get<Parameters::NetworkAnalyticJacobian>();
network_group_control_ = Parameters::Get<Parameters::NetworkGroupControl>();
network_dump_failures_ = Parameters::Get<Parameters::NetworkDumpFailures>();
local_domains_ordering_ = domainOrderingMeasureFromString(Parameters::Get<Parameters::LocalDomainsOrderingMeasure>());
write_partitions_ = Parameters::Get<Parameters::DebugEmitCellPartition>();

Expand Down Expand Up @@ -276,6 +285,32 @@ void BlackoilModelParameters<Scalar>::registerParameters()
("Damping factor in the inner network pressure update iterations");
Parameters::Register<Parameters::NetworkMaxPressureUpdateInBars<Scalar>>
("Maximum pressure update in the inner network pressure update iterations");
Parameters::Register<Parameters::NetworkPressureUpdateAcceleration>
("Acceleration of the network node-pressure iteration, applied to the whole pressure "
"vector of a network instead of the per-node update: none or anderson");
Parameters::Register<Parameters::NetworkAndersonDepth>
("Number of past iterates kept by Anderson acceleration of the network pressures");
Parameters::Register<Parameters::NetworkWellProxy>
("Balance the injection networks against the wells' inflow-performance linearisation "
"(q = A - B*bhp) before re-solving the wells: none or ipr");
Parameters::Register<Parameters::NetworkWellProxyMaxIterations>
("Iteration cap for the inflow-performance network balance");
Parameters::Register<Parameters::NetworkSolver>
("How the injection networks are solved: fixedpoint relaxes the node pressures against "
"the wells, newton solves pressures and rates simultaneously and falls back to the "
"fixed point when it does not converge");
Parameters::Register<Parameters::NetworkAnalyticJacobian>
("Assemble the network Jacobian from the VFP table derivatives instead of differencing "
"the residual (--network-solver=newton only)");
Parameters::Register<Parameters::NetworkGroupControl>
("Let the network hold a group's injection total and place the split itself, so a well "
"that hits its own limit is taken up by the others (--network-solver=newton only)");
Parameters::Register<Parameters::NetworkDumpFailures>
("Path prefix for writing out each network system that fails to converge, for replay in "
"the standalone bench; empty disables it");
Parameters::Register<Parameters::NetworkPressureUpdateSecant>
("Networks whose node pressures use the bracketing/secant update in the inner network "
"iterations instead of the damped update: injection, all or none");
Parameters::Register<Parameters::NonlinearSolver>
("Choose nonlinear solver. Valid choices are newton or nldd.");
Parameters::Register<Parameters::LocalSolveApproach>
Expand Down
41 changes: 41 additions & 0 deletions opm/simulators/flow/BlackoilModelParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ template<class Scalar>
struct NetworkPressureUpdateDampingFactor { static constexpr Scalar value = 0.1; };
template<class Scalar>
struct NetworkMaxPressureUpdateInBars { static constexpr Scalar value = 5.0; };
struct NetworkPressureUpdateSecant { static constexpr auto value = "injection"; };
struct NetworkPressureUpdateAcceleration { static constexpr auto value = "none"; };
struct NetworkAndersonDepth { static constexpr int value = 4; };
struct NetworkWellProxy { static constexpr auto value = "none"; };
struct NetworkSolver { static constexpr auto value = "fixedpoint"; };
struct NetworkAnalyticJacobian { static constexpr bool value = false; };
struct NetworkGroupControl { static constexpr bool value = false; };
struct NetworkDumpFailures { static constexpr auto value = ""; };
struct NetworkWellProxyMaxIterations { static constexpr int value = 50; };
// Reservoir coupling: when false (default) the master exchanges node pressures
// and slave rates with the slaves once per master inner network sub-iteration
// (tight coupling). When true, the exchange happens only once per master outer network
Expand Down Expand Up @@ -358,6 +367,38 @@ struct BlackoilModelParameters
/// Maximum pressure update in the inner network pressure update iterations
Scalar network_max_pressure_update_in_bars_;

/// Which networks use the bracketing/secant node-pressure update in the inner network
/// iterations instead of the damped one: "injection" (default), "all" or "none"
std::string network_pressure_update_secant_;

/// Acceleration applied to the whole node-pressure vector of a network instead of the
/// per-node update: "none" (default) or "anderson"
std::string network_pressure_update_acceleration_;

/// Number of past iterates Anderson acceleration keeps
int network_anderson_depth_;

/// Balance the injection networks against the wells' well-index linearisation
/// before re-solving them: "none" (default) or "ipr"
std::string network_well_proxy_;

/// Iteration cap for that inner balance
int network_well_proxy_max_iterations_;

/// How the injection networks are solved: "fixedpoint" (default) relaxes the
/// node pressures against the wells; "newton" solves pressures and rates
/// simultaneously, falling back to the fixed point when it does not converge.
std::string network_solver_;

/// Assemble the network Jacobian from the VFP table derivatives.
bool network_analytic_jacobian_;

/// Let the network place the split of a group's injection total itself.
bool network_group_control_;

/// Path prefix for writing network systems that fail to converge; empty off.
std::string network_dump_failures_;

/// Reservoir coupling: use loose (per-outer-iteration) master/slave network
/// coupling instead of the default tight (per-sub-iteration) coupling.
bool rc_network_loose_coupling_;
Expand Down
1 change: 0 additions & 1 deletion opm/simulators/utils/UnsupportedFlowKeywords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords()
{"GINODE", {true, std::nullopt}},
{"GLIFTLIM", {true, std::nullopt}},
{"GNETDP", {true, std::nullopt}},
{"GNETINJE", {true, std::nullopt}},
{"GNETPUMP", {true, std::nullopt}},
{"GRADGRUP", {true, std::nullopt}},
{"GRADRESV", {true, std::nullopt}},
Expand Down
2 changes: 1 addition & 1 deletion opm/simulators/wells/BlackoilWellModelGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ groupAndNetworkData(const int reportStepIdx) const
auto grp_nwrk_values = data::GroupAndNetworkValues{};

this->assignGroupValues(reportStepIdx, grp_nwrk_values.groupData);
this->genNetwork_.assignNodeAndBranchValues(grp_nwrk_values.nodeData, grp_nwrk_values.branchData, grp_nwrk_values.convergedBranchData, reportStepIdx - 1); // Schedule state info at previous step
this->genNetwork_.assignNodeAndBranchValues(grp_nwrk_values, reportStepIdx - 1); // Schedule state info at previous step

return grp_nwrk_values;
}
Expand Down
22 changes: 22 additions & 0 deletions opm/simulators/wells/BlackoilWellModelNetwork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <opm/simulators/wells/BlackoilWellModelNetworkGeneric.hpp>

#include <optional>

#include <map>
#include <string>
#include <tuple>
Expand Down Expand Up @@ -66,6 +68,26 @@ class BlackoilWellModelNetwork :
void doPreStepRebalance(DeferredLogger& deferred_logger);

protected:
/// Balance the injection networks against the wells' well-index linearisation
/// (q = ipr_b*bhp - ipr_a, from the converged well Jacobian) instead of re-solving the
/// well equations, so a residual evaluation costs a handful of VFP lookups. Returns the
/// last imbalance. Experimental, off unless --network-well-proxy=ipr.
Scalar proxyBalance(const int episodeIdx,
const double dt,
const int max_iterations,
const Scalar damping_factor,
const Scalar max_pressure_update,
const bool use_secant,
const bool secant_production,
DeferredLogger& deferred_logger);

/// Rate this injector would take at its current THP constraint, from the well-index
/// linearisation alone. nullopt when it admits no solution there.
std::optional<Scalar>
proxyInjectionRate(WellInterface<TypeTag>& well,
const int phase_pos,
DeferredLogger& deferred_logger) const;

/// This function is to be used for well groups in an extended network that act as a subsea manifold
/// The wells of such group should have a common THP and total phase rate(s) obeying (if possible)
/// the well group constraint set by GCONPROD
Expand Down
Loading