Skip to content

Implement thermal energy equation for Standard Wells#2

Draft
Copilot wants to merge 30 commits into
thermal_mswfrom
copilot/implement-thermal-energy-equation-standard-wells
Draft

Implement thermal energy equation for Standard Wells#2
Copilot wants to merge 30 commits into
thermal_mswfrom
copilot/implement-thermal-energy-equation-standard-wells

Conversation

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown

Extends Standard Wells with a fully-implicit thermal energy equation, mirroring what was done for Multisegment Wells in PR OPM#6816. Previously, Standard Wells computed perforation energy fluxes for reservoir coupling (connectionRateEnergy) but had no well-side energy equation — temperature was not a well primary variable and no energy conservation was enforced in the well equation system.

Primary variable layout (StandardWellPrimaryVariables.hpp/.cpp)

  • Added enable_energy, Temperature index (placed after conservation eqs, before Bhp)
  • numStaticWellEq now includes the energy equation: numWellConservationEq + numWellControlEq + enable_energy
  • Bhp automatically shifts by 1 when thermal is active
  • Temperature initialized from ws.temperature, Newton-updated with 5 K/iteration cap, copied back to well state

Equation assembly (StandardWell_impl.hpp, StandardWellAssemble.hpp/.cpp)

  • Energy flux computed inline as EvalWell (carries both well and reservoir derivatives), replacing the old connectionRateEnergy call which returned Eval (reservoir derivatives only)
  • New assemblePerforationEqEnergy() uses separate well eq index (Temperature) and reservoir eq index (Indices::contiEnergyEqIdx) for B/C/D matrix assembly, since these indices may differ when solvents or other components are present

Convergence (StandardWellEval.cpp/.hpp)

  • Energy residual checked with tolerances matching MSW: 1e-5 (strict), 1e-4 (relaxed)

Consistency fix (StandardWell.hpp)

  • numStaticWellEq updated to include has_energy, keeping it in sync with StandardWellPrimaryVariables — without this, StandardWell::Bhp and PrimaryVariables::Bhp would diverge when thermal is active

The energy equation for Standard Wells is structurally simpler than MSW: no inter-segment flow terms, just perforation energy flux assembly. For injecting connections, enthalpy/density are evaluated at the specified injection temperature; for producing connections, reservoir fluid properties are used.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add thermal energy equation for standard wells Implement thermal energy equation for Standard Wells Mar 3, 2026
GitPaean added 24 commits March 4, 2026 11:06
and using it to update the MultisegmentWellPrimaryVariables.
flow_energy can run while not meaningfully.
it runs, while not being able to get converged.
so that we can inject energy.
some more derivatives are added.
since the energy equation is still a conservation equation that is
present in the reservoir equations and the pressure or control equation
with location SPres is what the wells hold only.
@GitPaean GitPaean force-pushed the copilot/implement-thermal-energy-equation-standard-wells branch from 8cd3162 to 6a377f2 Compare March 4, 2026 10:11
Copilot AI and others added 4 commits March 4, 2026 11:11
- Add Temperature as a primary variable in StandardWellPrimaryVariables
- Add enable_energy flag and update numStaticWellEq to include energy equation
- Handle temperature in update, Newton update, and copyToWellState
- Add energy convergence checking in StandardWellEval
- Add assemblePerforationEqEnergy method to StandardWellAssemble
- Assemble energy equation inline in assembleWellEqWithoutIterationImpl

Co-authored-by: GitPaean <6847941+GitPaean@users.noreply.github.com>
…tion

Update StandardWell.hpp to include has_energy in numStaticWellEq
calculation, ensuring consistency with StandardWellPrimaryVariables.
Also remove empty has_energy block from calculateSinglePerf.

Co-authored-by: GitPaean <6847941+GitPaean@users.noreply.github.com>
Co-authored-by: GitPaean <6847941+GitPaean@users.noreply.github.com>
@GitPaean GitPaean force-pushed the thermal_msw branch 11 times, most recently from b937b52 to 19e55a0 Compare April 29, 2026 19:53
@GitPaean GitPaean force-pushed the thermal_msw branch 5 times, most recently from 4b19013 to a611b60 Compare May 11, 2026 07:55
@GitPaean GitPaean force-pushed the thermal_msw branch 2 times, most recently from 345fb31 to bf95253 Compare May 18, 2026 21:17
@GitPaean GitPaean force-pushed the thermal_msw branch 4 times, most recently from 3a137f9 to 1ced995 Compare June 26, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants