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.
In 2D phase diagrams, 2D three phase regions (and tie-triangles) can only exist in where two molar quantities are axis variables. A binary temperature-composition phase diagram can only have three phases exist on an invariant line that occurs at an infinitesimally small temperature. In a binary system under fixed pressure, temperature and composition conditions, it should be impossible to find three phases in equilibrium, however numerically it is possible to achieve three phase stability within pycalphad's convergence limits under these conditions.
eqplot
only supports T-X binary phase diagrams and X-X ternary isothermal phase diagrams, and implicitly assumes that all three phase equilibria belong to a three phase region in a isothermal phase diagram. If three phases were found to be stable in a binary system and a user tried to plot the phase diagram usingeqplot
, they would see an exception becauseeqplot
tries to find the composition of two independent components when plotting the tie-triangles, but only one independent composition existed. This PR changeseqplot.py:153
fromif three_phase_idx[0].size > 0:
toif (three_phase_idx[0].size > 0) and (len(indep_comps) == 2):
, i.e. tie-triangles will only be plotted if there are two independent composition conditions.I tried to write a test case that exercised the behavior before the PR (raising an except for a three phase equilibrium), but I wasn't able to create a database or use an existing example that reproduced a three phase equilibrium in a binary system.
This PR has some minor code quality cleanups and documentation corrections.