Fix calculation of phase equilibria if one or more component has 0 composition#331
Merged
Fix calculation of phase equilibria if one or more component has 0 composition#331
Conversation
8e17223 to
7eef180
Compare
Contributor
Author
|
I suggest merging these fixes for critical points and the tp flash and postponing bubble and dew points to a later stage. While these fixes only marginally affect convergence (through a slightly different stopping criterion), changing the bubble/dew point routines would mean a more thorough rewrite that would likely also have an influence on the convergence behavior of the method. |
g-bauer
approved these changes
Jan 15, 2026
prehner
added a commit
that referenced
this pull request
Jan 25, 2026
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.
This is based on the discussion in #254
This issue seems to affect most phase equilibrium algorithms in feos. We focus on the most important ones
Critical points ✅
The issue is related to the eigenvectors of the 0 components, as well as their composition going to 0 which creates numerical problems. I did not find a way to circumvent this by rewriting the expressions, but we can simply catch the special case (although that might effect the calculation of derivatives)Bubble and dew points ℹ️
There are actually a number of points where x_i=0 leads to failure:Tp flash ✅
An actual bug that set `ln(x/y)` to zero instead of the residual `ln(x phi_l/(y phi_v))`. Fixed by changing the residual (which is only used for determining convergence) from `ln(x phi_l/(y phi_v))` to `x phi_l/phi_v - y`.