Skip to content

Accept a COMPVD phase change away from the type-1 gas-oil contact - #7490

Open
GitPaean wants to merge 5 commits into
OPM:masterfrom
GitPaean:compvd-contact-mismatch
Open

GitPaean wants to merge 5 commits into
OPM:masterfrom
GitPaean:compvd-contact-mismatch

Conversation

@GitPaean

@GitPaean GitPaean commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

With EQUIL item 10 = 1 the COMPVD rows give the composition versus depth. A two-zone table whose last vapour row and first liquid row do not straddle the gas-oil contact stopped the run. The gas zone now ends at the nearest edge of the gap between those rows, with a warning, and a cell on the last vapour row stays in the gas zone. Type 3 keeps the error, as it uses the contact as reference depth.

When the gas zone reaches the water-oil contact, the water now takes its pressure from the gas column there rather than from the liquid one.

test_compequil covers these cases; the existing equilibration regressions are unchanged. The new regression equil_1d_compvd_water_gascap_contact_mismatch runs the case from OPM/opm-tests#1638 and needs its reference data.

Initialization flow

EQUIL supplies contact depths and reference pressure. COMPVD supplies composition versus depth, with each row marked as vapour or liquid. The following flow applies to a COMPVD table containing both vapour and liquid rows.

flowchart TD
    A["COMPVD contains both vapour and liquid rows"] --> B{"Are all vapour rows<br/>above the liquid rows?"}

    B -->|No| C["Stop: interleaved phase rows"]
    B -->|Yes| D{"Is the EQUIL gas-oil contact<br/>between the last vapour row<br/>and first liquid row?"}

    D -->|Yes| E["Use the EQUIL contact<br/>as the zone boundary"]
    D -->|No| F{"EQUIL initialization type?"}

    F -->|Type 1| G["Move the boundary to the<br/>nearest edge of the row gap<br/>and issue a warning"]
    F -->|Type 3| H["Stop: type 3 requires the<br/>contact as its reference depth"]

    E --> I["Use the selected boundary for<br/>gas and liquid pressure integration"]
    G --> I

    I --> J["Initialize water pressure when needed"]
    J --> K["Assign each cell its zone composition<br/>and nominal phase"]
    K --> L["For type 1, a cell exactly on the<br/>last vapour row remains gas"]
    L --> M["Downstream flash computes<br/>the final hydrocarbon phase split"]
Loading

For example, with the last vapour row at 2049 m and first liquid row at 2051 m, type 1 moves a contact at 2060 m to 2051 m, or 2030 m to 2049 m. Depth increases downward.

Water-pressure anchoring

For a two-zone COMPVD region, when water pressure needs anchoring from the hydrocarbon column, the phase just above the water contact determines which pressure to use.

flowchart TD
    A["Water pressure needs anchoring<br/>from the hydrocarbon column"] --> B{"Does the gas zone reach<br/>the water contact?"}
    B -->|Yes| C["Take gas pressure<br/>at the water contact"]
    B -->|No| D["Take liquid pressure<br/>at the water contact"]
    C --> E["Subtract the specified capillary pressure<br/>and integrate the water column"]
    D --> E
Loading

This prevents a pressure discontinuity when moving the gas/liquid boundary makes gas touch water.

@GitPaean
GitPaean force-pushed the compvd-contact-mismatch branch from 4f6e38c to f129390 Compare October 2, 2026 22:40
@GitPaean GitPaean added the manual:enhancement This is an enhancement/improvent that needs to be documented in the manual label Oct 2, 2026
@GitPaean
GitPaean marked this pull request as draft October 2, 2026 22:45
@GitPaean

GitPaean commented Oct 2, 2026 •

Copy link
Copy Markdown
Member Author

jenkins build this opm-tests=1638 failure_report please

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

@GitPaean

GitPaean commented Oct 3, 2026 •

Copy link
Copy Markdown
Member Author

jenkins build this opm-tests=1638 failure_report please

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

@GitPaean

GitPaean commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

The PR is necessary to run the targeting case. At the same time, we only have one case OPM/opm-tests#1638 to analyze the behavoir (it needs OPTIONS3 item 33 to run through). That said, with more testing and development, some adjustment or more strict checking (rejecting the running for certain scenario) will be expected along the line.

@GitPaean
GitPaean marked this pull request as ready for review October 3, 2026 22:50
@GitPaean
GitPaean force-pushed the compvd-contact-mismatch branch from 4fc2d96 to e36f33f Compare October 3, 2026 23:25
@GitPaean

GitPaean commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

This PR should be after OPM/opm-common#5429 and OPM/opm-common#5430 to reduce the times of the reference update.

@GitPaean

GitPaean commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

jenkins build this opm-tests=1638 failure_report please

@svenn-t svenn-t 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.

I freely admit that I only have a surface level understanding of equilibration in the compositional simulator. So I only have a clarifying question and a small nit.

Comment on lines +510 to +516
OpmLog::warning(fmt::format("Equilibration region {}: the gas-oil contact at {} m lies "
"outside the COMPVD phase change between the last vapour "
"row at {} m and the first liquid row at {} m. With EQUIL "
"item 10 = 1 the rows give the composition versus depth, "
"so the gas zone ends at {} m instead.",
regionIdx + 1, reg.zgoc, lastVapor, firstLiquid, boundary));
return boundary;

@svenn-t svenn-t Oct 7, 2026 •

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.

I'm a bit back and forth with what should be correct here. I think I understand that with EQUIL item 10 set to type 1, then there is no gas-oil contact as such, it is only meant to label the transition from gas to oil in a super-critical fluid (?). In any case, shouldn't the gas-oil contact from EQUIL item 5 take priority over COMPVD? Of course, then we would need to issue an error here since there is an inconsistency between EQUIL and COMPVD, and that is maybe too strict...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

With item 10 = 1 the COMPVD rows give the composition versus depth, and each row says whether it is vapour or liquid. If the contact from item 5 took priority, the cells between it and the nearest row would be put in one phase while the rows name the other, so we would have to stop the run, as you say. The case in OPM/opm-tests#1638 is like that: its contact at 2576.21 m lies below the first liquid row at 2574.5 m. So for type 1 the rows decide, with a warning, and the gas zone ends at the nearest row. Type 3 keeps the error, because it uses the contact as the reference depth. If more cases show this is too lenient, we can make it stricter.

We have more cases remain to be tested along this line, with more testing, we might change the design here again.

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.

Thanks for the further elaboration! As I said I was a bit back and forth whether EQUIL item 5 should take priority. The implementation is fine and we do give a warning on inconsistency, so it should be clear to a user input GOC is ignored if outside COMPVD range.

/// the phase.
static bool isInGasZone(const Region& reg, const Scalar depth)
{
if (reg.twoZone && (reg.initType == 1) && (depth <= reg.lastVaporDepth)) {

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.

should the check depth <= reg.lastVaporDepth be replaced by depth <= reg.zgoc? In addition other checks use strict < compared to <=.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This follows from my answer to the comment abovle: for type 1 the COMPVD rows decide the phase. A cell on the contact normally counts as liquid, hence the < elsewhere, but a cell on the last vapour row should stay gas. Comparing with reg.zgoc instead would wrongly make the first liquid row gas when the contact moves down onto it, as in OPM/opm-tests#1638. I added a comment and a test for this.

As said, it does look confusing and more testing might update the logic here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The testing will be about the role of FACTLI, which is another confusing concept to me.

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.

Alright, I have not done any testing so I'll say the clause is fine (but confusing)

@GitPaean

GitPaean commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

Thanks for the comments. I looks like I accidentally assigned this PR to people instead of inviting reviewer. I will have a look at your comments by tomorrow.

@svenn-t

svenn-t commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for the comments. I looks like I accidentally assigned this PR to people instead of inviting reviewer. I will have a look at your comments by tomorrow.

That is fine, I took the review instead of @totto82.

With EQUIL item 10 = 1 the COMPVD rows give the composition versus
depth, so they decide where the gas zone ends. A contact outside the
gap between the last vapour row and the first liquid row now moves to
the nearest edge of that gap with a warning instead of stopping the
run. Type 3 keeps the error, as it uses the contact as reference depth.
A cell on the contact belongs to the liquid zone, so a contact moved onto
the last vapour row gave that row's depth the liquid composition. With
EQUIL item 10 = 1 the rows decide the phase.
The water took the liquid column's pressure even when the gas zone
reaches the water-oil contact, as it does once the gas-oil contact lies
below it.
Clamp once and compare, so the row gap is defined in one place. Once
the boundary moves it is no longer the EQUIL contact, so the later
messages stop calling it that. The rejection test checks which error
it gets.
@GitPaean
GitPaean force-pushed the compvd-contact-mismatch branch from 94cb0f2 to 691b1ae Compare October 7, 2026 13:00
@GitPaean

GitPaean commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

jenkins build this failure_report please

@svenn-t svenn-t 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.

Thanks for the answers. The code looks good to me, at least!

@GitPaean

GitPaean commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Thanks for the answers. The code looks good to me, at least!

Thanks for the review. The current design depends on very limited cases that we have, it will evolve with testing cases. Hopefully, our understandings can be settled more along the way.

@GitPaean

GitPaean commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

jenkins build this update_data please

@GitPaean GitPaean closed this Oct 7, 2026
@GitPaean GitPaean reopened this Oct 7, 2026
@GitPaean

GitPaean commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

jenkins build this update_data please

@GitPaean

GitPaean commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

jenkins build this opm-tests=1653 please

1 similar comment
@GitPaean

GitPaean commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

jenkins build this opm-tests=1653 please

This branch has not been deployed

No deployments
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.

5 participants