Skip to content

Reset fluid state after convergence failure#4088

Open
dkachuma wants to merge 4 commits into
developfrom
bug/bd713/kvalues
Open

Reset fluid state after convergence failure#4088
dkachuma wants to merge 4 commits into
developfrom
bug/bd713/kvalues

Conversation

@dkachuma

@dkachuma dkachuma commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a bug breaking determinism in numerical Jacobian tests, where iterate-dependent constitutive state persisted across Newton attempts. While CompositionalMultiphaseBase::resetStateToBeginningOfStep correctly restored primary variables (pressure, compositional density, and temperature), it failed to clear m_kValues and other fluid properties.

This PR updates CompositionalMultiphaseBase::resetStateToBeginningOfStep to explicitly discard warm-started state held by the fluid model by calling fluid.initializeState(). This guarantees that rolled-back steps start clean and do not inherit iterate-dependent state from failed Newton attempts.

@dkachuma dkachuma added type: bug Something isn't working ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: no rebaseline Does not require rebaseline ci: run code coverage enables running of the code coverage CI jobs labels Jun 22, 2026
@dkachuma dkachuma changed the title Draft Reset fluid state after convergence failure Jun 22, 2026
@dkachuma dkachuma marked this pull request as ready for review June 22, 2026 17:53

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.

Just to clarify the change. This resets K-values to those of last successful timestep?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resets to zero so they can be reinitialised using Wilson's correlation. Similar treatment to the well. The storage of the k-values is a heuristic attempt to improve convergence. If they are reinitialised, the flash might take a bit longer to converge but the solution should ultimately be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run code coverage enables running of the code coverage CI jobs ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: no rebaseline Does not require rebaseline type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants