The 3D actuator looks up a single global austenite fraction ξ(T) from a fitted cosine curve. This 2D simulator instead computes the transformation from the ground up: a 48×48 lattice of local strain order-parameters ε(x,y) evolves under a stochastic Falk-type Landau free energy — the standard sixth-order model used in the shape-memory-alloy literature — with a Ginzburg gradient term for twin-boundary energy and a Langevin thermal noise term that lets each cell nucleate on its own:
f(ε,T) = τ·ε² − ε⁴ + ε⁶, τ = (T − T₀)/T_scale
∂ε/∂t = −Γ·(∂f/∂ε − κ·∇²ε − σ) + noise(T)
ε = 0 → austenite (single well, high T)
ε = ±ε₀(T) → the two self-accommodating
martensite twin variants (low T)
σ = applied load → biases the double well, favouring
the variant aligned with the load
Because thousands of cells nucleate independently instead of one global variable following a fitted curve, the heating and cooling austenite-fraction curves come out separated in temperature as a measured result of the simulation — real thermal hysteresis, not an assumed loop shape. A verification run of this exact model (see the console-run companion script) found the 90%-complete heating point sits roughly 20–25 °C above the point cooling drops back below 90%, and that adding an applied stress raises the completion temperature by another ~10 °C — the same stress–temperature coupling (a Clausius–Clapeyron-like shift) used to size every real SMA actuator.
- Heater power — Joule heating rate while the heater is on, same as the 3D model.
- Cooling / fan rate — Newton's-law-of-cooling rate back toward ambient once the heater is off.
- Load mass — sets the applied stress σ that biases the double well. Unlike the 3D model, a real stroke only appears here if σ is nonzero: with no load the twin variants self-accommodate to zero net strain on cooling (physically correct — an unloaded SMA does no work), and the stroke you see is the field's own detwinning response to the load, not an imposed formula.
- Twin domain count — counted directly from the lattice (sign changes between neighbouring cells); watch it grow as martensite nucleates on cooling and collapse to ~0 as the field homogenises into single-phase austenite on heating.
Real-world relevance: this microstructural, stochastic-nucleation picture — not a single fitted curve — is exactly what phase-field models in the NiTi materials-science literature use to predict transformation width, stress-shifted actuation temperature and fatigue-relevant twin-boundary density in real SMA actuators, wires and stents.