scheil package¶
Submodules¶
scheil.simulate module¶
- scheil.simulate.is_converged(eq)¶
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)¶
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.
- 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)¶
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.
- Returns
- Return type
- scheil.simulate.update_points(eq, points_dict, dof_dict, verbose=False)¶
- Parameters
eq (pycalphad.LightDataset) – Point equilibrium result.
points_dict (dict) – Map of phase name to array of points
dof_dict – Map of phase name to the sublattice degrees of freedom.
verbose (bool, optional) –
scheil.solidification_result module¶
- class scheil.solidification_result.SolidificationResult(x_liquid, fraction_solid, temperatures, phase_amounts, converged, method)¶
Bases:
object
Data from an equilibrium or Scheil-Gulliver solidification simulation.
- Parameters
x_liquid (Dict[str, 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”
- x_liquid¶
- Type
Dict[str, 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_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.
- Returns
- Return type
Dict[str, float]
- scheil.utils.is_ordered(site_fracs, subl_dof, symmetric_subl_idx, **kwargs)¶
Return True if the site fraction configuration is ordered
- Parameters
site_fracs (numpy.ndarray[float,N]) – Site fraction array for a phase of length sum(subl_dof) (can be padded with arbitrary data, as returned by equilibrium calculations).
subl_dof (list[int]) – List of the number of components active in each sublattice. Size should be equivalent to the number of sublattices in the phase.
symmetric_subl_idx (list[list[int]]) – List of sets of symmetrically equivalent sublattice indexes (as a list). If sublattices at index 0 and index 1 are symmetric, as index 2 and index 3, then the symmetric_subl_idx will be [[0, 1], [2, 3]].
kwargs – Additional keyword arguments passed to
np.isclose
to check if site fractions in symmetric sublattices are distinct.
- Returns
- Return type
bool
Examples
>>> dbf = Database('Fe-Ni-Ti.tdb') >>> subl_dof = [4, 4, 1] # sublattice model is (Fe,Ni,Ti,Va)(Fe,Ni,Ti,Va)(Va) >>> symm = [[0, 1]] # sublattices 0 and 1 should be equivalent >>> res = equilibrium(dbf, ['FE', 'NI', 'TI', 'VA'], ['BCC2'], {v.P: 101325, v.T: 1200, v.N: 1, v.X('FE'): 0.001, v.X('NI'): 0.001}) >>> is_ordered(res.Y.isel(vertex=0).values.squeeze(), subl_dof, symm) False >>> res = equilibrium(dbf, ['FE', 'NI', 'TI', 'VA'], ['BCC2'], {v.P: 101325, v.T: 1200, v.N: 1, v.X('FE'): 0.25, v.X('NI'): 0.25}) >>> is_ordered(res.Y.isel(vertex=0).values.squeeze(), subl_dof, symm) True
- 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
, :]
- scheil.utils.order_disorder_dict(dbf, comps, phases)¶
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
- Returns
- Return type
dict
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.utils.order_disorder_eq_phases(eq_result, order_disorder_dict)¶
Return a list corresponding to the eq_result.Phase with order/disorder phases named correctly.
- Parameters
eq_result (pycalphad.LightDataset) –
order_disorder_dict (Dict) –
- Returns
- Return type
List
Module contents¶
scheil