lattice
Parameters and functions describing the evolution of the crystal lattice.
- class lattice.Lattice(params, work_dir, logger)[source]
Bases:
objectStore parameters relative to vacancy annihilation/creation.
- Variables:
k_dislo (float) – Sink strength related to dislocations (s-1).
k_pores (float) – Sink strength related to pores (s-1).
rho_dislo (float) – Line density used to compute k_dislo from local DVa (m-2).
rho_pores (float) – Line density used to compute k_pores from local DVa (m-2).
ideal (bool) – Whether lattice is ideal, in the sense that vacancies are maintained at equilibrium.
- __init__(params, work_dir, logger)[source]
Class constructor.
- Parameters:
params (dict) – Input parameters related to sink strength.
work_dir (pathlib.Path) – Work directory.
logger (
log_utils.CustomLogger) – Logger.
- is_ideal(logger)[source]
Check whether lattice is ideal and print info messages.
If the input files contains no value for k_dislo, k_pores, rho_dislo or rho_pores, the lattice is ideal. If either parameter is given, the lattice is non-ideal.
- process_sink_terms(params, work_dir, logger)[source]
Process user input for non-ideal lattice parameters.
Parameters of interest: k_dislo, k_pores, rho_dislo, rho_pores. Input can be a float or a string indicating a file name. If neither k_dislo or rho_dislo is given, k_dislo defaults to 0. Same for k_pores and rho_pores. (This will occur if k_dislo is specified but k_pores is not, or vice versa.)
- lattice.compute_alpha_nonideal(dt, yVa, yVa_eq, V, Vp, fm, k_dislo, k_pores)[source]
Compute lattice sink rate in non-ideal case.
- Parameters:
dt (float) – Time step.
yVa (1D array) – Vacancy site fraction, shape (nz - 1,).
yVa_eq (1D array) – Equilibrium vacancy site fraction, shape (nz - 1,).
V (1D array) – System average molar volume, shape (nz - 1,).
Vp (dict of floats) – Partial molar volumes.
fm (1D array) – Metal volume fraction, shape (nz - 1,).
k_dislo (1D array) – Sink strength associated with dislocation climb, shape (nz - 1,).
k_pores (1D array) – Sink strength associated with pore growth, shape (nz - 1,).
- Returns:
alpha_d (1D array) – Sink term associated with dislocation climb, shape (nz - 1,).
alpha_p (1D array) – Sink term associated with pore growth, shape (nz - 1,).
- lattice.compute_gamma(Jlat, z, Vk, V0, Vp, V, alpha_d, alpha_p, y_Va, geometry)[source]
Compute relative volume variation rate.
- Parameters:
Jlat (1D array) – Fluxes in the lattice frame, shape (ninds + 1, nz).
z (1D array) – Node positions, shape (nz,).
Vk (1D array) – Partial molar volumes.
V0 (float or 1D array) – Partial molar volume of the vacancy.
Vp (float or 1D array) – Partial molar volume of the pore.
V (1D array) – System average molar volume, shape (nz - 1,).
alpha_d (1D array) – Sink term associated with dislocation climb, shape (nz - 1,).
alpha_p (1D array) – Sink term associated with pore growth, shape (nz - 1,).
y_Va (1D array) – Vacancy site fraction, shape (nz - 1,).
geometry (str) – Domain geometry (planar, cylindrical or spherical).
- Returns:
gamma – Relative volume variation rate, shape (nz - 1,).
- Return type:
1D array
- lattice.compute_gamma_V(Jlat, z, Vk, V0, Vm, V, y_Va, alpha, geometry)[source]
Compute relative volume variation rate due to molar volume variation.
- Parameters:
Jlat (1D array) – Fluxes in the lattice frame, shape (ninds + 1, nz).
z (1D array) – Node positions, shape (nz,).
Vk (1D array) – Partial molar volumes.
V0 (float or 1D array) – Partial molar volume of the vacancy.
Vm (1D array) – Average molar volume of the metal phase, shape (nz - 1,).
V (1D array) – System average molar volume, shape (nz - 1,).
y_Va (1D array) – Vacancy site fraction, shape (nz - 1,).
alpha (1D array) – Sink term, shape (nz - 1,).
geometry (str) – Domain geometry (planar, cylindrical or spherical).
- Returns:
gamma_V – Relative volume variation rate due to molar volume variation, shape (nz - 1,).
- Return type:
1D array
- lattice.compute_velocity(gamma, z, Vk, V0, Jlat, yVa, geometry)[source]
Compute velocity field of the lattice in the laboratory frame.
v is calculated via an integral from 0 to z -> need to add value at 0. v_left is obtained assuming ideal lattice activity on left boundary (and neglecting the gradient of Vm/(1 - yVa) in getting the primitive).
- Parameters:
gamma (1D array) – Relative volume variation rate, shape (nz - 1,).
z (1D array) – Node positions, shape (nz,).
Vk (1D array) – Partial molar volumes.
V0 (float or 1D array) – Partial molar volume of the vacancy.
Jlat (1D array) – Fluxes in the lattice frame, shape (ninds + 1, nz).
yVa (1D array) – Vacancy site fraction, shape (nz - 1,).
geometry (str) – Domain geometry (planar, cylindrical or spherical).
- Returns:
v – Lattice velocity, shape (nz,)
- Return type:
1D array