Skip to content

Write compositional saturation pressure to restart output - #7389

Draft
GitPaean wants to merge 1 commit into
OPM:masterfrom
GitPaean:comp_output_psat
Draft

Write compositional saturation pressure to restart output#7389
GitPaean wants to merge 1 commit into
OPM:masterfrom
GitPaean:comp_output_psat

Conversation

@GitPaean

@GitPaean GitPaean commented Sep 7, 2026

Copy link
Copy Markdown
Member

PSAT in RPTRST was reported as unhandled in compositional runs. This change writes saturation pressure to restart output and allocates its buffer only when restart output requests it.

For a cell whose flash reports both hydrocarbon phases, PSAT is the cell pressure. Exact liquid-only and vapour-only flash labels select a bubble- or dew-point solve for the total composition. If the solver cannot resolve a boundary, the output is zero and the log explains how many cells were affected.

The per-cell calculation runs in the existing OpenMP fluid-in-place loop. Failures are counted atomically, reduced across MPI ranks, and logged once on rank zero. Output validation is virtual, and the collective reductions run only after rank-wide exception handling so a local exception cannot leave ranks entering different collectives.

Focused tests cover restart-only allocation, repeated allocation, exact and rounded phase labels, bubble/dew selection, two-phase pressure, and the failure contract (4 cases, 33 assertions). The exact OPM/opm-tests#1593 deck completes with one and eight OpenMP threads; its restart files are byte-identical and exercise 99 two-phase values, two solved single-phase values, and 39 explicit zero fallbacks. Combined with #7306 and OPM/opm-common#5349, both compositional equilibration decks also complete with one and four threads and produce byte-identical restart files with valid PSAT values.

Requires the saturation-pressure solver in OPM/opm-common#5283. Regression coverage is proposed in OPM/opm-tests#1593. The paired Jenkins build passed 969 tests with no compiler warnings before the final history cleanup.

@GitPaean GitPaean added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Sep 7, 2026
@GitPaean

GitPaean commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

jenkins build this opm-common=5283 failure_report please

@GitPaean
GitPaean force-pushed the comp_output_psat branch 3 times, most recently from cc49680 to 037f51d Compare September 8, 2026 20:16
@GitPaean
GitPaean requested a balanced review from Copilot September 8, 2026 22:13

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.

🟡 Changes recommended

The critical solver correctness issue and moderate testing and parallel-reporting issues remain unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds compositional PSAT restart output using phase pressure or the shared saturation-pressure solver.

Changes:

  • Computes and exports saturation pressure.
  • Adds conditional storage and failure reporting.
  • Adds container allocation/export tests.

Review findings:

  • Critical (1 vote): Solver failures can incorrectly report zero for near-critical cells.
  • Moderate (1 vote): Tests do not cover phase selection or calculated values.
  • Moderate (2 votes): Failure counts are rank-local rather than globally reduced.
File summaries
File Description
tests/test_compositionalcontainer.cpp Tests PSAT allocation and export.
opm/simulators/flow/OutputCompositionalModule.hpp Computes PSAT and reports solver failures; contains the unresolved findings.
opm/simulators/flow/CompositionalContainer.hpp Declares PSAT storage APIs.
opm/simulators/flow/CompositionalContainer.cpp Allocates and exports PSAT.
CMakeLists_files.cmake Registers the new test.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 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/OutputCompositionalModule.hpp Outdated
Comment thread opm/simulators/flow/OutputCompositionalModule.hpp Outdated
Comment thread opm/simulators/flow/OutputCompositionalModule.hpp Outdated
@GitPaean
GitPaean marked this pull request as draft September 9, 2026 06:35
@GitPaean
GitPaean force-pushed the comp_output_psat branch 3 times, most recently from a1db652 to d222608 Compare September 9, 2026 21:52
@GitPaean GitPaean changed the title Output the saturation pressure of a compositional cell Write compositional saturation pressure to restart output Sep 9, 2026
Handle PSAT requests in compositional restart output. Use the cell
pressure when both hydrocarbon phases are present, solve the bubble or
dew pressure for exact single-phase flash labels, and write zero when no
boundary can be resolved.

Allocate PSAT only for restart output and calculate it in the OpenMP
cell loop. Make output validation virtual and run the MPI reductions
after rank-wide exception handling, preventing a local failure from
leaving ranks in different collectives. Reduce the failure count across
ranks and log it once with clear singular and plural wording.

Keep the phase decision independent of simulator state and test restart
allocation, phase labels near round-off boundaries, solver results, and
the failure contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants