Git Product home page Git Product logo

ternary-phase-diagram's Introduction

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

ternary-phase-diagram's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.