Spinodal Decomposition & Ostwald Ripening at 60 FPS: Solving 4th-Order Cahn–Hilliard Biharmonic PDEs in WebGL2
In How the Leopard Got Its Spots at 60 FPS, we simulated Alan Turing's non-conserved reaction–diffusion PDE, where chemical production and degradation arrest pattern growth at a fixed biological wavelength. What happens when a hot binary alloy or polymer blend is quenched below its critical temperature and separates into two phases ($\phi = \pm 1$) while strictly conserving total mass $\int_\Omega \phi(\vec{x}, t)\,d^2x = \text{const}$?
Instead of relaxing via a second-order $L^2$ Allen–Cahn flow ($\partial_t \phi = -\delta \mathcal{F}/\delta\phi$), a conserved order parameter must evolve via the fourth-order $H^{-1}$ Cahn–Hilliard equation (deWitt et al., 2025, arXiv:2509.05339; Dumbser et al., 2024, arXiv:2408.03862). Because the PDE contains a negative biharmonic operator $-\epsilon^2 \nabla^4 \phi$, evaluating a single-pass 25-point stencil in GLSL is both bandwidth-heavy and numerically stiff ($\Delta t \le \frac{1}{32}\Delta x^4$). Factoring the fourth-order update into a two-pass chemical potential FBO pipeline unlocks 60 FPS spinodal labyrinth formation, Lifshitz–Slyozov $L(t) \propto t^{1/3}$ Ostwald ripening, and class-I disordered hyperuniformity ($S(k) \sim k^4$ as $k \to 0$).
0. Ginzburg–Landau Free Energy & Two-Pass Biharmonic Splitting
Consider a binary mixture with concentration order parameter $\phi(\vec{x}, t) \in [-1, 1]$ governed by the Ginzburg–Landau double-well free-energy functional $\mathcal{F}[\phi]$:
Because $\partial_t \phi = \nabla \cdot \vec{J}$ is a pure divergence of the diffusive flux $\vec{J} = -M\nabla\mu$, total mass $\int \phi\,d^2x$ is conserved to machine precision on periodic FBO textures, and the free energy decays monotonically: $\frac{d\mathcal{F}}{dt} = -\int M |\nabla\mu|^2\,d^2x \le 0$.
💻 GLSL: Two-Pass Chemical Potential & Biharmonic Mass Transport ShadersGLSL
// Pass 1: Compute Chemical Potential mu = phi^3 - phi - eps^2 * Laplacian(phi) into G channel
float phi = texture2D(uState, vUv).r;
float lapPhi = (10.0 / 3.0) * (0.20 * (N.r + S.r + E.r + W.r) + 0.05 * (NE.r + NW.r + SE.r + SW.r) - phi);
float mu = (phi * phi * phi - phi) - (uEps * uEps) * lapPhi;
gl_FragColor = vec4(phi, mu, 0.0, 1.0);
// Pass 2: Evolve Conserved Order Parameter phi^(n+1) = phi^n + dt * M * Laplacian(mu)
vec2 C = texture2D(uState, vUv).rg;
float lapMu = (10.0 / 3.0) * (0.20 * (N.g + S.g + E.g + W.g) + 0.05 * (NE.g + NW.g + SE.g + SW.g) - C.g);
float phiNext = C.r + uDt * uMobility * lapMu;
gl_FragColor = vec4(phiNext, C.g, 0.0, 1.0);
1. Pattern-Formation PDEs in WebGL: Head-to-Head
| PDE System | Allen–Cahn ($L^2$ Flow) | Gray–Scott Reaction–Diffusion (Turing Post) | Cahn–Hilliard ($H^{-1}$ Biharmonic Flow) |
|---|---|---|---|
| Governing Equation | $\partial_t \phi = -\mu = \phi - \phi^3 + \epsilon^2\nabla^2\phi$ | Coupled $\partial_t u = D_u\nabla^2 u - uv^2 + F(1-u)$ | $\partial_t \phi = M\nabla^2(\phi^3 - \phi - \epsilon^2\nabla^2\phi)$ |
| Global Mass $\int \phi\,d^2x$ | Not conserved (droplets shrink and vanish) | Open driven-dissipative reactor | Strictly conserved ($\partial_t \phi = \nabla \cdot (M\nabla\mu)$) |
| Late-Time Length Scale $L(t)$ | Curvature-driven $L(t) \propto t^{1/2}$ | Arrested at Turing wavelength $\lambda_T$ | Lifshitz–Slyozov Ostwald coarsening $L(t) \propto t^{1/3}$ |