Skip to main content

cahn_hilliard_flux_kernel

Function cahn_hilliard_flux_kernel 

Source
pub fn cahn_hilliard_flux_kernel(
    concentration: &Concentration,
    mobility: Mobility,
    chem_potential_grad: &ChemicalPotentialGradient,
) -> Result<CausalTensor<f64>, PhysicsError>
Expand description

Calculates the Cahn-Hilliard Flux with degenerate mobility (Type B).

$$ \mathbf{J} = -M(c) \nabla \mu $$

§Physical Model

Describes the flux of a conserved order parameter $c$ (concentration) driven by the chemical potential gradient. This implementation uses a degenerate mobility model, where diffusion vanishes in the pure phases ($c=0, 1$).

$$ M(c) = M_0 c (1 - c) $$

This ensures the concentration remains bounded within $[0, 1]$ during evolution.

§Arguments

  • concentration - Local concentration field $c$ (Scalar Tensor).
  • mobility - Base mobility coefficient $M_0$.
  • chem_potential_grad - Gradient of the chemical potential $\nabla \mu$ (Vector Field Tensor).

§Implementation Details

  • Clamping: The concentration $c$ used in the mobility calculation is clamped to $[0, 1]$ to prevent non-physical negative mobility if numerical noise causes $c$ to exceed bounds.
  • Element-wise Operation: The flux is computed by iterating over the tensor data slices to handle the scalar-vector multiplication correctly.

§Returns

  • Result<CausalTensor<f64>, PhysicsError> - Flux vector field $\mathbf{J}$.