kawin.Mobility
class kawin.MobilityModel(self, dbe, comps, phase_name, parameters=None)
Handles mobility and diffusivity data from .tdb files
Parameters
----------
dbe : Database
comps : list
List of elements to consider
phase_name : str
parameters : dict or list (optional)
Dictionary of parameters to be kept symbolic
Attributes
----------
mobility_variables : dict
Dictionary of symbols in mobility functions for each element
diffusivity_variables : dict
Dictionary of symbols in diffusivity functions for each element
kawin.MobilityModel.mobility_variables(self)
kawin.MobilityModel.diffusivity_variables(self)
kawin.MobilityModel.build_phase(self, dbe)
Builds free energy and mobility/diffusivity models as abstract syntax tree
Parameters
----------
dbe : Database
kawin.MobilityModel._mobility_validity(self, constituent_array)
Returns true if constituent_array contains only active species of current model
Ignores vacancies - if a sublattice is only vacancies, then it should be ignored
For now, phases where this occurs will have the parameters listed for n-1 sublattices
kawin.MobilityModel.build_mobility(self, dbe)
Builds mobility/diffusivity models as abstract syntax tree
Parameters
----------
dbe : Database
kawin.mobility_from_composition_set(composition_set, mobility_callables = None, mobility_correction = None)
Computes mobility from equilibrium results
Parameters
----------
composition_set : pycalphad.core.composition_set.CompositionSet
mobility_callables : dict
Pre-computed mobility callables for each element
mobility_correction : dict (optional)
Factor to multiply mobility by for each given element (defaults to 1)
Returns
-------
Array for floats for mobility of each element (alphabetical order)
kawin.tracer_diffusivity(composition_set, mobility_callables = None, mobility_correction = None)
Computes tracer diffusivity for given equilibrium results
D = MRT
Parameters
----------
composition_set : pycalphad.core.composition_set.CompositionSet
mobility_callables : dict
Pre-computed mobility callables for each element
mobility_correction : dict (optional)
Factor to multiply mobility by for each given element (defaults to 1)
Returns
-------
Array of floats of diffusivity for each element (alphabetical order)
kawin.tracer_diffusivity_from_diff(composition_set, diffusivity_callables = None, diffusivity_correction = None)
Tracer diffusivity from diffusivity callables
This will just return the Da as an array
Parameters
----------
composition_set : pycalphad.core.composition_set.CompositionSet
diffusivity_callables : dict
Pre-computed diffusivity callables for each element
diffusivity_correction : dict (optional)
Factor to multiply diffusivity by for each given element (defaults to 1)
Returns
-------
Array of floats of diffusivity for each element (alphabetical order)
kawin.mobility_matrix(composition_set, mobility_callables = None, mobility_correction = None)
Mobility matrix
Used to obtain diffusivity when multipled with free energy hessian
Parameters
----------
composition_set : pycalphad.core.composition_set.CompositionSet
mobility_callables : dict (optional)
Pre-computed mobility callables for each element
mobility_correction : dict (optional)
Factor to multiply mobility by for each given element (defaults to 1)
Returns
-------
Matrix of floats
Each index along an axis correspond to elements in alphabetical order
kawin.chemical_diffusivity(chemical_potentials, composition_set, mobility_callables, mobility_correction = None, returnHessian = False)
Chemical diffusivity (D_ab)
D_ab = mobility matrix * free energy hessian
Parameters
----------
chemical_potentials : 1-D ndarray
composition_set : pycalphad.core.composition_set.CompositionSet
mobility_callables : dict
Pre-computed mobility callables for each element
mobility_correction : dict (optional)
Factor to multiply mobility by for each given element (defaults to 1)
returnHessian : bool (optional)
Whether to return chemical potential derivative (defaults to False)
Returns
-------
(matrix of floats, free energy hessian)
Each index along an axis correspond to elements in alphabetical order
free energy hessian will be None if returnHessian is False
kawin.interdiffusivity(chemical_potentials, composition_set, refElement, mobility_callables = None, mobility_correction = None, returnHessian = False)
Interdiffusivity (D^n_ab)
D^n_ab = D_ab - D_an (for substitutional element)
D^n_ab = D_ab (for interstitial element)
Parameters
----------
chemical_potentials : 1-D ndarray
composition_set : pycalphad.core.composition_set.CompositionSet
refElement : str
Reference element n
mobility_callables : dict (optional)
Pre-computed mobility callables for each element
mobility_correction : dict (optional)
Factor to multiply mobility by for each given element (defaults to 1)
returnHessian : bool (optional)
Whether to return chemical potential derivative (defaults to False)
Returns
-------
(matrix of floats, free energy hessian)
Each index along an axis correspond to elements in
alphabetical order excluding reference element
free energy hessian will be None if returnHessian is False
kawin.interdiffusivity_from_diff(composition_set, refElement, diffusivity_callables, diffusivity_correction = None)
Interdiffusivity (D^n_ab) calculated from diffusivity callables
This is if the TDB database only has diffusivity data and no mobility data
D^n_ab = D_ab - D_an (for substitutional element)
D^n_ab = D_ab (for interstitial element)
Parameters
----------
composition_set : pycalphad.core.composition_set.CompositionSet
refElement : str
Reference element n
diffusivity_callables : dict
Pre-computed callables for diffusivity for each element
diffusivity_correction : dict
Factor to multiply diffusivity by for each element (defaults to 1)
Returns
-------
matrix of floats
Each index along an axis correspond to elements in
alphabetical order excluding reference element
kawin.inverseMobility(chemical_potentials, composition_set, refElement, mobility_callables, mobility_correction = None, returnOther = True)
Inverse mobility matrix for determining interfacial composition
M^-1 = (free energy hessian) * Dnkj^-1
Parameters
----------
chemical_potentials : 1-D ndarray
composition_set : pycalphad.core.composition_set.CompositionSet
refElement : str
Reference element n
mobility_callables : dict
Pre-computed mobility callables for each element
mobility_correction : dict (optional)
Factor to multiply mobility by for each given element (defaults to 1)
returnOther : bool (optional)
Whether to return interdiffusivity and hessian (defaults to False)
Returns
-------
(interdiffusivity, hessian, inverse mobility)
Interdiffusivity and hessian will be None if returnOther is False
kawin.inverseMobility_from_diffusivity(chemical_potentials, composition_set, refElement, diffusivity_callables, diffusivity_correction = None, returnOther = True)
Inverse mobility matrix for determining interfacial composition
M^-1 = (free energy hessian) * Dnkj^-1
Parameters
----------
chemical_potentials : 1-D ndarray
composition_set : pycalphad.core.composition_set.CompositionSet
refElement : str
Reference element n
diffusivity_callables : dict
Pre-computed callables for diffusivity for each element
diffusivity_correction : dict
Factor to multiply diffusivity by for each element (defaults to 1)
returnOther : bool (optional)
Whether to return interdiffusivity and hessian (defaults to False)
Returns
-------
(interdiffusivity, hessian, inverse mobility)
Interdiffusivity and hessian will be None if returnOther is False