Fix calculation of phase equilibria if one or more component has 0 composition #331
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⚠️
Did not have a look yet, but I feel like this was actually working and regressed in 0.9, so should be fixable.