Skip to content

Treat near-zero rate targets as zero targets - #7733

Open
vkip wants to merge 1 commit into
OPM:masterfrom
vkip:fix-near-zero-rate-targets
Open

vkip wants to merge 1 commit into
OPM:masterfrom
vkip:fix-near-zero-rate-targets

Conversation

@vkip

@vkip vkip commented Nov 23, 2026

Copy link
Copy Markdown
Member

A rate given by a UDA that evaluates to zero, a negative value or an undefined UDQ (e.g. in the first time step after a restart, before the UDQ has been evaluated) is set to a very small positive value instead of zero, since a zero rate means a defaulted rate, i.e. no limit. The zero target checks for wells compared the target exactly with zero, so such a target was treated as a regular rate target. A well under group control with such a target was then allowed to switch controls, could switch to THP control at zero rate, fail to find an operable solution, and end up being shut as not operable.

Rate targets with a magnitude below 1e-20 (SI units) are now treated as zero targets, both for individual rate controls and for group targets.

Also, in estimateOperableBhp(), do not solve the well for a bhp below its bhp limit. The minimum bhp of the VFP curve can be far below the bhp limit, even negative, giving a bhp for which the well equations can not be solved.

A rate given by a UDA that evaluates to zero, a negative value or an
undefined UDQ (e.g. in the first time step after a restart, before the
UDQ has been evaluated) is set to a very small positive value instead
of zero, since a zero rate means a defaulted rate, i.e. no limit. The
zero target checks for wells compared the target exactly with zero, so
such a target was treated as a regular rate target. A well under group
control with such a target was then allowed to switch controls, could
switch to THP control at zero rate, fail to find an operable solution,
and end up being shut as not operable.

Rate targets with a magnitude below 1e-20 (SI units) are now treated as
zero targets, both for individual rate controls and for group targets.

Also, in estimateOperableBhp(), do not solve the well for a bhp below
its bhp limit. The minimum bhp of the VFP curve can be far below the bhp
limit, even negative, giving a bhp for which the well equations can not
be solved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vkip vkip added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Nov 23, 2026
@vkip
vkip requested a balanced review from Copilot November 23, 2026 14:34

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.

🟢 Approval recommended

No active review issues remain for the near-zero well-control handling changes.

No open issues 🎉

What changed in this PR

This PR updates Flow’s well-control checks so near-zero rate targets, including tiny positive values produced by user-defined arguments, are treated as zero. This helps prevent unintended control switching and wells being shut as inoperable.

Changes:

  • Adds a shared near-zero predicate and applies it to individual and group rate-target checks.
  • Keeps the estimated operable bottom-hole pressure at or above the well’s pressure limit.
  • Adds and registers unit tests for near-zero targets and production/injection controls.
File Description
tests/​test_wellhelpers.cpp Tests near-zero detection and production/injection rate checks.
opm/​simulators/​wells/​WellInterfaceFluidSystem.cpp Uses near-zero detection for injection group targets.
opm/​simulators/​wells/​WellInterface_impl.hpp Bounds the operable pressure estimate by the well’s pressure limit.
opm/​simulators/​wells/​WellHelpers.hpp Defines the shared SI-rate predicate with a 1e-20 tolerance.
opm/​simulators/​wells/​WellHelpers.cpp Applies the predicate to individual rate-control checks.
opm/​simulators/​wells/​WellGroupControls.cpp Treats near-zero production group targets as zero.
CMakeLists_files.cmake Registers the new well-helper unit test.

Review effort: Balanced

@vkip
vkip marked this pull request as ready for review November 23, 2026 14:40
@vkip

vkip commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

This branch has not been deployed

No deployments
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