Skip to content

Compositional equilibration with EQUIL and ZMFVD - #7306

Merged
bska merged 18 commits into
OPM:masterfrom
GitPaean:comp_equil_july_6th
Sep 17, 2026
Merged

bska merged 18 commits into
OPM:masterfrom
GitPaean:comp_equil_july_6th

Conversation

@GitPaean

@GitPaean GitPaean commented Aug 10, 2026

Copy link
Copy Markdown
Member

Add hydrostatic compositional initialization from EQUIL and ZMFVD, using RTEMPVD when present and RTEMP otherwise.

  • Type 1 treats ZMFVD as total composition, integrates pressure with the EOS root selected at the datum side of the gas-oil contact, and leaves the phase split to the subsequent flash.
  • Type 3 treats ZMFVD as the liquid composition below the contact and uses its equilibrium vapour above it. The contact pressure is adjusted to the bubble point when requested; EQUIL item 11 can preserve the supplied pressure.
  • EQLNUM regions are equilibrated independently. Region values are mapped to the leaf grid for local refinement, and invalid rank-local values are propagated collectively in parallel runs.

Type 2, COMPVD, and water zones are not supported. The RK4 integrator and pressure function are moved to a shared header and reused by both initialization paths.

Unit and regression tests cover types 1 and 3, item 11, multiple EQLNUM regions, constant and graded RTEMPVD, missing ZMFVD, local-refinement mapping, and synchronized invalid-EQLNUM failures.

Depends on OPM/opm-common#5349 for defaulted EQUIL item 11 (merged already). Parallel flow_comp runs also require #7387.

@GitPaean GitPaean added the manual:enhancement This is an enhancement/improvent that needs to be documented in the manual label Aug 10, 2026
@GitPaean GitPaean changed the title compositional equilibration compositional equilibration with ZMFVD Aug 10, 2026
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 please

@GitPaean
GitPaean requested a balanced review from Copilot August 10, 2026 13:24
Copilot stopped reviewing on behalf of GitPaean due to an error August 10, 2026 13:25

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds compositional hydrostatic equilibration support (EQUIL + ZMFVD) and aligns compositional restart/output behavior with expected Eclipse-style arrays, while also improving parallel correctness for data exchange and residual metrics.

Changes:

  • Add shared hydrostatic ODE integrator + pressure function, and implement compositional equilibration (InitStateEquilComp).
  • Extend distributed field-property handling to support multi-values-per-cell double keywords (e.g., ZMF).
  • Improve compositional restart/output (renamed arrays, new POIL/PGAS/PSAT/VMF) and fix parallel solution syncing / residual evaluation.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
opm/simulators/utils/UnsupportedFlowKeywords.cpp Removes ZMFVD from the “unsupported” list.
opm/simulators/utils/PropsDataHandle.hpp Supports multi-valued double fields per cell during broadcast/packing/unpacking.
opm/simulators/utils/PartiallySupportedFlowKeywords.cpp Tightens allowed EQUIL item 10/11 values for compositional initialization.
opm/simulators/flow/equil/PressureFunction.hpp Introduces reusable RK4 IVP integrator + depth→pressure function.
opm/simulators/flow/equil/InitStateEquil_impl.hpp Removes local integrator/pressure-function implementations now moved to shared header.
opm/simulators/flow/equil/InitStateEquilComp.hpp Adds compositional equilibration implementation based on EQUIL + ZMFVD (+ RTEMPVD).
opm/simulators/flow/equil/InitStateEquil.hpp Switches black-oil equilibration to shared PressureFunction implementation.
opm/simulators/flow/OutputCompositionalModule.hpp Adds compositional restart alignment (renames) + new outputs (phase pressures, PSAT, VMF).
opm/simulators/flow/NonlinearSystemCompositional_impl.hpp Adds updateSolution with overlap sync; residual metrics now ignore ghost cells.
opm/simulators/flow/NonlinearSystemCompositional.hpp Declares updateSolution().
opm/simulators/flow/FlowProblemComp.hpp Enables compositional equilibration; fixes parallel transmissibility export approach.
opm/simulators/flow/CompositionalContainer.hpp Adds buffers/APIs for POIL/PGAS/PSAT/VMF and allocation checks.
opm/simulators/flow/CompositionalContainer.cpp Allocates and writes new restart arrays; fixes moleFractions_ allocation check.
CMakeLists_files.cmake Installs new public headers for compositional equilibration and PressureFunction.

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

Comment thread opm/simulators/flow/FlowProblemComp.hpp
Comment thread opm/simulators/flow/CompositionalContainer.cpp
Comment thread opm/simulators/flow/equil/PressureFunction.hpp
Comment thread opm/simulators/flow/OutputCompositionalModule.hpp Outdated
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 failure_report please

@GitPaean
GitPaean force-pushed the comp_equil_july_6th branch from 0cb16eb to f06fea8 Compare August 10, 2026 15:17
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 failure_report please

@GitPaean
GitPaean force-pushed the comp_equil_july_6th branch from f06fea8 to 53bf2f2 Compare August 11, 2026 08:54
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 failure_report please

@GitPaean
GitPaean force-pushed the comp_equil_july_6th branch from 53bf2f2 to 98e5a87 Compare August 12, 2026 11:53
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 please

@GitPaean
GitPaean force-pushed the comp_equil_july_6th branch from 98e5a87 to d0e7ce4 Compare August 18, 2026 21:23
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 please

@GitPaean
GitPaean force-pushed the comp_equil_july_6th branch 2 times, most recently from d1f4b11 to 4b581c0 Compare August 22, 2026 21:48
@GitPaean
GitPaean requested a balanced review from Copilot August 22, 2026 21:49

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Suppressed comments (1)

opm/simulators/flow/equil/InitStateEquilComp.hpp:420

  • For a datum depth different from the contact, pDatum below is nevertheless used directly as the pressure at reg.zgoc. The warning therefore silently shifts the entire hydrostatic pressure profile instead of honoring the EQUIL datum. Either reject this input or integrate the datum pressure to the contact before constructing the two pressure functions.
        if (std::abs(record.datumDepth() - reg.zgoc) > 0.0) {
            OpmLog::warning(fmt::format("Equilibration region {}: the datum depth {} m "
                                        "must be at the gas-oil contact when EQUIL "
                                        "item 10 is 3; using the contact depth {} m.",
                                        regionIdx + 1, record.datumDepth(), reg.zgoc));

Comment thread opm/simulators/utils/PropsDataHandle.hpp Outdated
Comment thread opm/simulators/flow/equil/InitStateEquilComp.hpp
Comment thread opm/simulators/flow/equil/InitStateEquilComp.hpp Outdated
EQUIL_1D_ZMFVD uses type-1 initialization and integrates pressure with
the liquid EOS root. Flashing the resulting total composition produces
gas in the methane-rich upper cells, and the short initial time steps
begin resolving its segregation. EQUIL_1D_ZMFVD_OIL initializes a gas
cap over a liquid leg with the contact at the liquid bubble-point
pressure.
EQLNUM is given on the unrefined input grid while the equilibration works
on the leaf grid. Copying the array straight across left refined cells at
region 1 and the coarse cells with input-ordered values in leaf-ordered
slots. Use the same LookUpData mapping the black-oil initializer uses; it
reduces to the identity without local refinement.
A gas-oil contact inside an EQUIL type-1 region requires COMPVD or ZMFVD variation across the contact for proper phase labeling. Only warn when the supported ZMFVD input has no such variation.
Document that type 3 uses the gas-oil contact as the reference depth. Rename the local pressure values to distinguish the user input from the pressure applied at the contact, and explain that item 11 retains the numeric input even when it is not the saturation pressure.
Include <utility> directly for std::move instead of relying on a transitive include.
Describe the numerical expectations directly and use a generic input-state parameter name.
Clamp ZMFVD and RTEMPVD/TEMPVD evaluations in hydrostatic integration, contact saturation-pressure calculations, and cell assignment. Test equivalent padded tables and contacts outside both ends of the input ranges.
Require EQUIL item 6 to be zero because the downstream flash uses a single pressure for all phases. Cover positive and negative values for initialization types 1 and 3 and report the offending region.
Reject nonzero EQUIL item 9 values instead of silently applying cell-centre initialization. Test explicit zero and positive and negative subdivision requests for both supported initialization types.
Report pressures through the unit helpers instead of a bare 1e5, name the
repeated depth-table and tolerance constants, and compare compositions with
std::ranges::equal. Output is unchanged.
@GitPaean

Copy link
Copy Markdown
Member Author

I consider the implementation is clean and ready for review now. With some consideration, I think it is okay to get ZMFVD PR in first. Then COMPVD equilibration (#7373), which should be a much smaller PR.

So far the implementation is straightforward. It might be challenged with more testing cases, especially the field case testing. More development in the line will be very likely.

@GitPaean
GitPaean marked this pull request as ready for review September 16, 2026 11:57
@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

@GitPaean

GitPaean commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

jenkins build this update_data failure_report please

https://ci.opm-project.org/job/opm-simulators-PR-builder/10643/

@GitPaean

Copy link
Copy Markdown
Member Author

jenkins build this opm-tests=1607 please

bska pushed a commit to OPM/opm-tests that referenced this pull request Sep 17, 2026
Reason: PR OPM/opm-simulators#7306

opm-common     = 562cf6c6edfb3c0836dcd540ea8582e313b8ee8a
opm-grid       = ed27fd832c1da18f4e0177f2d88e5197c3da23f0
opm-simulators = d2f0e6717fa3af86d447e25dd3485f7401a78d4f

### Changed Tests ###

  * equil_1d_zmfvd
  * equil_1d_zmfvd_oil
bska added a commit to OPM/opm-tests that referenced this pull request Sep 17, 2026

@bska bska left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

The new reference solutions have been installed on the CI system so I'll merge this into master.

@bska
bska merged commit 8acaa3e into OPM:master Sep 17, 2026
2 checks passed
@GitPaean
GitPaean deleted the comp_equil_july_6th branch September 17, 2026 10:09
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.

4 participants