Skip to content

CPR: compute the true-IMPES weights per degree of freedom - #7276

Draft
hnil wants to merge 3 commits into
OPM:masterfrom
hnil:pr/cpr-dof-weights
Draft

hnil wants to merge 3 commits into
OPM:masterfrom
hnil:pr/cpr-dof-weights

Conversation

@hnil

@hnil hnil commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Both true-IMPES weight formulas depend only on a degree of freedom's own intensive
quantities -- and, for the non-analytic one, its own volume. No neighbours, no geometry.
Walking the grid's elements to evaluate them is therefore not necessary, and it is the
only thing tying these weights to the grid.

The choice between the two walks is made on two facts a model can now be asked for
directly:

  • formsStorageFromIntensiveQuantities on the residual -- BlackOilLocalResidualTPFA
    has the computeStorage() overload taking intensive quantities alone, the
    element-by-element residual does not.
  • intensiveQuantityCacheEnabled() on the model -- the indexed lookup is valid only
    when the cache is on. storeIntensiveQuantities() does not answer that, being true
    also when only the thermodynamic hints are kept.

The element walk is kept and taken whenever either is missing, so
flow_blackoil_legacyassembly and anything else on the element-based residual is
unaffected.

dofTotalVolume() is the same quantity the element walk reads off the stencil --
accumulated once per degree of freedom and completed over process boundaries by the sum
handle -- minus the extrusion factor, which is applied explicitly.

Verified on SIMPLE_MECH_NX_11_NY_11_NZ_25_FRAC_SEQ: 252 summary vectors identical to
1e-12 under cpr_trueimpes, and a 13-test local regression set unchanged under
cpr_trueimpesanalytic. Draft: I have not run the full opm-tests suite.

Motivation is work on flow degrees of freedom that have no grid element (numerical
aquifers and embedded fractures as auxiliary DOFs), which cannot be given a weight at all
today -- but the change stands on its own.

🤖 Generated with Claude Code

@hnil
hnil force-pushed the pr/cpr-dof-weights branch from 180de88 to c9ede47 Compare August 4, 2026 12:37
@hnil
hnil requested a review from atgeirr August 4, 2026 12:53
@hnil hnil added the manual:enhancement This is an enhancement/improvent that needs to be documented in the manual label Aug 10, 2026
@hnil
hnil force-pushed the pr/cpr-dof-weights branch from c9ede47 to 4ecdd77 Compare August 11, 2026 08:23
@hnil
hnil requested a review from jakobtorben August 11, 2026 08:37
@hnil
hnil force-pushed the pr/cpr-dof-weights branch 2 times, most recently from 7b5a9ea to 7224d4b Compare August 12, 2026 07:43
@hnil
hnil force-pushed the pr/cpr-dof-weights branch from 7224d4b to 638ad5b Compare September 18, 2026 07:33
@hnil

hnil commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

hnil and others added 3 commits September 22, 2026 10:18
Two facts a caller needs before walking degrees of freedom instead of
elements: whether the residual's computeStorage() takes intensive
quantities alone (true for the blackoil TPFA residual), and whether the
intensive quantities can be read by index (the cache is on).  No
behaviour change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The weight depends only on a degree of freedom's own intensive quantities
and primary variables.  When those can be read by index, walk the degrees
of freedom instead of the elements; that also reaches degrees of freedom
without an element.  The element walk remains for the other case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…esidual allows

The weight comes from a degree of freedom's storage term and volume only.
When the residual can form that storage from intensive quantities read by
index (the blackoil TPFA residual), walk the degrees of freedom; otherwise
keep the element walk, so the element-based residual is unaffected.
dofTotalVolume() is the volume the element walk reads off the stencil.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hnil
hnil force-pushed the pr/cpr-dof-weights branch from 638ad5b to 7dcc968 Compare September 22, 2026 08:33

This branch has not been deployed

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

Labels

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