PhasesResearchLab / ESPEI

Fitting thermodynamic models with pycalphad - https://doi.org/10.1557/mrc.2019.59
http://espei.org
MIT License
65 stars 32 forks source link

ENH: Allow entering the `__HYPERPLANE__` phase in ZPF vertices to control the compositions for the target hyperplane #221

Closed bocklund closed 2 years ago

bocklund commented 2 years ago

With this PR, one can define a phase region in a dataset as follows:

[["__HYPERPLANE__", ["CU"], [0.001015]], ["HCP_A3", ["CU"], [null]], ["CUMG2", ["CU"], [null]]]

which will result in estimating the target hyperplane at X(CU) = 0.001015 and the driving forces to that hyperplane for HCP_A3 and CUMG2 (in the same way as they are estimated now).

This allows users to more finely control how the target hyperplane is generated and allows the target hyperplane to be specified independently of any phases/phase compositions that are known. Multiple vertices with the __HYPERPLANE__ phase can be entered. If a __HYPERPLANE__ vertex is not present (i.e. all existing datasets), the current rules apply: each phase with a fully specified composition (no null entries) contributes to the target hyperplane at that composition.

Technical background

The likelihood function for phase boundary data based on computing the driving force of known phase compositions to a "target hyperplane" that represents the current chemical potentials in the measured phase region. It is often the case that one or more phases are known to be stable, but the compositions of those phases are not known. In these cases, we can estimate the driving force to the target hyperplane.

Currently, ESPEI computes the target hyperplane using the arithmetic mean of global minimum hyperplanes at each known phase composition. As a consequence, any particular phase equilibrium needed to have at least one known phase composition to be able to generate a target hyperplane. There are several types of experiments that produce phase boundary data, but none of the phase compositions can be determined by the measurement. This PR allows the overall compositions to be entered and used to determine the target hyperplane, and the driving forces can be computed as usual.

Example use cases of this feature

The typical use case of this feature corresponds to an experiment where the overall composition is known and the phases in equilibrium are known, but the phase compositions are not known. Some examples:

TODO before merging:

richardotis commented 2 years ago

Does this have any pathological interactions with potential miscibility gaps? I'm trying to reason about if there are cases where all the entered phases have zero driving force at the __HYPERPLANE__-specified composition, but mass does not balance. I think that case is impossible as long as the target hyperplane grid and the grids for the null phases are consistent with each other.

bocklund commented 2 years ago

Yes, using __HYPERPLANE__ could be a pathological case for miscibility gaps. Suppose you have near complete immiscibility:

In practice, I don't think it's an issue (or at least more of an issue than what currently exists). If you know the phase compositions, you're always safe regarding mass balance issues. If you don't know the phase compositions, there's a chance for mass balance issues.

Consider the following schematic example:

phase-comps

You know one of the phase compositions, for β phase, but you don't know the phase composition, for α phase. However, you do know based on the measurement, that the tie-line should be on the A-rich side. In the construction where the driving force of α is estimated, the driving force will come from the wrong side of the α gap.

From a dataset standpoint, this can be described in either the existing or the __HYPERPLANE notation and give equivalent representation of the target hyperplane and computed driving forces: