Restore ThermoPhase state after error setting state#1981
Merged
bryanwweber merged 5 commits intoCantera:mainfrom Sep 19, 2025
Merged
Restore ThermoPhase state after error setting state#1981bryanwweber merged 5 commits intoCantera:mainfrom
bryanwweber merged 5 commits intoCantera:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1981 +/- ##
==========================================
+ Coverage 75.47% 75.58% +0.11%
==========================================
Files 450 450
Lines 56317 56320 +3
Branches 9301 9294 -7
==========================================
+ Hits 42503 42570 +67
+ Misses 10680 10613 -67
- Partials 3134 3137 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bryanwweber
reviewed
Sep 18, 2025
Member
bryanwweber
left a comment
There was a problem hiding this comment.
Thanks Ray! Some small suggestions for improving the docs, otherwise looks good to me.
This prevents ThermoPhase objects from ending up in broken states where they can't be set to a new state because of a partially-applied invalid state, for example caused by an out-of-range temperature.
89767d9 to
19ce9a2
Compare
bryanwweber
approved these changes
Sep 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
ThermoPhaseobjects to their previous (valid) state after an error setting the state. This is particularly important for the iterative two-property setters likesetState_HPwhich repeatedly manipulate the internal state.One important result of this revised behavior is that it improves the ability to use thermo models where errors in
setState_HPorsetState_UVare possible in reactor reactor networks. Previously, a bad estimated step by the integrator would lead to repeated failures in theevalfunction, even after the integrator backs off from the problematic state. Now, it is actually possible for the integrator to proceed after one of these "recoverable" integrator errors.If applicable, fill in the issue number this pull request is fixing
Resolves an issue identified in a post on the Cantera Users' Group.
If applicable, provide an example illustrating new features this pull request is introducing
Checklist
scons build&scons test) and unit tests address code coverage