Skip to content

tkphd/ternary-phase-diagram

Repository files navigation

ternary-phase-diagram

This repository presents the math and code required to construct the thermodynamic phase diagram for a ternary alloy system containing two or three phases.

example-diagram

A ternary phase diagram, for example.

A Makefile is provided to build both the documentation and a shared library required to efficiently crunch the numbers. The derivation is written in LaTeX, while the implementation is in Python.

Dependencies

  • To use the Makefile, you will need make.
  • To build the derivation, you will need a LaTeX distribution.
  • To build the shared library, you will need a scientific Python distribution (e.g., Anaconda, Canopy, Python(x,y)) and SymPy, which is available from GitHub or PyPI (pip install sympy).

Usage

With these dependencies met, you can regenerate the example phase diagram with

  $ make

This triggers a three-stage process:

  1. Evaluate free-energies.py to write three paraboloid free energies (one per phase) to C expressions:
    $ python free-energies.py
  2. Compile the C expressions to a shared library:
    $ gcc -Wall -fPIC -shared paraboloids.c -o paraboloids.so
  3. Execute phase-diagram.py to draw the pretty picture:
    $ python phase-diagram.py

To rebuild the documentation, simply

  $ make docs

Reuse

To make this code your own, edit free-energies.py and refine (or redefine) the three pure-phase free energy expressions: GA, GB, and GC. Perhaps start with increasing curvatures, or change skew to change the amount of "squish" along the $x_1 = x_2$ line. If you change the arguments required to evaluate a function, you will also need to modify pyCinterface.py accordingly. When you're done, simply

  $ make

If things aren't making sense, it might make sense to visualize your free energy landscape. The utility file ternary-landscape.py will convert your free energy landscape to a grayscale contour plot. Run

  $ python ternary-landscape.py

About

Derivation and construction of a thermodynamic phase diagram for ternary alloy systems with 2 or 3 phases

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published