Skip to content

WIP: Add NeqSim compatibility suite#1560

Draft
olelod wants to merge 2 commits into
mainfrom
test/neqsim-compatibility-suite
Draft

WIP: Add NeqSim compatibility suite#1560
olelod wants to merge 2 commits into
mainfrom
test/neqsim-compatibility-suite

Conversation

@olelod

@olelod olelod commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an on-demand NeqSim compatibility suite for the vendored jar and wrapper. The goal is to make NeqSim jar bumps explicit and reviewable: a bump should either pass unchanged, produce an accepted snapshot diff, or be rejected because it changes behaviour ecalc depends on.

The suite is deselected from normal test runs with the neqsim_compat marker and has its own workflow. The ordinary library test shards explicitly exclude it, so the expensive compatibility checks do not run as part of the default test matrix.

What is covered

The suite is split into three layers:

Layer Purpose
regression/ Strict reference snapshot for numerical drift in properties ecalc reads from NeqSim.
sanity/ Finiteness, physical bounds, continuity, external reference anchors, and wet-composition floor guards.
behaviour/ Contracts for TP flash, PH flash, gas-phase extraction, mixing, EoS routing, copy/state identity, and validator integration at probe-edge states.

The operating envelope is centralised in tests/ecalc_neqsim_wrapper/compatibility/envelope.py and covers representative pressure/temperature regimes, four EoS models (SRK, PR, GERG_SRK, GERG_PR), and natural-gas/wellstream compositions that exercise light gas, rich gas, CO2-heavy gas, N2-heavy gas, wet gas, and two-phase cases.

Workflow behaviour

Adds .github/workflows/test-neqsim-compatibility.yml:

  • runs when the NeqSim jar, wrapper, compatibility suite, or workflow changes;
  • supports manual dispatch;
  • enforces that neqsim_version_info.md is updated when the vendored jar changes;
  • runs the compatibility suite separately from the normal library test workflow.

Notes for future jar bumps

If a jar bump changes snapshotted values, regression/test_reference_snapshot.py fails with the exact (composition, P, T, EoS) state and property diffs. Accepted drift should be handled by regenerating reference_snapshot.json and reviewing that diff together with the jar bump.

@olelod olelod force-pushed the test/neqsim-compatibility-suite branch from e04c4eb to 98559f1 Compare May 18, 2026 12:13
@olelod olelod changed the title Add NeqSim compatibility suite WIP: Add NeqSim compatibility suite May 18, 2026
@olelod olelod force-pushed the test/neqsim-compatibility-suite branch 5 times, most recently from 6b8d94a to 4a6df40 Compare May 21, 2026 13:52
@olelod olelod mentioned this pull request Jun 8, 2026
10 tasks
olelod and others added 2 commits June 11, 2026 20:30
Adds an on-demand compatibility suite under tests/ecalc_neqsim_wrapper/compatibility/ that verifies the vendored NeqSim jar and wrapper across representative ecalc operating conditions.

The suite includes a strict reference snapshot for numerical drift, sanity checks for finite and physically plausible properties, and behaviour checks for TP flash, PH flash, gas-phase extraction, mixing, EoS routing, and validator integration.

A GitHub Actions workflow runs the suite when the jar, wrapper, suite, or workflow changes, and the README documents the rationale, operating envelope, commands, and failure triage.

Snapshot tolerances allow Linux runner drift observed for c3_rich_wellstream_dry at 50 bara and 330 K: vapor_fraction_molar drift 1.293e-08 (abs tolerance relaxed from 1.0e-08 to 2.0e-08) and density relative drift 1.054e-08 (relative tolerance relaxed from 1.0e-08 to 2.0e-08).
…2_heavy

- Add n2_heavy to COMPOSITION_NAMES (was in compositions.py but excluded)
- Split snapshot into TP and PH tables: tp|... and ph|... keys
- PH-flash: isenthalpic compression at 1.5× inlet pressure
- Add PH_SNAPSHOT_PROPERTIES (density, enthalpy, temperature_kelvin,
  z_factor, viscosity, specific_heat, thermal_conductivity)
- Update _regenerate.py to produce both tp|... and ph|... entries
- Update test_reference_snapshot.py with separate parametrized tests
  for TP and PH flash, and test_snapshot_has_no_extra_states checks both
- Regenerate reference_snapshot.json (2209 states)
- state_key() backward-compat alias preserved for tp|... keys

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@olelod olelod force-pushed the test/neqsim-compatibility-suite branch from 75e95e7 to 63b8667 Compare June 11, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant