Skip to content

Add tests and fix autochoke group target rate#6835

Merged
totto82 merged 2 commits intoOPM:masterfrom
hakonhagland:test_autochoke_gtgt
Feb 19, 2026
Merged

Add tests and fix autochoke group target rate#6835
totto82 merged 2 commits intoOPM:masterfrom
hakonhagland:test_autochoke_gtgt

Conversation

@hakonhagland
Copy link
Copy Markdown
Contributor

Builds on #6833 which should be merged first.

Adds two tests and fixes autochoke group target rate:

Tests (commit 1)

  • Add two test cases for getAutoChokeGroupProductionTargetRate():
    • TestAutoChokeGroupProductionTargetRate: normal case with autochoke group under intermediate group that has a guide rate. Verifies the autochoke reduction loop produces the same result as applyReductionsAndFractions_() when both are applicable.
    • TestAutoChokeGroupTargetRateWithUnderperformance: uses a new network data file with NODEPROP (as_choke=YES) and lower well rates to naturally trigger underperformance detection. Verifies the correct target rate with local_reduction_level gating.

Bug fix and cleanup (commit 2)

  • Add local_reduction_level gating to the autochoke target loop in getAutoChokeGroupProductionTargetRate(), preventing double-counting of reductions at intermediate groups with group-controlled-wells count of zero.

  • Remove getGuideRate() from GroupStateHelper: the group path is dead code (only caller was isAutoChokeGroupUnderperforming_() which now uses guide_rate_ directly), and the well path is inlined into FractionCalculator::guideRate().

  • Improve isAutoChokeGroupUnderperforming_() to compute the control group guide rate as the sum of its FLD children's guide rates (matching how targets are distributed), and accumulate efficiency factors from the autochoke group up to the control group. This makes the formula correct for the common case where the control group is the immediate parent with no reductions.

@hakonhagland hakonhagland added the manual:bugfix This PR is a bug fix and should be noted in the manual label Feb 17, 2026
@hakonhagland
Copy link
Copy Markdown
Contributor Author

jenkins build this serial please

@hakonhagland hakonhagland marked this pull request as draft February 17, 2026 11:09
@hakonhagland
Copy link
Copy Markdown
Contributor Author

Putting this in draft mode until #6833 has been merged

Add two test cases for getAutoChokeGroupProductionTargetRate():

- TestAutoChokeGroupProductionTargetRate: normal case with
  MANI (autochoke, FLD) under intermediate group PLAT that
  has a guide rate. Verifies the autochoke reduction loop
  produces the same result as applyReductionsAndFractions_()
  when both are applicable.

- TestAutoChokeGroupTargetRateDoubleCountingBug: uses a
  NETWORK DATA file with NODEPROP (as_choke=YES) and lower
  well rates to naturally trigger underperformance detection
  (GCW=0). Documents the double-counting bug where missing
  local_reduction_level gating causes reductions to be
  subtracted at both FIELD and PLAT, producing a clamped-
  to-zero target instead of the correct value.

Also adds GROUP_HIGHER_CONSTRAINTS_NETWORK.DATA with
BRANPROP/NODEPROP keywords and parameterizes the test
fixture with mani2_control, data_file, and well rates.
Add local_reduction_level gating to the autochoke target
loop in getAutoChokeGroupProductionTargetRate(), preventing
double-counting of reductions at intermediate groups with
group-controlled-wells count of zero.

Remove getGuideRate() from GroupStateHelper: the group path
is dead code (only caller was isAutoChokeGroupUnderperforming_
which now uses guide_rate_ directly), and the well path is
inlined into FractionCalculator::guideRate().

Improve isAutoChokeGroupUnderperforming_() to compute the
control group guide rate as the sum of its FLD children's
guide rates (matching how targets are distributed), and
accumulate efficiency factors from the autochoke group up
to the control group. This makes the formula correct for
the common case where the control group is the immediate
parent with no reductions.

Rename getLocalReductionLevel_ to getLocalReductionLevel
and make it public, as it is now called from
WellGroupControls.cpp.

Update test to verify the corrected target rate and remove
references to the now-fixed double-counting issue.
@hakonhagland
Copy link
Copy Markdown
Contributor Author

jenkins build this serial please

@hakonhagland hakonhagland marked this pull request as ready for review February 17, 2026 14:50
@totto82
Copy link
Copy Markdown
Member

totto82 commented Feb 19, 2026

Thanks for the tests and the fix for the autochoke code. Especially the first test would be useful to ensure fixes in the main loop are carried over to the autochoke code.

@totto82 totto82 merged commit fa509b2 into OPM:master Feb 19, 2026
2 checks passed
@hakonhagland
Copy link
Copy Markdown
Contributor Author

@totto82 Thanks for the review!

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

Labels

manual:bugfix This PR is a bug fix and should be noted in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants