Overview
On this page
The flux of a species is determined by Fick’s first law. More generally, we can use Onsager’s relationships to represent the flux by the diffusivity and potential gradient. For example, compositional fluxes may be determined by a diffusion coefficient and composition gradient, or an atomic mobility and chemical potential gradient.
$$ J_k = -D_k \nabla c_k = -M_k c_k \nabla \mu_k $$
From Fick’s second law, we can describe the time evolution of a species concentration ($c$) from the gradient of the flux.
$$ \frac{\partial c_k}{\partial t} = -\nabla J_k $$
In general, the time evolution of a species is governed by diffusive fluxes, convection ($\nu$) and a sink/source (R) term (for example, this can be a chemical reaction).
$$ \frac{\partial c_k}{\partial t} = -\nabla J_k - \nabla(\nu c_k) + R $$
Note 1: In a lattice-fixed frame, the fluxes are generally independent of each other. The fluxes may not sum to zero, but this indicates that the diffusion couple is moving with respect to the lattice frame. In a volume fixed frame, the fluxes are constrained so that the fluxes of volume-contributing elements (substitutional elements, $S$) must sum to 0 ($\sum{J_k^v}=0$). Conversion between a lattice-fixed frame ($J_k$) and volume fixed frame ($J_k^v$) is done by the following where $u_k$ is the u-fraction (in note 2).
$$ J_k^v = J_k - u_k \sum_{j \epsilon S}{J_j} $$
Note 2: here we use the concentration instead of the mole fraction. Assuming that volume is independent of concentration, we can relate concentration to mole fraction by the following where $S$ represents substitutional elements. This can also be written in terms of a u-fraction, which is the composition normalized to the fraction of substitutional elements.
$$ c_k = \frac{1}{V_m} \frac{x_k}{\sum_{j \epsilon S}{x_j}} = \frac{u_k}{V_m} $$
$$ u_k = \frac{x_k}{\sum_{j \epsilon S}{x_j}} $$
If all elements in a system are substitutional then $u_k = x_k$. However, in kawin, when including interstitial elements (or in general), the diffusion models will track everything in terms of u-fraction. We can convert u-fraction back to composition by solving a linear system.
$$ Ax = 0 \text{ where } A_{ij} = (\delta_{ij} - \delta_{j \epsilon S} u_i) $$
$$ \sum{x} = 1 $$
For example, we can construct a linear system for a ternary A-B-C system where all components are interstitial as:
$$ \left[ \begin{array}{ccc} (1-u_A) & -u_A & -u_A \newline -u_B & (1-u_B) & -u_B \newline -u_C & -u_C & (1-u_C) \newline 1 & 1 & 1 \end{array} \right] \left[ \begin{array}{c} x_A \newline x_B \newline x_C \newline \end{array} \right] = \left[ \begin{array}{c} 0 \newline 0 \newline 0 \newline 1 \end{array} \right] $$
If C was an interstitial, then the system becomes
$$ \left[ \begin{array}{ccc} (1-u_A) & -u_A & 0 \newline -u_B & (1-u_B) & 0 \newline -u_C & -u_C & 1 \newline 1 & 1 & 1 \end{array} \right] \left[ \begin{array}{c} x_A \newline x_B \newline x_C \newline \end{array} \right] = \left[ \begin{array}{c} 0 \newline 0 \newline 0 \newline 1 \end{array} \right] $$
For both cases, the matrix $A$ only has $n-1$ independent rows, so we can remove the first row when solving for composition.
Solving the model
The diffusion model is solved by computing the fluxes where the current state of the model is determined by the u-fraction profile. The green boxes represents all the steps that is performed to determine $\frac{du_i}{dt}$ which can be used for any iterative scheme. The explicit euler scheme is shown here as the gray boxes, where from the current u-fraction profile ($u_i^t$), the u-fraction profile ($u_i^{t+1}$) is determined directly from $\frac{du_i}{dt}$ and the time step $\Delta t$. However, this can easily be modified if using a different iterative scheme. Boundary conditions are applied twice: first for Neumann (fixed flux) conditions where the initially computed fluxes are modified. Then after $\frac{du_i}{dt}$ is computed, the Dirichlet (fixed composition) conditions are applied where $\frac{du_i}{dt}$ is set to 0 at the boundaries (note that the fixed composition is set when the mesh is constructed). The diffusion model tracks the composition profile in terms of u-fraction, but this can be converted back to composition for plotting. The blue boxes after these steps represent any post-processing done after an iteration is finished.

Diffusion flowchart
References
- J. Andersson and J. Agren, “Models for numerical treatment of multicomponent diffusion in simple phases” Journal of Applied Physics 72 (1992) p. 1350