Example #1
0
def test_binplot_minimum():
    "Bare minimum: binplot produces a result with no errors."
    # This test breaks on a lot of buildbots
    raise nose.SkipTest
    my_phases_alfe = [
        'LIQUID', 'FCC_A1', 'HCP_A3', 'AL5FE2', 'AL2FE', 'AL13FE4', 'AL5FE4'
    ]
    binplot(DBF_ALFE, ['AL', 'FE', 'VA'], my_phases_alfe, 'X(AL)', 300, 2000)
Example #2
0
import matplotlib.pyplot as plt
from pycalphad import Database, Model, binplot
from pycalphad.core.utils import make_callable
import pycalphad.variables as v

db = Database('Fe-C_Fei_Brosh_2014_09.TDB')
fig = binplot(db, ['FE', 'C', 'VA'],
              list(db.phases.keys()),
              'X(C)',
              300.0,
              2000.0,
              P=1e10)
plt.savefig('FeC.png')
Example #3
0
def test_binplot_minimum():
    "Bare minimum: binplot produces a result with no errors."
    # Purposefully dropping BCC_B2 here because it takes too long to compute
    # Future versions of binplot will address this and check for correctness
    my_phases_alfe = ['LIQUID', 'FCC_A1', 'HCP_A3', 'AL5FE2', 'AL2FE', 'AL13FE4', 'AL5FE4']
    binplot(DBF_ALFE, ['AL', 'FE', 'VA'], my_phases_alfe, 'X(AL)', 300, 2000)
Example #4
0
import matplotlib.pyplot as plt
from pycalphad import Database, Model, binplot
from pycalphad.core.utils import make_callable
import pycalphad.variables as v

db = Database('Fe-C_Fei_Brosh_2014_09.TDB')
fig = binplot(db, ['FE', 'C', 'VA'], list(db.phases.keys()), 'X(C)', 300.0, 2000.0, P=1e10)
plt.savefig('FeC.png')
def fprime(x, a, b, c, d, e, f, g, h, i, j):
    return 10 * a * x**9 + 9 * b * x**8 + 8 * c * x**7 + 7 * d * x**6 + 6 * e * x**5 + 5 * f * x**4 + 4 * g * x**3 + 3 * h * x**2 + 2 * i * x + j


# Cu-Ni (S. an Mey 1999)
db_cuni = Database('CuNi_RWTH.tdb')
my_phases_cuni = ['FCC_A1', 'LIQUID', 'BCC_A2', 'HCP_A3']

# Calculate Isobaric Binary Phase Diagram
if not os.path.isfile('CuNi.png'):
    fig = plt.figure(figsize=(9, 6))
    binplot(db_cuni, ['CU', 'NI', 'VA'],
            my_phases_cuni, {
                v.X('NI'): (0, 1, 0.01),
                v.T: (1300, 1800, 5),
                v.P: 101325
            },
            ax=fig.gca())
    plt.savefig('CuNi.png', dpi=400, bbox_inches='tight')
    plt.close()

# It is very common in CALPHAD modeling to directly examine the Gibbs energy surface of all the constituent phases in a system.
# Below we show how the Gibbs energy of all phases may be calculated as a function of composition at a given temperature (1550 K).

# Calculate Energy Surfaces of Binary Systems
if not os.path.isfile('CuNi_energy.png'):
    legend_handles, colorlist = phase_legend(my_phases_cuni)
    fig = plt.figure(figsize=(9, 6))
    ax = fig.gca()
    xref = np.linspace(-0.1, 1.1, 150)
from scipy.optimize import curve_fit, newton
import os.path

def func(x, a, b, c, d, e, f, g, h, i, j, k):
    return a*x**10 + b*x**9 + c*x**8 + d*x**7 + e*x**6 + f*x**5 + g*x**4 + h*x**3 + i*x**2 + j*x + k
def fprime(x, a, b, c, d, e, f, g, h, i, j):
    return 10*a*x**9 + 9*b*x**8 + 8*c*x**7 + 7*d*x**6 + 6*e*x**5 + 5*f*x**4 + 4*g*x**3 + 3*h*x**2 + 2*i*x + j

# Cu-Ni (S. an Mey 1999)
db_cuni = Database('CuNi_RWTH.tdb')
my_phases_cuni = ['FCC_A1', 'LIQUID', 'BCC_A2', 'HCP_A3']

# Calculate Isobaric Binary Phase Diagram
if not os.path.isfile('CuNi.png'):
    fig = plt.figure(figsize=(9,6))
    binplot(db_cuni, ['CU', 'NI', 'VA'] , my_phases_cuni, {v.X('NI'):(0,1,0.01),  v.T: (1300, 1800, 5), v.P:101325},  ax=fig.gca())
    plt.savefig('CuNi.png', dpi=400, bbox_inches='tight')
    plt.close()


# It is very common in CALPHAD modeling to directly examine the Gibbs energy surface of all the constituent phases in a system.
# Below we show how the Gibbs energy of all phases may be calculated as a function of composition at a given temperature (1550 K).


# Calculate Energy Surfaces of Binary Systems
if not os.path.isfile('CuNi_energy.png'):
    legend_handles, colorlist = phase_legend(my_phases_cuni)
    fig = plt.figure(figsize=(9,6))
    ax = fig.gca()
    xref = np.linspace(-0.1,1.1,150)
    for name in my_phases_cuni:
Example #7
0
def test_binplot_minimum():
    "Bare minimum: binplot produces a result with no errors."
    # This test breaks on a lot of buildbots
    raise nose.SkipTest
    my_phases_alfe = ['LIQUID', 'FCC_A1', 'HCP_A3', 'AL5FE2', 'AL2FE', 'AL13FE4', 'AL5FE4']
    binplot(DBF_ALFE, ['AL', 'FE', 'VA'], my_phases_alfe, 'X(AL)', 300, 2000)