[test] compositional equilibration combination - #5325
Draft
GitPaean wants to merge 12 commits into
Draft
Conversation
GitPaean
force-pushed
the
comp_equil_integration
branch
from
August 31, 2026 11:49
d653000 to
3b9259e
Compare
The upper and lower dew searches were chained with ||, so a plain convergence failure on the upper branch silently fell through to the lower one, which can return the wrong dew point of a mixture that has both. The branch search now reports whether it converged, established that the branch has no genuine root, or merely ran out of iterations, and the lower branch is only tried in the second case.
EQUIL item 11 set to 1 was never exercised; the trivial-solution test could pass without running any assertion when both mixtures are simply refused.
A pressure was recorded as two-phase bracket evidence before the converged point was classified, so the disguised-trivial rejection bisected between two copies of the same pressure and froze, and an exhausted substitution could certify a pressure it proved nothing about. Both labels now require a converged substitution and follow the classification. The root-distinctness test accepted the 1e-7 m3/mol clamp the cubic EOS substitutes for an unphysical root as if it were a real phase, inventing a 42 kbar bubble point for supercritical methane; a volume at the clamp no longer counts. Found by the new supercritical test, which now expects a refusal with the pressure output untouched. Also bound the lower-branch dew test away from the retrograde region, align the Outcome enumerators with the neighbouring enum, and document the failure contract of the public solvers.
A scan point whose fixed-pressure substitution runs out of iterations classifies nothing. Two places still treated such a point as evidence: the single-phase test, whose trivial threshold of 1e-5 an unconverged K can meet while it is still moving, and the final verdict, which reported no root when the scan had merely failed. Both now require a converged substitution, as the pressure criterion already did. A search that met an exhausted point returns GaveUp, so the upper dew search no longer hands a mixture that has both branches to the lower one.
A row summing to 0.999968 is rejected by flow but accepted by other simulators, so decks that run elsewhere stop here. ZMFVD and COMPVD rejected anything past 1e-5, and WELLSTRE anything past one machine epsilon, which is below the noise of adding the values up. They now share one tolerance: a composition is accepted when the deviation is small, scaled to sum to one, and reported in a warning, as the other simulators do. A deviation too large to be rounding is still an error.
NaN is an acceptable floating-point token to the parser, and a NaN fraction makes the sum NaN. Every comparison against a NaN is false, so both the tolerance check and the exact-sum check passed and the row was then divided through by the NaN and stored as a composition of NaNs. Any non-finite fraction makes the sum non-finite, so testing the sum covers them all.
SSHIFT was parsed and stored but never reached the equation of state. Against a reference run of the same deck, the gas density was 3.7 percent high and the liquid 10 percent low. The shift now sits on the component parameters, and the density subtracts it from the molar volume. The parameter cache keeps the unshifted volume, because the fugacity coefficients are computed from it. A volume shift cancels out of the equilibrium ratios, so it must leave the phase split untouched. Subtracting it there would change the coefficients and move the split.
SSHIFT is unconstrained deck input. A shift larger than the molar volume turns the corrected volume zero or negative, and the density was divided through it regardless, so an overlarge shift bought a negative or infinite density instead of an error. The tests grew with it. The fugacity check compared a fluid system with itself and proved nothing; it now compares against a separate system holding the same components with zero shifts. The liquid phase, where the correction matters most, was untested, and the shift it uses is now rebuilt in the test from SSHIFT and b_c = Omega_b R Tc / pc rather than read back from the parameter cache. A deck-backed case covers the parsing path, which no test reached before.
The shift reached the density and stopped there. Everything else built on the molar volume kept the unshifted one, so an SSHIFT deck got corrected densities alongside phase volumes and mobilities that did not match them. correctedMolarVolume() now returns the volume the fluid occupies, and the density is one of its callers rather than the only place the shift exists. The cached molarVolume() stays unshifted for the fugacity coefficients, which need the root the two-parameter expression was derived for. The guard against a shift larger than the volume moves into the accessor, so it covers every caller. The equilibrium-ratio test replaces the one comparing coefficients directly. Peneloux scales each fugacity by exp(-c p / (R T)), so the coefficients themselves are only equal because this implementation leaves them untranslated; the ratio is what has to hold either way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the combination of the PRs #5283, #5321, and #5322, in combination, it generate very good results combined with the development in opm-simulators.
This PR is not intended to get merged, while it is possible some results will be shared here.