Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix eqplot for tie-triangles #288

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Conversation

bocklund
Copy link
Collaborator

@bocklund bocklund commented Dec 2, 2020

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 using eqplot, they would see an exception because eqplot tries to find the composition of two independent components when plotting the tie-triangles, but only one independent composition existed. This PR changes eqplot.py:153 from if three_phase_idx[0].size > 0: to if (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.

@richardotis richardotis self-requested a review December 2, 2020 20:50
@bocklund bocklund merged commit 415e759 into develop Dec 2, 2020
@bocklund bocklund deleted the fix-eqplot-three-phase-T_X branch December 2, 2020 20:56
@bocklund bocklund added this to the 0.8.5 milestone Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants