Materials & phase-field physics
Overview
Beyond the linear, steady-state physics of the earlier chapters lies a family of models whose material itself evolves: a solid that yields and creeps, a crack that grows, two phases that separate, a battery that swells as it charges. These are the constitutive and phase-field physics — models where the state carries memory (plastic strain, internal variables) or a smooth order parameter (a crack field, a concentration).
The shared idea is an energy or evolution law. A constitutive model replaces $\sigma = C\varepsilon$ with a history-dependent relation; a phase-field model replaces a sharp interface with a smooth field that evolves down an energy gradient. Both are solved with the same solve(Physics(), …) entry point, but they return histories or coupled fields instead of a single steady state.
Phase-field models
A phase field is a smooth scalar ($c$, $d$) that stands in for a sharp interface, evolving by a gradient flow of a free energy.
Rasmah.CahnHilliard — Type
CahnHilliardThe Cahn–Hilliard phase-field physics (spinodal decomposition / phase separation). See solve.
Theory
A binary mixture can lower its free energy by separating into two phases. The Cahn–Hilliard equation is the conserved gradient flow of a free energy $\int \bigl[f(c) + \tfrac{\varepsilon^2}{2}|\nabla c|^2\bigr]\,dx$: $\partial_t c = \nabla \cdot (M \nabla \mu)$ with chemical potential $\mu = f'(c) - \varepsilon^2 \nabla^2 c$. Mass $\int c$ is conserved exactly (the flux is a divergence) and the free energy decreases monotonically. Rasmah solves the mixed $(c, \mu)$ form with an energy-stable convex-splitting scheme.
Rasmah.PhaseFieldFracture — Type
PhaseFieldFracturePhysics tag for brittle phase-field fracture (AT2), with the displacement field u and the scalar crack field d.
Theory
A sharp crack is a set of zero measure; a phase-field crack is a smooth scalar field $d \in [0,1]$ that interpolates from intact ($d = 0$) to broken ($d = 1$), evolving to minimize a free energy that combines the stored elastic energy with a surface term $G_c$ times the crack area. The two fields couple: the crack field degrades the stiffness, and the strain energy drives the crack field. Solving alternates (staggered) between the elasticity and the crack update until the crack stops growing.
Constitutive models
These replace the elastic law with a history-dependent one — plastic strain, creep, internal transformations, or critical-state compaction.
Rasmah.Viscoplasticity — Type
ViscoplasticityPhysics type for small-strain, rate-dependent J2 viscoplasticity / creep. Solving it marches a sequence of backward-Euler steps, returning the displacement history us and time grid times.
Theory
Rate-independent plasticity yields instantly once the stress reaches the yield surface. Viscoplasticity (creep) lets the material flow at a rate that grows with the overstress above yield — so deformation accumulates over time under a sustained load. Rasmah integrates the rate equations with backward Euler (an implicit, unconditionally stable step), giving a load-path history rather than a single instantaneous state.
Rasmah.ViscoelasticSolid — Type
ViscoelasticSolidLinear isotropic viscoelastic solid physics with field (:u,).
Theory
A viscoelastic solid is neither purely elastic nor purely viscous: it stores energy and dissipates it, so its response depends on the loading history. A linear viscoelastic model represents this with a spectrum of spring–dashpot elements (a Prony series), each remembering its own internal strain. Under a constant load the material creeps toward a relaxed stiffness; under a step it relaxes stress over time.
Rasmah.ShapeMemoryAlloy — Type
ShapeMemoryAlloyPhysics tag for shape-memory-alloy (pseudoelastic) analyses.
Theory
A shape-memory alloy (e.g. NiTi) undergoes a reversible, stress-induced transformation between austenite and martensite. The result is pseudoelastic behaviour: a loading–unloading cycle follows a flag-shaped hysteresis loop — large recoverable strain with no permanent set. The constitutive law tracks the transformed volume fraction $\xi$ alongside the stress, so the stress–strain path depends on the loading history, not just the current strain.
Rasmah.CamClay — Type
CamClayPhysics tag for modified Cam-clay critical-state soil plasticity, with the single displacement field u.
Theory
Soil is not a simple solid: it compacts (hardens) under pressure and dilates or collapses toward a critical state — a stress–void-ratio line where it shears without further volume change. The modified Cam-clay model captures this with a pressure-dependent yield surface (an ellipse in $p$–$q$ space) and hardening/softening tied to the plastic volumetric strain, so a sample consolidates under load instead of yielding at a fixed strength.
Chemo- and electro-mechanical coupling
When a chemical reaction or an electric field drives deformation — or the other way around — the material response is a coupled two-field problem.
Rasmah.ChemoElasticity — Type
ChemoElasticityChemical-strain (thermo-chemo-mechanical) elasticity physics: solves ∇·σ = 0 with σ = C (ε − β ξ 1) for a prescribed degree of hydration ξ(x) and chemical strain coefficient β. See solve.
Theory
Concrete, gels, and battery electrodes swell or shrink as a chemical reaction progresses. ChemoElasticity is the one-way coupling: a prescribed reaction field $\xi(x)$ produces a stress-free chemical strain $\beta\,\xi\,I$ that is subtracted from the total strain — the same structure as thermal strain, with the degree of reaction in place of temperature.
Rasmah.LithiumIon — Type
LithiumIonElectro-chemo-mechanical lithium-ion coupling physics with fields (:c, :u).
Theory
A lithium-ion electrode stores charge by intercalating lithium into a host material, and the intercalation makes the host swell. LithiumIon couples the lithium concentration $c$ (transport) to the displacement $u$ (mechanics): the concentration gradient drives diffusion, and the local concentration produces a chemical strain that deforms the solid. The two fields are solved together, which is what lets a charging cell be analysed for the stress its swelling induces.
Rasmah.Semiconductor — Type
SemiconductorPhysics type for the equilibrium semiconductor drift-diffusion (Poisson–Boltzmann) problem. Solving it returns the electrostatic potential φ.
Theory
A doped semiconductor holds mobile charge whose equilibrium distribution balances drift and diffusion. The Poisson–Boltzmann equation couples the potential $\phi$ to the carrier densities: the potential solves a nonlinear Poisson equation whose charge density depends exponentially on $\phi$ (Boltzmann statistics), so the solve iterates (Newton) rather than a single linear system.
A worked example: spinodal decomposition
The Cahn–Hilliard equation is the canonical phase-field model: a binary mixture separates into two phases to lower its free energy, with the total mass conserved exactly and the free energy decreasing monotonically. Start from a nearly uniform field with a small zero-mean perturbation and let it separate:
n = 30
grid = [[i / n, j / n] for j in 0:n for i in 0:n]
mesh = delaunay_triangulation(reduce(hcat, grid))
c0 = [0.05 * sin(3π * x) * sin(3π * y) for (x, y) in eachcol(mesh.vertices)]
res = solve(CahnHilliard(), mesh, c0; nsteps = 150, dt = 2e-4, mobility = 10.0, ε = 0.03)
c_end = res.cs[end]
round(minimum(c_end); digits = 2), round(maximum(c_end); digits = 2)(-1.05, 1.0)The field separates to the two equilibrium phases $c \approx \pm 1$. The two defining checks are conserved mass and a monotonically decreasing free energy:
sp = FESpace(mesh, ReferenceFE(2, 1))
mass0 = sum(c0) / length(c0)
mass1 = sum(c_end) / length(c_end)
F0 = cahnhilliard_energy(sp, c0, 0.03)
F1 = cahnhilliard_energy(sp, c_end, 0.03)
(round(mass0; digits = 4), round(mass1; digits = 4)), (F0 > F1)((0.0021, 0.0046), true)Colour the domain by the separated concentration field:
vtk(mesh; field = c_end, fieldname = "concentration", edges = false)Next steps
Phase fields share machinery with topology optimization — see Topology optimization — and the rate-dependent models above share their time integration with the Nonlinear solvers.
