Skip to content

Implement thermal energy equation for Standard Wells#2

Draft
Copilot wants to merge 4 commits intothermal_mswfrom
copilot/implement-thermal-energy-equation-standard-wells
Draft

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

Conversation

Copy link

Copilot AI commented Mar 3, 2026

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 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>
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