Skip to content

Calculate ROEW From External Per-Region Contributions - #5280

Draft
bska wants to merge 3 commits into
OPM:masterfrom
bska:roew-no-copt
Draft

Calculate ROEW From External Per-Region Contributions#5280
bska wants to merge 3 commits into
OPM:masterfrom
bska:roew-no-copt

Conversation

@bska

@bska bska commented Aug 6, 2026

Copy link
Copy Markdown
Member

This PR switches the ROEW calculation away from using the ad-hoc mechanism of defining additional COPT vectors and mapping these to region contributions using the RegionCache. Instead, we rely on client code to provide a dedicated ConnOPT region variable (#5279, OPM/opm-simulators#7293) defined for all regions in all region sets and use that value, combined with the existing "initial in-place" container, to infer the ROEW recovery factor per region and region set.

The practical benefit of this change is that users no longer see the COPT vectors that were added only as a means of calculating ROEW and which were not requested in the run's SUMMARY section.

@bska bska added manual:bugfix This PR is a bug fix and should be noted in the manual manual:enhancement This is an enhancement/improvent that needs to be documented in the manual labels Aug 6, 2026
@bska

bska commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

I'm creating this PR in draft mode for two reasons:

  1. It depends on, and contains, the earlier PR Populate Region Variable Mapping From Summary Config #5279
  2. It depends on the simulator populating the special purpose ConnOPT region level summary variable in Track Per-Region Cumulative Oil Production From Wells opm-simulators#7293.

I will keep the PR in a draft state until both requirements have been satisfied and this PR is ready for review and merging.

@bska
bska force-pushed the roew-no-copt branch 13 times, most recently from 33f392b to 7c89cdc Compare August 14, 2026 09:16
bska and others added 3 commits August 14, 2026 17:00
This commit introduces a new manager-style class

    RegionVariableCollection

which aggregates region set descriptors and variable values and
distributes per-cell variable contributions to all pertinent region
sets.  Client code is expected to create a single object of this
class and initialise it with a populated region variable mapping.
Then as needed, typically at the end of every converged time step,
client code is expected to perform a value accumulation as follows:

    1. Prepare this object for accumulation (prepareValueAccumulation())
    2. For each applicable variable and cell, include the per-cell
       contribution (addCellValue()).
    3. Commit those contributions to compute the new variable
       values (commitValues()).

Once 'commitValues()' has completed, client code may retrieve those
new variable values through the regionVariableValues() member
function.  The process of committing values may involve cross-rank
MPI communication in parallel and will add to or overwrite the
current values depending on whether the variable is declared
cumlative.

We also include two helper functions,

    regionSetIndex()
    variableIndex()

which essentially just forward a query to the variable mapping
object supplied as an argument.  The one exception is that
regionSetIndex() knows that "FIELD" is a special region set
pertaining to field-level quantities and will act accordingly.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit adds a special purpose helper function,

    populateRegVarMapping()

that, based on the run's configured summary vectors, populates an
object of type data::RegionVariableMapping.

In this initial implementation, we define a variable named

    ConnOPT

if any of the *OEW* summary vectors are configured in the run's
SUMMARY section.  Those OEW vectors require tracking the per-region
cumulative oil production from wells and it's easier to have a
dedicated variable for this than to introduce extra "COPT" summary
vectors that are visible to the user through the result set's
summary files (e.g., .SMSPEC and .UNSMRY).
This commit switches the ROEW calculation away from using the ad-hoc
mechanism of defining additional "COPT" vectors and mapping these to
region contributions using the RegionCache.  Instead, we rely on
client code to provide a dedicated "ConnOPT" region variable defined
for all regions in all region sets and use that value, combined with
the existing "initial in-place" container, to infer the ROEW
recovery factor per region and region set.

The practical benefit of this change is that users no longer see the
COPT vectors that were added only as a means of calculating ROEW and
which were not requested in the run's SUMMARY section.
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 manual:enhancement This is an enhancement/improvent that needs to be documented in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant