Implement thermal energy equation for Standard Wells#2
Draft
Copilot wants to merge 30 commits into
Draft
Conversation
Copilot
AI
changed the title
[WIP] Add thermal energy equation for standard wells
Implement thermal energy equation for Standard Wells
Mar 3, 2026
and using it to update the MultisegmentWellPrimaryVariables.
inside the wellbore
flow_energy can run while not meaningfully.
it runs, while not being able to get converged.
during iteration.
for MS wells.
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.
8cd3162 to
6a377f2
Compare
- 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>
b937b52 to
19e55a0
Compare
4b19013 to
a611b60
Compare
345fb31 to
bf95253
Compare
3a137f9 to
1ced995
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)enable_energy,Temperatureindex (placed after conservation eqs, beforeBhp)numStaticWellEqnow includes the energy equation:numWellConservationEq + numWellControlEq + enable_energyBhpautomatically shifts by 1 when thermal is activews.temperature, Newton-updated with 5 K/iteration cap, copied back to well stateEquation assembly (
StandardWell_impl.hpp,StandardWellAssemble.hpp/.cpp)EvalWell(carries both well and reservoir derivatives), replacing the oldconnectionRateEnergycall which returnedEval(reservoir derivatives only)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 presentConvergence (
StandardWellEval.cpp/.hpp)Consistency fix (
StandardWell.hpp)numStaticWellEqupdated to includehas_energy, keeping it in sync withStandardWellPrimaryVariables— without this,StandardWell::BhpandPrimaryVariables::Bhpwould diverge when thermal is activeThe 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.