Skip to content

[test] different approach - #7337

Draft
GitPaean wants to merge 6 commits into
OPM:masterfrom
GitPaean:network-thp-fixes
Draft

[test] different approach#7337
GitPaean wants to merge 6 commits into
OPM:masterfrom
GitPaean:network-thp-fixes

Conversation

@GitPaean

Copy link
Copy Markdown
Member

No description provided.

@GitPaean GitPaean added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Aug 20, 2026
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

@GitPaean

GitPaean commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

https://ci.opm-project.org/job/opm-simulators-PR-builder/10467/

@GitPaean

Copy link
Copy Markdown
Member Author

The regression for this case is the same with OPM/opm-common#5298 and #7333 for the same reason.

@GitPaean
GitPaean force-pushed the network-thp-fixes branch 3 times, most recently from 5cef09c to 1e904ac Compare August 21, 2026 10:31
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refines well-control handling and preserves network-imposed THP limits across network detachment and state restoration.

Changes:

  • Removes redundant trivial-group-target state.
  • Prevents network THP control without a VFP table.
  • Tracks and restores network-imposed THP limits.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
WellInterface_impl.hpp Removes trivial-target bookkeeping.
WellConstraints.cpp Relies on zero-rate early returns.
SingleWellState.hpp Removes obsolete serialized state.
SingleWellState.cpp Removes initialization and equality handling.
BlackoilWellModelNetworkGeneric.hpp Adds persistent THP-limit maps.
BlackoilWellModelNetworkGeneric.cpp Applies, retains, and clears network THP limits.
Suppressed comments (1)

opm/simulators/wells/BlackoilWellModelNetworkGeneric.hpp:148

  • This new persistent state is not reconstructed by the file-restart path: setFromRestart() restores only node pressures, and assignNodeAndBranchValues() emits values only for wells currently belonging to network-node groups. Therefore, after restarting a case where a well was already detached, this map is empty and the retained THP limit is lost, changing the continuation result. Persist or reconstruct the per-well imposed limits in the ECL restart path.
    // The latest THP limit the network imposed on each well. A well that is
    // detached from the network keeps its network-imposed THP limit until new
    // production controls are specified for it (matching Eclipse behavior).
    std::map<std::string, Scalar> network_imposed_thp_limits_;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread opm/simulators/wells/BlackoilWellModelNetworkGeneric.cpp
Comment thread opm/simulators/wells/BlackoilWellModelNetworkGeneric.hpp
@GitPaean
GitPaean requested a balanced review from Copilot August 22, 2026 21:43
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

opm/simulators/wells/BlackoilWellModelNetworkGeneric.cpp:359

  • The added test only verifies that these maps survive serialization. None of the behavioral branches introduced here are covered: retaining a limit after detachment, clearing it on a production update (including ACTIONX), restoring it after a failed step, and skipping wells without VFP tables. Please add focused regression coverage for these state transitions; otherwise failures such as clearing the limit for unrelated ACTIONX well updates remain undetected.
            well.setDynamicThpLimit(it->second);
            network_imposed_thp_limits_[well.name()] = it->second;

Comment thread opm/simulators/wells/BlackoilWellModelGeneric.cpp Outdated
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

A production well attached to an extended-network node but with a
defaulted VFP table cannot translate the nodal pressure into a BHP
limit. Imposing the dynamic THP limit made wellHasTHPConstraints()
return true and the following VFP evaluation aborted the run with
"Nonexistent VFP table 0 referenced". Matching Eclipse, such wells now
stay on their rate controls while their rates still contribute to the
network flows and the nodal pressure.

Also keep the last network-imposed THP limit in force for wells
detached from the network, e.g. moved to a non-network group with
WELSPECS, until new production controls are specified for the well.
The limits are stored in BlackoilWellModelNetworkGeneric and dropped
on a PRODUCTION_UPDATE event.
activeProductionConstraint() skipped the switch to THP control for
GRUP-controlled wells when ws.trivial_group_target was set. That flag
is only rewritten in updateWellStateWithTarget() when a well switches
control, so it can go stale - it is set at the initial ORAT->GRUP
switch while a sibling well still covers the whole group target - and
the veto then blocks the very switch that would refresh it. Network
wells could therefore keep flowing with a THP below the nodal pressure
of the node they feed, which Eclipse never does.

Both call paths into checkIndividualConstraints() already return early
for wells whose freshly evaluated group target is zero
(stoppedOrZeroRateTarget() and wellUnderZeroRateTarget()), so the veto
could only ever act on stale information and is removed.
The preceding commit removed the only reader of this flag, leaving
write-only state that was still computed, serialized and compared.
Wells with a trivial group rate target are recognised on demand by
stoppedOrZeroRateTarget() and wellUnderZeroRateTarget().

The else branch of the rate scaling only existed to set the flag and
goes with it; the scaling itself is unchanged.
Production controls specified through ACTIONX are applied to the
affected wells by updateEclWellsConstraints() without waiting for the
next report step. Forget any THP limit the network has imposed on
such a well and reset the dynamic THP limit of the live well object
there as well, so that a well detached from the network does not keep
a stale network-imposed THP limit after new production controls are
specified. The entries are also erased from the last-valid state
since schedule changes survive retried time steps. A well that is
still attached to a network node receives a fresh limit at the next
network balance.
Populate the current and last-valid network-imposed THP limit maps
with distinct entries in the serialization test fixture, so that
omitting or reordering either field in the serialization would be
detected by the round-trip test.
An action can update a well without changing its production controls,
for instance a pure WELOPEN. Gate the invalidation of the
network-imposed THP limit on a PRODUCTION_UPDATE event being recorded
for the well at the current report step - the same criterion used at
report step initialization - so that updates which leave the
production controls untouched keep the retained limit of a well
detached from the network.
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants