Compositional equilibration with EQUIL and ZMFVD - #7306
Conversation
|
jenkins build this opm-common=5283 please |
There was a problem hiding this comment.
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.
|
jenkins build this opm-common=5283 failure_report please |
0cb16eb to
f06fea8
Compare
|
jenkins build this opm-common=5283 failure_report please |
f06fea8 to
53bf2f2
Compare
|
jenkins build this opm-common=5283 failure_report please |
53bf2f2 to
98e5a87
Compare
|
jenkins build this opm-common=5283 please |
98e5a87 to
d0e7ce4
Compare
|
jenkins build this opm-common=5283 please |
d1f4b11 to
4b581c0
Compare
There was a problem hiding this comment.
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,
pDatumbelow is nevertheless used directly as the pressure atreg.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));
a15704f to
6606a88
Compare
83a3afa to
9cc88f6
Compare
9cc88f6 to
8c5eea9
Compare
e4d0219 to
6df9482
Compare
6df9482 to
c8b817b
Compare
c8b817b to
d518fc3
Compare
ecab1ef to
caa4fd3
Compare
EQUIL type 1 uses ZMFVD as total composition and integrates pressure with one EOS root selected from the datum side of the gas-oil contact. The subsequent flash determines the phase split. Type 3 uses ZMFVD as liquid composition below the contact and the equilibrium vapour above it. When saturation-pressure adjustment is enabled, replace the supplied pressure only when it differs from the bubble point by at least one atmosphere; item 11 = 1 preserves it. Use RTEMPVD when present and RTEMP otherwise. Equilibrate EQLNUM regions independently, and reject type 2, COMPVD, and water zones.
Cover EQUIL types 1 and 3, item 11, independent EQLNUM regions, constant and graded RTEMPVD, and missing ZMFVD. Pressure checks use values from the reference 1D case.
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.
There was a problem hiding this comment.
🟡 Changes recommended
The critical LGR/EQLNUM mapping defect and type 3 datum-depth validation issue must be addressed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Balanced
| const auto& e = eclState.fieldProps().get_int("EQLNUM"); | ||
| assert(e.size() == eqlnum.size()); | ||
| std::ranges::transform(e, eqlnum.begin(), [](const int r) { return r - 1; }); |
There was a problem hiding this comment.
Fixed in b576975: the copy now goes through
LookUpData::assignFieldPropsIntOnLeaf, the same mapping the black-oil
initializer uses in InitStateEquil_impl.hpp, so a refined cell inherits its
parent's EQLNUM and the unrefined case reduces to the identity.
One correction to the description: it was not an overrun. With local refinement
the leaf has more cells than the input grid, so the transform under-filled --
refined cells kept region 1 while the coarse cells received input-ordered
values in leaf-ordered slots. Silently wrong initialization rather than a
crash, and the per-cell range check could not catch it because region 1 is
valid.
Both regression decks give bit-identical initial states before and after, and
compequil still passes.
| 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)); | ||
| } |
There was a problem hiding this comment.
The datum depth and the contact routinely differ in practice -- every
compositional equilibration deck in our reference collection does so, including
the two shipped with this PR -- and the reference simulator accepts them.
EQUIL_1D_ZMFVD_OIL has a datum at 2010 m against a contact at 2050 m, and a
datum pressure of 150 bar against a saturation pressure of 160.56 bar at the
contact. Both warnings fire, the datum pressure is replaced, and the resulting
column matches the reference simulator to 6.5e-7 relative in pressure.
Rejecting that input would refuse a deck the reference accepts.
With item 11 = 1 the given datum pressure is deliberately kept and used at the
contact -- that is what item 11 asks for -- and GasCapKeepingDatumPressure in
tests/test_compequil.cpp pins it. That particular combination is not yet
validated against the reference simulator. If it turns out to apply a
hydrostatic correction from the datum depth instead, that is the thing to
change, rather than the acceptance of the input.
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.
Adds hydrostatic compositional initialization from EQUIL and ZMFVD, with temperature from RTEMP or RTEMPVD.
Type 2, COMPVD, and water zones remain unsupported. The black-oil RK4 integrator and pressure function move to a shared header and are reused by both equilibration paths.
Unit tests cover types 1 and 3, item 11, independent EQLNUM regions, constant and graded RTEMPVD, and missing ZMFVD. The two reference decks are registered as serial regression tests.
Depends on OPM/opm-common#5283. Parallel
flow_compruns additionally require #7387; the serial regression tests in this PR do not.