Skip to content

Group private methods in GroupStateHelper header#6931

Draft
hakonhagland wants to merge 3 commits intoOPM:masterfrom
hakonhagland:refact_gshh
Draft

Group private methods in GroupStateHelper header#6931
hakonhagland wants to merge 3 commits intoOPM:masterfrom
hakonhagland:refact_gshh

Conversation

@hakonhagland
Copy link
Contributor

Builds on #6922.

  • Consolidate #ifdef blocks: Move all 6 reservoir coupling private method declarations from 4 scattered #ifdef RESERVOIR_COUPLING_ENABLED blocks into a single block at the end of the private section, separated by a // --- Reservoir coupling private methods --- comment
  • Improve readability: General private methods are listed first (alphabetically), followed by all RC-specific methods in one block — making it immediately clear which methods require MPI/reservoir coupling

The master's constraint calculator could propagate derived injection
cmodes (REIN, VREP, RESV) to the slave, but the slave cannot evaluate
these locally because it lacks the master's schedule data (reinj_group,
voidage_group, GCONSUMP, etc.). This caused a map::at crash in
updateWsolvent() when the slave tried to read gas injection controls
from its local schedule.

Always convert injection cmodes to RATE when sending to the slave,
since the numeric target is already a surface rate for all modes.

Also return the minimum of the top-level distributed target and the
bottom group's own target in calculateGroupConstraint(). Previously,
when the bottom group's rate was below the top-level target, the
group's own (potentially larger) target was returned, allowing the
slave to overshoot the master's budget during independent substeps.
PR OPM#6596 introduced updateNONEProductionGroups() which resets
production control to NONE for groups not targeted by any well.
On an RC master (no local wells), this incorrectly resets ALL
groups including FIELD and the master group hierarchy, causing
a crash in getProductionGroupTargetForMode() at the next report
step when the constraint calculator encounters NONE control on
FIELD.

Move updateNONEProductionGroups() from BlackoilWellModelGeneric
to GroupStateHelper, which has access to the rescoup_ proxy.
Add an exception for RC master hierarchy groups (master groups
and their ancestors up to FIELD) that actively distribute
targets to slave groups via the guide-rate hierarchy.
Consolidate 4 scattered #ifdef RESERVOIR_COUPLING_ENABLED
blocks into a single block at the end of the private
section. This reduces ifdef clutter and makes it clear
which methods are RC-specific.
@hakonhagland hakonhagland added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Mar 12, 2026
@hakonhagland hakonhagland marked this pull request as draft March 12, 2026 12:31
@hakonhagland
Copy link
Contributor Author

Putting this in draft mode until #6922 has been merged.

@hakonhagland
Copy link
Contributor Author

jenkins build this serial 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.

1 participant