Skip to content

Add safeguarded Newton flashes for the static path - #40

Draft
moyner wants to merge 1 commit into
mainfrom
feat/static-newton-flash
Draft

moyner wants to merge 1 commit into
mainfrom
feat/static-newton-flash

Conversation

@moyner

@moyner moyner commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

The static flash currently accepts only SSI, which prevents simulator flash reuse from performing the short Newton attempt described by Rasmussen et al. (2006) and Belkadi et al. (2011, SPE 142132, Section 2.1).

Add a safeguarded phase-amount Gibbs minimization for NewtonFlash. It shares the static equilibrium residual/Jacobian builder with the two-phase implicit derivatives and transforms that Jacobian to the scaled Gibbs Hessian. Restore material balance before the first EOS evaluation and report nonconvergence for an indefinite Hessian, nonpositive phase amounts, increasing Gibbs energy, or the iteration limit. The caller can then fall back to SSI. Static factorization supports up to 24 components.

Preserve Float32 types in cubic-root evaluation so this path also compiles on GPUs. Bump MultiComponentFlash to 2.1.0 so the dependent simulator change can require the new capability.

Validation on Julia 1.13.1:

  • Complete MultiComponentFlash test suite passed, including the existing implicit derivative and allocation tests.
  • New Float32/Float64 Newton, material balance, stale vapor fraction, failure, and zero-allocation tests passed.
  • The transformed Hessian and Newton step agree with independently differentiated phase chemical potentials.
  • KernelAbstractions/JLArrays regression passed.
  • Actual RTX 4080 CUDA kernels passed in Float32 and Float64; an eight-component phase-dependent flash also compiled and ran with reservoir AD output.

This is a prerequisite for a separate JutulDarcy reuse fix. Stability changes and the H2 correlation are outside this PR.

Related drafts: JutulDarcy reuse #353, stability #41.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant