Repository navigation
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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
marked this pull request as ready for review
November 23, 2026 14:40
Member
Author
|
jenkins build this please |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.