Skip to content

using the reservoir equation index for the coupling matrix C - #7370

Draft
GitPaean wants to merge 1 commit into
OPM:masterfrom
GitPaean:fix_msw_energy_coupling_column
Draft

using the reservoir equation index for the coupling matrix C#7370
GitPaean wants to merge 1 commit into
OPM:masterfrom
GitPaean:fix_msw_energy_coupling_column

Conversation

@GitPaean

Copy link
Copy Markdown
Member

assemblePerforationEq() now takes the reservoir equation index for the C column in addition to the well equation index. The two coincide for the mass conservation equations, but differ for the energy equation when, e.g., brine is active.

@GitPaean GitPaean added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Aug 28, 2026
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this please

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates perforation equation assembly so the coupling matrix C is indexed by the reservoir equation index (column) rather than implicitly assuming it matches the well equation index. This is necessary because these indices can diverge for the energy equation (e.g., when brine is active), even though they coincide for mass conservation equations.

Changes:

  • Extend assemblePerforationEq() (standard + multisegment) to accept an explicit reservoirEqIdx / reservoir_eq_idx.
  • Use reservoirEqIdx when writing into eqns.C() to ensure correct coupling-column selection.
  • Update multisegment energy perforation assembly to pass Indices::contiEnergyEqIdx for the reservoir-side equation index.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
opm/simulators/wells/StandardWellAssemble.hpp Adds reservoirEqIdx parameter and documents the well-vs-reservoir index distinction.
opm/simulators/wells/StandardWellAssemble.cpp Uses reservoirEqIdx for the C-matrix column when assembling perforation Jacobians.
opm/simulators/wells/StandardWell_impl.hpp Updates perforation assembly call to provide both well and reservoir equation indices.
opm/simulators/wells/MultisegmentWellAssemble.hpp Adds reservoir_eq_idx parameter and documents the index distinction.
opm/simulators/wells/MultisegmentWellAssemble.cpp Uses reservoir_eq_idx for the C-matrix column when assembling perforation Jacobians.
opm/simulators/wells/MultisegmentWell_impl.hpp Updates mass and energy perforation assembly calls to pass the correct reservoir equation index (notably for energy).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread opm/simulators/wells/StandardWellAssemble.cpp Outdated
@GitPaean
GitPaean force-pushed the fix_msw_energy_coupling_column branch from 31ba6cc to ca8d40e Compare August 28, 2026 11:58
assemblePerforationEq() now takes the reservoir equation index for the C
column in addition to the well equation index. The two coincide for the mass
conservation equations, but differ for the energy equation when, e.g., brine
is active.
@GitPaean

GitPaean commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

It is not an issue at the moment, since MSW does not support brine. It will be an issue when fully-implicit thermal equation for the standard wells be there. Will hold PR as draft to wait for the later development first. Possibly it will go in with other PRs, likely the thermal equation for the standard well.

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.

2 participants