Skip to content

compositional equilibration with ZMFVD - #7306

Draft
GitPaean wants to merge 7 commits into
OPM:masterfrom
GitPaean:comp_equil_july_6th
Draft

compositional equilibration with ZMFVD#7306
GitPaean wants to merge 7 commits into
OPM:masterfrom
GitPaean:comp_equil_july_6th

Conversation

@GitPaean

Copy link
Copy Markdown
Member

It depends on OPM/opm-common#5283

@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 on lines +474 to +481
EQUIL::Comp::InitialStateComputer<FluidSystem> initialState(
eclState,
getEosType(),
vanguard.cellCenterDepths(),
eqlnum,
vanguard.gridView().comm(),
this->gravity()[dimWorld - 1],
this->numPressurePointsEquil());
Comment on lines +222 to +225
entries.emplace_back("POIL", UnitSystem::measure::pressure, oilPressure_);
entries.emplace_back("PGAS", UnitSystem::measure::pressure, gasPressure_);
entries.emplace_back("PSAT", UnitSystem::measure::pressure, saturationPressure_);
entries.emplace_back("VMF", UnitSystem::measure::identity, vaporFraction_);
Comment on lines +83 to +94
Scalar operator()(const Scalar x) const
{
// Dense output (O(h**3)) according to Shampine
// (Hermite interpolation)
const Scalar h = stepsize();
int i = (x - span_[0]) / h;

// Crude handling of evaluation point outside "span_": the interval is
// clamped to the table, and "t" with it, so that a depth beyond either
// end returns the value at that end instead of a cubic extrapolation.
if (i < 0) { i = 0; }
if (N_ <= i) { i = N_ - 1; }
Comment on lines +410 to +437
// A cell where both phases are present is at its saturation pressure;
// elsewhere the bubble- (dew-) point pressure of the total composition.
Entry{[&compC = this->compC_, eosType = this->eosType_](const ExtractContext& ectx)
{
const auto& fs = ectx.fs;
const Scalar sOil = getValue(fs.saturation(oilPhaseIdx));
const Scalar sGas = getValue(fs.saturation(gasPhaseIdx));

Scalar psat = 0.0;
if (sOil > 0.0 && sGas > 0.0) {
psat = getValue(fs.pressure(oilPhaseIdx));
}
else {
using SatP = SaturationPressure<Scalar, FluidSystem>;
typename SatP::CompVec z;
typename SatP::CompVec incipient;
for (int c = 0; c < numComponents; ++c) {
z[c] = getValue(fs.moleFraction(c));
}
const Scalar temp = getValue(fs.temperature(oilPhaseIdx));
const bool converged = (sGas <= 0.0)
? SatP::bubblePressure(z, temp, eosType, psat, incipient)
: SatP::dewPressure(z, temp, eosType, psat, incipient);
if (!converged) {
psat = 0.0;
}
}
compC.assignSaturationPressure(ectx.globalDofIdx, psat);
@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

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.

2 participants