{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "from pycalphad import equilibrium\n", "from pycalphad import Database, Model\n", "import pycalphad.variables as v" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Components: AL CO CR NI VA\n", "Phases: BCC_B2 HCP_A3 L12_FCC LIQUID [done]\n", "Computing initial grid [564 points, 92.6KB]\n", "Computing convex hull [iteration 1]\n", "progress 19.288055434586827\n", "Refining convex hull\n", "Rebuilding grid [580 points, 95.2KB]\n", "Computing convex hull [iteration 2]\n", "progress 0.4652835373202756\n", "Refining convex hull\n", "Rebuilding grid [596 points, 97.9KB]\n", "Computing convex hull [iteration 3]\n", "progress 0.3324503400628075\n", "Refining convex hull\n", "Rebuilding grid [612 points, 100.5KB]\n", "Computing convex hull [iteration 4]\n", "progress 0.020028744402992384\n", "Refining convex hull\n", "Rebuilding grid [628 points, 103.1KB]\n", "Computing convex hull [iteration 5]\n", "progress 0.44804143838362037\n", "Refining convex hull\n", "Rebuilding grid [644 points, 105.7KB]\n", "Computing convex hull [iteration 6]\n", "progress 0.35943117982930717\n", "Refining convex hull\n", "Rebuilding grid [660 points, 108.4KB]\n", "Computing convex hull [iteration 7]\n", "progress 0.39743817491223377\n", "Refining convex hull\n", "Rebuilding grid [676 points, 111.0KB]\n", "Computing convex hull [iteration 8]\n", "progress 0.08128427815893714\n", "Refining convex hull\n", "Rebuilding grid [692 points, 113.6KB]\n", "Computing convex hull [iteration 9]\n", "progress 0.19519938369872106\n", "Refining convex hull\n", "Rebuilding grid [708 points, 116.2KB]\n", "Computing convex hull [iteration 10]\n", "progress 0.09114047582941227\n", "Refining convex hull\n", "Rebuilding grid [724 points, 118.9KB]\n", "Computing convex hull [iteration 11]\n", "progress 0.10305668905029851\n", "Refining convex hull\n", "Rebuilding grid [740 points, 121.5KB]\n", "Computing convex hull [iteration 12]\n", "progress 0.0\n", "Convergence achieved\n", "CPU times: user 1h 20min 56s, sys: 3.26 s, total: 1h 20min 59s\n", "Wall time: 1h 20min 54s\n", "\n", "Dimensions: (T: 1, X_AL: 1, X_CO: 1, X_CR: 1, component: 4, internal_dof: 11, vertex: 4)\n", "Coordinates:\n", " * T (T) float64 1.373e+03\n", " * X_AL (X_AL) float64 0.2\n", " * X_CO (X_CO) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * vertex (vertex) int64 0 1 2 3\n", " * component (component) object 'AL' 'CO' 'CR' 'NI'\n", " * internal_dof (internal_dof) int64 0 1 2 3 4 5 6 7 8 9 10\n", "Data variables:\n", " MU (T, X_AL, X_CO, X_CR, component) float64 -1.632e+05 ...\n", " GM (T, X_AL, X_CO, X_CR) float64 -1.006e+05\n", " NP (T, X_AL, X_CO, X_CR, vertex) float64 0.4473 0.4243 0.1166 ...\n", " X (T, X_AL, X_CO, X_CR, vertex, component) float64 0.3238 ...\n", " Y (T, X_AL, X_CO, X_CR, vertex, internal_dof) float64 6.019e-05 ...\n", " Phase (T, X_AL, X_CO, X_CR, vertex) object 'BCC_B2' 'L12_FCC' ...\n", "Attributes:\n", " iterations: 12\n" ] } ], "source": [ "dbf = Database('craldad_for_pandat.TDB')\n", "phases = ['LIQUID', 'L12_FCC', 'BCC_B2', 'HCP_A3']\n", "%time eq = equilibrium(dbf, ['AL', 'CO', 'NI', 'CR', 'VA'] , phases,\\\n", " {v.X('AL'): 0.20, v.X('CO'): 0.2, v.X('CR'): 0.2, v.T: 1373})\n", "print(eq)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "array([[[[-100572.24799322]]]])\n", "Coordinates:\n", " * X_AL (X_AL) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * T (T) float64 1.373e+03\n", " * X_CO (X_CO) float64 0.2\n", "\n", "array([[[[[[ 0.32378609, 0.12005975, 0.08400686, 0.47214247],\n", " [ 0.09906774, 0.26864454, 0.29603664, 0.33625108],\n", " [ 0.10177295, 0.24934209, 0.29031305, 0.35857191],\n", " [ 0.10827891, 0.27380119, 0.25075019, 0.36716971]]]]]])\n", "Coordinates:\n", " * vertex (vertex) int64 0 1 2 3\n", " * component (component) object 'AL' 'CO' 'CR' 'NI'\n", " * X_AL (X_AL) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * T (T) float64 1.373e+03\n", " * X_CO (X_CO) float64 0.2\n", "\n", "array([[[[[[ 6.01858584e-05, 1.63208810e-01, 2.56291059e-02,\n", " 8.10084852e-01, 1.01958685e-03, 6.47180842e-01,\n", " 7.67879023e-02, 1.42298694e-01, 1.33717205e-01,\n", " 3.18176785e-06, 9.99999999e-01],\n", " [ 9.84862920e-02, 2.63435731e-01, 2.91585171e-01,\n", " 3.46492806e-01, 1.00812073e-01, 2.84270965e-01,\n", " 3.09391056e-01, 3.05525906e-01, 1.00000000e+00,\n", " nan, nan],\n", " [ 1.03989179e-01, 2.50388853e-01, 2.93573704e-01,\n", " 3.52048263e-01, 9.51242691e-02, 2.46201805e-01,\n", " 2.80531070e-01, 3.78142856e-01, 1.00000000e+00,\n", " nan, nan],\n", " [ 1.06547158e-01, 2.76213045e-01, 2.48644546e-01,\n", " 3.68595252e-01, 1.13474173e-01, 2.66565634e-01,\n", " 2.57067125e-01, 3.62893068e-01, 1.00000000e+00,\n", " nan, nan]]]]]])\n", "Coordinates:\n", " * vertex (vertex) int64 0 1 2 3\n", " * X_AL (X_AL) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * T (T) float64 1.373e+03\n", " * X_CO (X_CO) float64 0.2\n", " * internal_dof (internal_dof) int64 0 1 2 3 4 5 6 7 8 9 10\n", "\n", "array([[[[['BCC_B2', 'L12_FCC', 'L12_FCC', 'L12_FCC']]]]], dtype=object)\n", "Coordinates:\n", " * vertex (vertex) int64 0 1 2 3\n", " * X_AL (X_AL) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * T (T) float64 1.373e+03\n", " * X_CO (X_CO) float64 0.2\n", "\n", "array([[[[[-163157.67075898, -89072.63746383, -65999.92570852,\n", " -92315.50301739]]]]])\n", "Coordinates:\n", " * component (component) object 'AL' 'CO' 'CR' 'NI'\n", " * X_AL (X_AL) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * T (T) float64 1.373e+03\n", " * X_CO (X_CO) float64 0.2\n", "\n", "array([[[[[ 0.4472588 , 0.42427707, 0.1165914 , 0.01187488]]]]])\n", "Coordinates:\n", " * vertex (vertex) int64 0 1 2 3\n", " * X_AL (X_AL) float64 0.2\n", " * X_CR (X_CR) float64 0.2\n", " * T (T) float64 1.373e+03\n", " * X_CO (X_CO) float64 0.2\n" ] } ], "source": [ "print(eq.GM)\n", "print(eq.X)\n", "print(eq.Y)\n", "print(eq.Phase)\n", "print(eq.MU)\n", "print(eq.NP)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.3" } }, "nbformat": 4, "nbformat_minor": 0 }