Skip to content

some tidying up in compostional - #5351

Open
GitPaean wants to merge 3 commits into
OPM:masterfrom
GitPaean:comp_tidy
Open

some tidying up in compostional#5351
GitPaean wants to merge 3 commits into
OPM:masterfrom
GitPaean:comp_tidy

Conversation

@GitPaean

@GitPaean GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member

some cleaning up partly following #5322 (review) , please let me know if it is something welcomed.

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

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

https://ci.opm-project.org/job/opm-common-PR-builder/10320/

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.

🔵 Needs a closer look

It touches core compositional viscosity/flash numerical code paths where small refactoring differences can have outsized simulation impact and should receive final human review/validation.

Pull request overview

This PR performs targeted cleanup in the compositional (EOS/flash/viscosity) code paths by replacing hard-coded “magic numbers” with named constants and by factoring repeated correlation logic into helpers, aiming to make numerical intent and units clearer without changing the underlying algorithms.

Changes:

  • Refactors the LBC viscosity implementations to use explicit unit constants and shared helper functions for the Stiel–Thodos dilute-gas branch and the LBC polynomial evaluation.
  • Replaces several hard-coded tolerances/clamps in PT flash and cubic EOS code with named static constexpr constants.
  • Small test tidy-up: switches component names to std::string_view in the volume-shift test fixture.
File summaries
File Description
tests/material/test_volume_shift.cpp Uses std::string_view for component names in test data setup.
opm/material/viscositymodels/ViscosityModels.hpp Refactors viscosity correlations, adds unit constants usage, and introduces helper functions/constants.
opm/material/eos/CubicEOS.hpp Names and centralizes fugacity/molar-volume clamp constants.
opm/material/constraintsolvers/PTFlash.hpp Names and centralizes solver tolerances and Wilson slope constant.
opm/input/eclipse/EclipseState/Compositional/CompositionalConfig.cpp Names default EOS omega constants for readability/maintainability.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@GitPaean
GitPaean marked this pull request as draft September 9, 2026 11:00
@GitPaean

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

It looks like some racing issue in the jenkins failures.

The flash tolerances, the Wilson slope, the fugacity clamps, the molar
volume floor, the EOS omega defaults and the unit conversions of the
LBC correlation were inline literals. Each now has a name and a line
saying what it is for. The arithmetic is untouched, so results are
unchanged. The test's component name is a string_view.
Reuse existing unit definitions, document correlation unit conversions, and consolidate repeated calculations while retaining the original variable names.
@GitPaean

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

@bska

bska commented Sep 9, 2026

Copy link
Copy Markdown
Member

It looks like some racing issue in the jenkins failures.

I suppose you could call it a race condition. To me it looks like the underlying cause is slightly different though. I suspect that the reference solution changes brought by #5348 (i.e., OPM/opm-tests#1595) ended up undoing/reverting the reference solution changes introduced by #5346 (i.e., OPM/opm-tests#1594), possibly due to a stale GitHub commit graph when merging #5348.

I'll trigger another reference solution update, this time from #5334, to try to re-introduce the changes from #5346.

Please hold data updates for the time being.

@bska

bska commented Sep 9, 2026

Copy link
Copy Markdown
Member

I'll trigger another reference solution update, this time from #5334, to try to re-introduce the changes from #5346.

I just merged OPM/opm-tests#1596. You can try to rerun your build check here whenever you're ready.

@GitPaean

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

https://ci.opm-project.org/job/opm-common-PR-builder/10327/

@GitPaean
GitPaean marked this pull request as ready for review September 9, 2026 12:32
@GitPaean
GitPaean requested review from akva2 and bska and removed request for akva2 and bska September 9, 2026 12:32
@GitPaean
GitPaean marked this pull request as draft September 9, 2026 12:37
@GitPaean

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

I need to work on it some more before it is ready for review.

@GitPaean
GitPaean marked this pull request as ready for review September 9, 2026 16:06
@GitPaean

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

I think it is mostly fine now. I am marking it as ready for review.

@GitPaean
GitPaean marked this pull request as draft September 9, 2026 16:06
@GitPaean
GitPaean marked this pull request as ready for review September 9, 2026 16:06
@GitPaean

GitPaean commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

https://ci.opm-project.org/job/opm-common-PR-builder/10328/

@GitPaean
GitPaean requested review from akva2 and bska September 9, 2026 16:06
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.

3 participants