Reservoir coupling: Send slave group rates to master after initial well solve#6934
Draft
hakonhagland wants to merge 4 commits intoOPM:masterfrom
Draft
Reservoir coupling: Send slave group rates to master after initial well solve#6934hakonhagland wants to merge 4 commits intoOPM:masterfrom
hakonhagland wants to merge 4 commits intoOPM:masterfrom
Conversation
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.
Complete the two-round coupling protocol: after receiving constraints from the master, the slave solves all wells under the new targets, refreshes group state caches, and sends the updated flow rates back to the master. Changes in beginTimeStep(): - Add slave_needs_well_solution flag so all wells enter the existing solve loop on coupling timesteps - Slave: updateAndCommunicateGroupData + send after solve (Round 2 send) - Master: receiveSlaveGroupData after sending constraints (Round 2 receive)
Contributor
Author
|
Putting this in draft mode until #6931 has been merged. |
Contributor
Author
|
jenkins build this serial please |
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.
Builds on #6931.
Complete the two-round reservoir coupling protocol in
beginTimeStep().slave_needs_well_solutionflag, set when constraints are received from the master. This makes all wells enter the existing solve loop (line 516), reusing thescaleSegmentRatesAndPressure→solveWellEquationsequence without code duplication.updateAndCommunicateGroupData(false)to refresh stale GroupState caches (surface rates, injection rates, voidage rate, etc.), thensendSlaveGroupDataToMaster().receiveSlaveGroupData()aftersendMasterGroupConstraintsToSlaves(). Round 2 data overwrites Round 1 in the same map; MPI FIFO ordering guarantees correct matching.