• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pycalphad.equilibrium函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pycalphad.equilibrium函数的典型用法代码示例。如果您正苦于以下问题:Python equilibrium函数的具体用法?Python equilibrium怎么用?Python equilibrium使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了equilibrium函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_eq_output_property

def test_eq_output_property():
    """
    Extra properties can be specified to `equilibrium`.
    """
    equilibrium(ALFE_DBF, ['AL', 'FE', 'VA'], ['LIQUID', 'B2_BCC'],
                {v.X('AL'): 0.25, v.T: (300, 2000, 500), v.P: 101325},
                output=['heat_capacity', 'degree_of_ordering'], pbar=False)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:7,代码来源:test_equilibrium.py


示例2: test_eq_on_endmember

def test_eq_on_endmember():
    """
    When the composition condition is right on top of an end-member
    the convex hull is still correctly constructed (gh-28).
    """
    equilibrium(ALFE_DBF, ['AL', 'FE', 'VA'], ['LIQUID', 'B2_BCC'],
                {v.X('AL'): [0.4, 0.5, 0.6], v.T: [300, 600], v.P: 101325}, pbar=False)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:7,代码来源:test_equilibrium.py


示例3: test_eq_b2_without_all_comps

def test_eq_b2_without_all_comps():
    """
    All-vacancy endmembers are correctly excluded from the computation when fewer than
    all components in a Database are selected for the calculation.
    """
    equilibrium(Database(ALNIPT_TDB), ['AL', 'NI', 'VA'], 'BCC_B2', {v.X('NI'): 0.4, v.P: 101325, v.T: 1200},
                verbose=True, pbar=False)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:7,代码来源:test_equilibrium.py


示例4: test_eq_overdetermined_comps

def test_eq_overdetermined_comps():
    """
    The number of composition conditions should yield exactly one dependent component.
    This is the overdetermined case.
    """
    equilibrium(ALFE_DBF, ['AL', 'FE'], 'LIQUID', {v.T: 2000, v.P: 101325,
                                                   v.X('FE'): 0.2, v.X('AL'): 0.8}, pbar=False)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:7,代码来源:test_equilibrium.py


示例5: test_eq_missing_component

def test_eq_missing_component():
    """
    Specifying a condition involving a non-existent component raises an error.
    """
    # No Co or Cr in this database ; Co condition specification should cause failure
    equilibrium(ALNIFCC4SL_DBF, ['AL', 'NI', 'VA'], ['LIQUID'],
                {v.T: 1523, v.X('AL'): 0.88811111111111107,
                 v.X('CO'): 0.11188888888888888, v.P: 101325}, pbar=False)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:8,代码来源:test_equilibrium.py


示例6: test_dilute_condition

def test_dilute_condition():
    """
    'Zero' and dilute composition conditions are correctly handled.
    """
    eq = equilibrium(ALFE_DBF, ["AL", "FE", "VA"], "FCC_A1", {v.T: 1300, v.P: 101325, v.X("AL"): 0}, pbar=False)
    assert_allclose(np.squeeze(eq.GM.values), -64415.84, atol=0.1)
    eq = equilibrium(ALFE_DBF, ["AL", "FE", "VA"], "FCC_A1", {v.T: 1300, v.P: 101325, v.X("AL"): 1e-8}, pbar=False)
    assert_allclose(np.squeeze(eq.GM.values), -64415.84069827)
    assert_allclose(eq.MU.values, [[[[-335723.04320981, -64415.8379852]]]], atol=0.1)
开发者ID:pycalphad,项目名称:pycalphad,代码行数:9,代码来源:test_equilibrium.py


示例7: test_eq_on_endmember

def test_eq_on_endmember():
    """
    When the composition condition is right on top of an end-member
    the convex hull is still correctly constructed (gh-28).
    """
    equilibrium(
        ALFE_DBF,
        ["AL", "FE", "VA"],
        ["LIQUID", "B2_BCC"],
        {v.X("AL"): [0.4, 0.5, 0.6], v.T: [300, 600], v.P: 101325},
        pbar=False,
    )
开发者ID:pycalphad,项目名称:pycalphad,代码行数:12,代码来源:test_equilibrium.py


示例8: test_eq_missing_component

def test_eq_missing_component():
    """
    Specifying a condition involving a non-existent component raises an error.
    """
    # No Co or Cr in this database ; Co condition specification should cause failure
    equilibrium(
        ALNIFCC4SL_DBF,
        ["AL", "NI", "VA"],
        ["LIQUID"],
        {v.T: 1523, v.X("AL"): 0.88811111111111107, v.X("CO"): 0.11188888888888888, v.P: 101325},
        pbar=False,
    )
开发者ID:pycalphad,项目名称:pycalphad,代码行数:12,代码来源:test_equilibrium.py


示例9: test_eq_output_property

def test_eq_output_property():
    """
    Extra properties can be specified to `equilibrium`.
    """
    equilibrium(
        ALFE_DBF,
        ["AL", "FE", "VA"],
        ["LIQUID", "B2_BCC"],
        {v.X("AL"): 0.25, v.T: (300, 2000, 500), v.P: 101325},
        output=["heat_capacity", "degree_of_ordering"],
        pbar=False,
    )
开发者ID:pycalphad,项目名称:pycalphad,代码行数:12,代码来源:test_equilibrium.py


示例10: test_eq_binary

def test_eq_binary():
    "Binary phase diagram point equilibrium calculation with magnetism."
    my_phases = ["LIQUID", "FCC_A1", "HCP_A3", "AL5FE2", "AL2FE", "AL13FE4", "AL5FE4"]
    comps = ["AL", "FE", "VA"]
    conds = {v.T: 1400, v.P: 101325, v.X("AL"): 0.55}
    eqx = equilibrium(ALFE_DBF, comps, my_phases, conds, pbar=False)
    assert_allclose(eqx.GM.values.flat[0], -9.608807e4)
开发者ID:pycalphad,项目名称:pycalphad,代码行数:7,代码来源:test_equilibrium.py


示例11: test_eq_binary

def test_eq_binary():
    "Binary phase diagram point equilibrium calculation with magnetism."
    my_phases = ['LIQUID', 'FCC_A1', 'HCP_A3', 'AL5FE2',
                 'AL2FE', 'AL13FE4', 'AL5FE4']
    comps = ['AL', 'FE', 'VA']
    conds = {v.T: 1400, v.P: 101325, v.X('AL'): 0.55}
    eqx = equilibrium(ALFE_DBF, comps, my_phases, conds, pbar=False)
    assert_allclose(eqx.GM.values.flat[0], -9.608807e4)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:8,代码来源:test_equilibrium.py


示例12: test_degree_of_ordering

def test_degree_of_ordering():
    "Degree of ordering should be calculated properly."
    my_phases = ['B2_BCC']
    comps = ['AL', 'FE', 'VA']
    conds = {v.T: 300, v.P: 101325, v.X('AL'): 0.25}
    eqx = equilibrium(ALFE_DBF, comps, my_phases, conds, output='degree_of_ordering', verbose=True)
    print('Degree of ordering: {}'.format(eqx.degree_of_ordering.sel(vertex=0).values.flatten()))
    assert np.isclose(eqx.degree_of_ordering.sel(vertex=0).values.flatten(), np.array([0.66663873]))
开发者ID:pycalphad,项目名称:pycalphad,代码行数:8,代码来源:test_model.py


示例13: test_eq_single_phase

def test_eq_single_phase():
    "Equilibrium energy should be the same as for a single phase with no miscibility gaps."
    res = calculate(ALFE_DBF, ['AL', 'FE'], 'LIQUID', T=[1400, 2500], P=101325,
                    points={'LIQUID': [[0.1, 0.9], [0.2, 0.8], [0.3, 0.7],
                                       [0.7, 0.3], [0.8, 0.2]]})
    eq = equilibrium(ALFE_DBF, ['AL', 'FE'], 'LIQUID',
                     {v.T: [1400, 2500], v.P: 101325,
                      v.X('AL'): [0.1, 0.2, 0.3, 0.7, 0.8]}, verbose=True, pbar=False)
    assert_allclose(eq.GM, res.GM, atol=0.1)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:9,代码来源:test_equilibrium.py


示例14: test_rose_nine

def test_rose_nine():
    "Nine-component rose diagram point equilibrium calculation."
    my_phases_rose = ['TEST']
    comps = ['H', 'HE', 'LI', 'BE', 'B', 'C', 'N', 'O', 'F']
    conds = dict({v.T: 1000, v.P: 101325})
    for comp in comps[:-1]:
        conds[v.X(comp)] = 1.0/float(len(comps))
    eqx = equilibrium(ROSE_DBF, comps, my_phases_rose, conds, pbar=False)
    assert_allclose(eqx.GM.values.flat[0], -5.8351e3)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:9,代码来源:test_equilibrium.py


示例15: test_eq_four_sublattice

def test_eq_four_sublattice():
    """
    Balancing mass in a multi-sublattice phase in a single-phase configuration.
    """
    eq = equilibrium(ALNIFCC4SL_DBF, ['AL', 'NI', 'VA'], 'FCC_L12',
                     {v.T: 1073, v.X('NI'): 0.7601, v.P: 101325}, pbar=False)
    assert_allclose(np.squeeze(eq.X.sel(vertex=0).values), [1-.7601, .7601])
    # Not a strict equality here because we can't yet reach TC's value of -87260.6
    assert eq.GM.values < -87256.3
开发者ID:hastelloy,项目名称:pycalphad,代码行数:9,代码来源:test_equilibrium.py


示例16: test_eq_illcond_magnetic_hessian

def test_eq_illcond_magnetic_hessian():
    """
    Check equilibrium of a system with an ill-conditioned Hessian due to magnetism (Tc->0).
    This is difficult to reproduce so we only include some known examples here.
    """
    # This set of conditions is known to trigger the issue
    eq = equilibrium(ALFE_DBF, ['AL', 'FE', 'VA'], ['FCC_A1', 'AL13FE4'],
                     {v.X('AL'): 0.8, v.T: 300, v.P: 1e5}, pbar=False)
    assert_allclose(eq.GM.values, [[[-31414.46677]]])
开发者ID:hastelloy,项目名称:pycalphad,代码行数:9,代码来源:test_equilibrium.py


示例17: test_rose_nine

def test_rose_nine():
    "Nine-component rose diagram point equilibrium calculation."
    my_phases_rose = ["TEST"]
    comps = ["H", "HE", "LI", "BE", "B", "C", "N", "O", "F"]
    conds = dict({v.T: 1000, v.P: 101325})
    for comp in comps[:-1]:
        conds[v.X(comp)] = 1.0 / float(len(comps))
    eqx = equilibrium(ROSE_DBF, comps, my_phases_rose, conds, pbar=False)
    assert_allclose(eqx.GM.values.flat[0], -5.8351e3, atol=0.1)
开发者ID:pycalphad,项目名称:pycalphad,代码行数:9,代码来源:test_equilibrium.py


示例18: test_eq_ternary_edge_case_mass

def test_eq_ternary_edge_case_mass():
    """
    Equilibrium along an edge of composition space will still balance mass.
    """
    eq = equilibrium(ALCOCRNI_DBF, ['AL', 'CO', 'CR', 'VA'], ['L12_FCC', 'BCC_B2', 'LIQUID'],
                     {v.T: 1523, v.X('AL'): 0.88811111111111107,
                      v.X('CO'): 0.11188888888888888, v.P: 101325}, pbar=False)
    mass_error = np.nansum(np.squeeze(eq.NP * eq.X), axis=-2) - \
                 [0.88811111111111107, 0.11188888888888888, 0]
    assert np.all(np.abs(mass_error) < 0.01)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:10,代码来源:test_equilibrium.py


示例19: test_eq_ternary_inside_mass

def test_eq_ternary_inside_mass():
    """
    Equilibrium in interior of composition space will still balance mass.
    """
    eq = equilibrium(ALCOCRNI_DBF, ['AL', 'CO', 'CR', 'VA'], ['L12_FCC', 'BCC_B2', 'LIQUID'],
                     {v.T: 1523, v.X('AL'): 0.44455555555555554,
                      v.X('CO'): 0.22277777777777777, v.P: 101325}, pbar=False)
    mass_error = np.nansum(np.squeeze(eq.NP * eq.X), axis=-2) - \
                 [0.44455555555555554, 0.22277777777777777, 0.333]
    assert np.all(np.abs(mass_error) < 0.01)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:10,代码来源:test_equilibrium.py


示例20: test_eq_ternary_edge_misc_gap

def test_eq_ternary_edge_misc_gap():
    """
    Equilibrium at edge of miscibility gap will still balance mass.
    """
    eq = equilibrium(ALCOCRNI_DBF, ['AL', 'CO', 'CR', 'VA'], ['L12_FCC', 'BCC_B2', 'LIQUID'],
                     {v.T: 1523, v.X('AL'): 0.33366666666666667,
                      v.X('CO'): 0.44455555555555554, v.P: 101325}, pbar=False)
    mass_error = np.nansum(np.squeeze(eq.NP * eq.X), axis=-2) - \
                 [0.33366666666666667, 0.44455555555555554, 0.22177777777777785]
    assert np.all(np.abs(mass_error) < 0.001)
开发者ID:hastelloy,项目名称:pycalphad,代码行数:10,代码来源:test_equilibrium.py



注:本文中的pycalphad.equilibrium函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pycalphad.Database类代码示例发布时间:2022-05-25
下一篇:
Python pycallgraph.start_trace函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap