scheil package

Submodules

scheil.ordering module

Utilities for distinguishing and renaming ordered and disordered configurations of multi-sublattice phases.

OrderingRecord objects are able to be used for any phase. OrderingRecords can be created automatically for phases modeled with a partitioned order/disorder model through the create_ordering_records method, since the partitioned model contains all the information about the ordered and disordered phase.

class scheil.ordering.OrderingRecord(ordered_phase_name: str, disordered_phase_name: str, subl_dof: Sequence[int], symmetric_subl_idx: Sequence[Sequence[int]])

Bases: object

disordered_phase_name: str
is_disordered(site_fractions)
ordered_phase_name: str
subl_dof: Sequence[int]
symmetric_subl_idx: Sequence[Sequence[int]]
scheil.ordering.create_ordering_records(dbf, comps, phases) list[OrderingRecord]

Return a dictionary with the sublattice degrees of freedom and equivalent sublattices for order/disorder phases

Parameters:
  • dbf (pycalphad.Database)

  • comps (list[str]) – List of active components to consider

  • phases (list[str]) – List of active phases to consider

Return type:

List[OrderingRecord]

Notes

Phases which should be checked for ordered/disordered configurations are determined heuristically for this script.

The heuristic for a phase satisfies the following: 1. The phase is the ordered part of an order-disorder model 2. The equivalent sublattices have all the same number of elements

scheil.ordering.rename_disordered_phases(eq_result, ordering_records)

Modify an xarray Dataset to rename the ordered phase names to the disordered phase names if the equilibrium configuration is disordered

Parameters:
  • eq_result (xarray.Dataset)

  • order_disorder_dict (OrderingRecord) – Output from scheil.utils.order_disorder_dict

Returns:

Dataset modified in-place

Return type:

xrray.Dataset

Notes

This function does _not_ change the site fractions array of the disordered configurations to match the site fractions matching the internal degrees of freedom of the disordered phase’s constituents (although that should be possible).

Examples

>>> from pycalphad import Database, equilibrium, variables as v
>>> import pycalphad.tests.databases
>>> from importlib.resources import files
>>> dbf = Database(str(files(pycalphad.tests.databases).joinpath("alcfe_b2.tdb")))
>>> comps = ['AL', 'FE', 'VA']
>>> phases = list(dbf.phases.keys())
>>> eq_res = equilibrium(dbf, comps, ['B2_BCC'], {v.P: 101325, v.T: 1000, v.N: 1, v.X('AL'): [0.1, 0.4]})
>>> ordering_records = create_ordering_records(dbf, comps, phases)
>>> eq_res.Phase.values.squeeze().tolist()
[['B2_BCC', '', ''], ['B2_BCC', '', '']]
>>> out_result = rename_disordered_phases(eq_res, ordering_records)
>>> eq_res.Phase.values.squeeze().tolist()
[['A2_BCC', '', ''], ['B2_BCC', '', '']]

scheil.simulate module

scheil.simulate.is_converged(wks)

Return true if there are phase fractions that are non-NaN

Parameters:

eq (pycalphad.LightDataset)

scheil.simulate.simulate_equilibrium_solidification(dbf, comps, phases, composition, start_temperature, step_temperature=1.0, liquid_phase_name='LIQUID', adaptive=True, eq_kwargs=None, binary_search_tol=0.1, verbose=False, output: list[str | ComputableProperty] | None = None)

Compute the equilibrium solidification path.

Decreases temperature until no liquid is found, performing a binary search to get the soildus temperature.

dbfpycalphad.Database

Database object.

compslist

List of components in the system.

phaseslist

List of phases in the system.

compositionDict[v.X, float]

Dictionary of independent v.X composition variables.

start_temperaturefloat

Starting temperature for simulation. Should be single phase liquid.

step_temperatureOptional[float]

Temperature step size. Defaults to 1.0.

liquid_phase_nameOptional[str]

Name of the phase treated as liquid (i.e. the phase with infinitely fast diffusion). Defaults to ‘LIQUID’.

eq_kwargs: Optional[Dict[str, Any]]

Keyword arguments for equilibrium

binary_search_tolfloat

Stop the binary search when the difference between temperatures is less than this amount.

adaptive: Optional[bool]

Whether to add additional points near the equilibrium points at each step. Only takes effect if points is in the eq_kwargs dict.

output: list[str | ComputableProperty] | None

List of PyCalphad computable properties to access (via Workspace.get()) at each temperature. In equilibrium solidification simulations, the outputs will be the equilibrium (“cumulative”) properties at each time step and may need post-processing to be useful.

scheil.simulate.simulate_scheil_solidification(dbf, comps, phases, composition, start_temperature, step_temperature=1.0, liquid_phase_name='LIQUID', eq_kwargs=None, stop=0.0001, verbose=False, adaptive=True, output: list[str | ComputableProperty] | None = None)

Perform a Scheil-Gulliver solidification simulation.

Parameters:
  • dbf (pycalphad.Database) – Database object.

  • comps (list) – List of components in the system.

  • phases (list) – List of phases in the system.

  • composition (Dict[v.X, float]) – Dictionary of independent v.X composition variables.

  • start_temperature (float) – Starting temperature for simulation. Must be single phase liquid.

  • step_temperature (Optional[float]) – Temperature step size. Defaults to 1.0.

  • liquid_phase_name (Optional[str]) – Name of the phase treated as liquid (i.e. the phase with infinitely fast diffusion). Defaults to ‘LIQUID’.

  • eq_kwargs (Optional[Dict[str, Any]]) – Keyword arguments for equilibrium

  • stop (Optional[float]) – Stop when the phase fraction of liquid is below this amount.

  • adaptive (Optional[bool]) – Whether to add additional points near the equilibrium points at each step. Only takes effect if points is in the eq_kwargs dict.

  • output (list[str | ComputableProperty] | None,) – List of PyCalphad computable properties to access (via Workspace.get()) at each temperature. For Scheil simulations, the outputs will contain properties for “instantaneous” (N=1) properties each temperature step and may need post-processing to be useful.

Return type:

SolidificationResult

scheil.solidification_result module

class scheil.solidification_result.SolidificationResult(phase_compositions, fraction_solid, temperatures, phase_amounts, converged, method, output: dict[str, Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]] | None = None, validate_invariants=True)

Bases: object

Data from an equilibrium or Scheil-Gulliver solidification simulation.

Parameters:
  • phase_compositions (Mapping[PhaseName, Mapping[ComponentName, List[float]]]) – Mapping of component name to composition at each temperature.

  • fraction_solid (List[float]) – Fraction of solid at each temperature.

  • temperatures (List[float]) – List of simulation temperatures.

  • phase_amounts (Dict[str, float]) – Map of {phase_name: amount_list} for solid phases where amount_list is a list of instantaneus phase amounts at each temperature. Should be less than 1 unless the solidification all occured in 1 step (e.g. solidification at the eutectic composition)

  • converged (bool) – For Scheil: True if the liquid stopping criteria was met. False otherwise For equilibrium: True if no liquid remains, False otherwise.

  • method (str) – Method used to create the solidification result, should be “scheil” or “equilibrium”

phase_compositions
Type:

Mapping[PhaseName, Mapping[ComponentName, List[float]]]

fraction_solid
Type:

List[float]

temperatures
Type:

List[float]

phase_amounts
Type:

Dict[str, float]

method
Type:

str

fraction_liquid

Fraction of liquid at each temperature (convenience for 1-fraction_solid)

Type:

List[float]

cum_phase_amounts

Map of {phase_name: amount_list} for solid phases where amount_list is a list of cumulative phase amounts at each temperature.

Type:

Dict[str, list]

classmethod from_dict(d)
to_dataframe(include_zero_phases=True)
Parameters:

include_zero_phases (Optional[bool]) – If True (the default), phases that never become stable in the simulation will be included.

to_dict()

scheil.utils module

scheil.utils.get_phase_amounts(eq_phases, phase_fractions, all_phases)

Return the phase fraction for each phase in equilibrium

Parameters:
  • eq_phases (Sequence[str]) – Equilibrium phases

  • phase_fractions (Sequence[float]) – Phase amounts corresponding to the equilibrium phases

  • all_phases (Sequence[str]) – All phases that we want to keep track of in the system.

Return type:

Dict[str, float]

scheil.utils.local_sample(sitefracs, comp_count, pdens=100, stddev=0.05)

Sample from a normal distribution around the optimal site fractions

Parameters:
  • sitefracs (np.ndarray[:, :]) – 2d array of site fractions of shape (N, len(dof))

  • comp_count (Sequence[int]) – Number of active components in each sublattice, e.g. (FE,NI,TI)(FE,NI)(FE,NI,TI) is [3, 2, 3]

  • pdens (Optional[int]) – Number of points to add locally

  • stddev (Optional[float]) – Standard deviation for the normal distribution to sample from

Returns:

np.ndarray[ – Shape (pdens, len(dof))

Return type:

, :]

Module contents

scheil