Skip to content

Resolve roundoff-limited SPE3 separator stability trials - #182

Merged
sergeyfarin merged 6 commits into
masterfrom
codex/164-separator-stability
Dec 5, 2026
Merged

sergeyfarin merged 6 commits into
masterfrom
codex/164-separator-stability

Conversation

@sergeyfarin

Copy link
Copy Markdown
Owner

Summary

  • Accept a Michelsen stability trial after three consecutive roundoff-scale substitutions when both sums remain on the same side of one outside the split-seed band. The existing 1e-14 sum-step check still governs the near-boundary decision.
  • At both frozen SPE3 checkpoints, the liquid-like trial alternated between the same two sums through 100,000 iterations. The sum changes were about 1.1e-14 relative and the squared residuals were 1.93e-28 and 8.33e-27.
  • Add a fast regression using the traced 815 and 14.7 psia feeds. It checks component balance and fugacity equality. Require both frozen checkpoints to step through and require the from-scratch replay to pass the later stall.

Closes #164

Validation

  • bash scripts/validate-compositional.sh all — compositional gate 'all': OK. This includes 13 stability, 23 flash, 12 SPE3 and 10 SPE5 tests, pinned OPM fixture regeneration, the compositional scorecard and the WASM compile.
  • cargo test --release --manifest-path src/lib/ressim/Cargo.toml --lib comp_spe3_ -- --ignored --nocapture — 4 passed on a5fdc646, including both checkpoints and the full from-scratch replay.
  • cargo test --release --manifest-path src/lib/ressim/Cargo.toml --lib comp_spe5_case1_stops_at_the_published_shut_in -- --ignored --nocapture — 1 passed on a5fdc646.
  • bash scripts/validate-cross-solver.sh — cross-solver check: OK against OPM Flow 2026.10.
  • bash scripts/benchmarks.sh check — benchmark check: OK and benchmark pages: in sync with their records. All nine sections ran, including JutulDarcy with 21 runs and native/WASM binding parity.
  • pnpm run validate:product — 1,145 tests passed, 16 skipped. The IMPES bucket, typecheck, lint, import-cycle check and production build passed.
  • cargo fmt --manifest-path src/lib/ressim/Cargo.toml -- --check and git diff --check passed. The validation docs and roadmap carry the measured result.

The optional compositional refinement matrix and browser SPE5 shut-in replay were outside the validation scope. The SPE5 shut-in evidence here is native.

Numbers

  • Both frozen SPE3 checkpoints advanced on the first attempt, to 2952.4375 d and 4139.5 d.
  • The fixed-recycle SPE3 replay completed all 180 reports through 5478.75 d. It took 184 accepted steps, four rejected attempts and 1294 Newton iterations in accepted steps. The worst relative component balance was 6.384051631036567e-11. The 2500 psia crossing kept its monthly bracket, 3743.8125–3774.25 d. Average reservoir pressure ended at 1140.6 psia. The recorded replay is in docs/SPE3_VALIDATION.md at engine revision a5fdc646.
  • SPE5 matches the post-rate-well-fix record at 6285.34375 d and water cut 0.8344891317395606, with 1,239 accepted steps, zero rejected attempts and 6,226 Newton iterations. The 0.8344920492842325 figure in the original issue predates the rate-well fix.

Also fixed

  • Corrected the thermodynamics module status and documented the existing roundoff regressions in the sweep skill.

Follow-up issues

Decisions made on the owner's behalf

  • Used three consecutive qualifying substitutions with a relative sum-step bound of 1e-12 × (1 + sum) and squared residual below 1e-24. Both sums must remain outside the 1e-9 split-seed band. This admits the measured oscillations and keeps the tighter rule where the phase verdict is sensitive to the sum.

@sergeyfarin

Copy link
Copy Markdown
Owner Author

Addressed all four findings.

  • The SPE3 replay now requires a successful run to the requested last report, including all 15 years by default. It requires the first 2500 psia crossing after 3743.8125 d and by 3774.25 d whenever the replay reaches the end of that window. Shorter replays can finish before the crossing.
  • The new stability unit test checks the band, a step across one, the residual and sum-step bounds, and the two traced separator substitutions. Removing only the band guard made the test fail on the inside-band case in a scratch worktree.
  • The thermodynamics gate now requires 12 SPE3 tests and 14 stability tests, covering both roundoff regressions.
  • The historical SPE3 section now links to the completed run and its endpoint.

bash scripts/validate-compositional.sh thermo passed. The release SPE3 gate passed all four tests, with 180 reports through 5478.75 d and the crossing at 3774.25 d. Its numerical record matched the earlier run exactly after removing timing fields. A separate SPE3_LAST_DAY=30.4375 replay passed.

@sergeyfarin

Copy link
Copy Markdown
Owner Author

Removed the redundant “across one” case. A step that straddles one and satisfies the sum-step bound already falls inside the exclusion band, which the existing inside-band case covers. The focused stability regression passed.

@sergeyfarin
sergeyfarin merged commit 0c110a4 into master Dec 5, 2026
7 checks passed
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.

SPE3 fails at 4109 d: separator stability trial converged to roundoff but its trial sum never stops moving by 1e-14

1 participant