Wave 32: DLA, Phase Portrait & Turing Patterns

Wave 32 delivers three deeply beautiful mathematical simulations: branching fractal trees grown particle by particle from random diffusion, the geometric language of dynamical-systems theory in interactive vector-field phase planes, and Alan Turing’s stunning 1952 prediction that two diffusing chemicals could spontaneously print spots, stripes, and labyrinths onto living tissue. All three ship with full EN + UK pages.

Platform Numbers

469
Simulations
72
Categories
52
Devlogs
32
Waves

Wave 32 Simulations

🌿

Diffusion-Limited Aggregation

Particles perform random walks until they touch the growing cluster and permanently stick. The resulting branching tree has fractal dimension ~1.71.

Open →
πŸ”„

Phase Portrait

2D ODE phase-plane visualiser. Click to trace RK4-integrated trajectories. Overlays show vector field arrows, nullclines, and fixed points.

Open →
πŸ†

Turing Patterns

Gray-Scott reaction-diffusion system. Five presets β€” Spots, Stripes, Labyrinth, Mitosis, Worms β€” each corresponding to distinct (F, k) parameters.

Open →

🌿 Diffusion-Limited Aggregation

The Witten-Sander Algorithm

Witten and Sander introduced DLA in their 1981 paper "Diffusion-Limited Aggregation, a Kinetic Critical Phenomenon". The algorithm is deceptively simple: one particle is fixed at the origin (the seed). New particles are repeatedly spawned at a random point on a circle just outside the current cluster radius, then perform a random walk (Β±1 on x or y per step). The moment a particle lands adjacent to any cell already in the cluster, it freezes permanently and becomes part of the cluster. Repeat.

The branches arise because particles performing random walks far from the cluster are equally likely to approach from any direction β€” but particles deep in a concave crevice are unlikely to diffuse all the way in before touching a branch tip. The tips therefore grow fastest and shade the interior, creating the characteristic dendritic structure.

Implementation Details

Colour Palettes

Six palettes map the cluster-entry index (normalised 0–1 against maxParticles) to an RGB triplet: Emerald, Gold, Ice, Flame, Violet, and Mono. Switching palette triggers a full redraw of all N×N ImageData pixels from the stored grid, so no particle data is lost.

What to Try

πŸ”„ Phase Portrait

Why Phase Planes?

A two-dimensional autonomous ODE system αΊ‹ = f(x,y), ẏ = g(x,y) cannot be solved analytically for most interesting f and g β€” but its behaviour can be completely characterised geometrically. The phase plane is the (x, y) coordinate system; at every point we draw a small arrow in the direction (f, g). Trajectories are curves that flow along these arrows. Fixed points (where arrows vanish) categorise as nodes, spirals, saddles, or centres β€” a classification that requires only the eigenvalues of the Jacobian.

Six Classic Systems

Implementation: RK4 Integration

Trajectories are integrated with the classical 4th-order Runge-Kutta method. Each call to rk4(x, y, dt) evaluates f and g four times (at the current point, two midpoints, and the predicted endpoint) and combines them with weights 1/6, 1/3, 1/3, 1/6. The time step is dt = 0.03 and up to 6 RK4 steps are taken per requestAnimationFrame call. Trajectories are automatically terminated if they leave a kill radius of 3Γ— the view range.

Nullclines

The x-nullcline (red) is the set of points where αΊ‹ = 0 β€” trajectories cross it moving vertically. The y-nullcline (blue) is where ẏ = 0 β€” trajectories cross it moving horizontally. Their intersections are always fixed points. Both are computed by scanning a 300×300 grid of the phase plane and identifying sign changes column by column (for x-nullcline) or row by row (for y-nullcline), with linear interpolation to sub-grid precision.

What to Try

πŸ† Turing Patterns

Turing’s 1952 Insight

In his paper "The Chemical Basis of Morphogenesis" (1952), Alan Turing showed mathematically that two chemical species with different diffusion coefficients could spontaneously break translational symmetry β€” starting from a nearly uniform distribution, the system would amplify small spatial fluctuations and settle into a stable spatially periodic pattern.

The key mechanism is local self-activation with long-range lateral inhibition. The activator species U catalyses its own production and also produces the inhibitor V, but V diffuses faster than U. So a small bump in U creates a local excess of V that suppresses U in the surrounding region, carving out the characteristic wavelength of the pattern.

The Gray-Scott Model

Gray and Scott (1984) introduced a clean reaction scheme that exhibits a wide variety of Turing patterns depending on two parameters:

∂U/∂t = DU∇²U − UV² + F(1−U)

∂V/∂t = DV∇²V + UV² − (F+k)V

Here UVΒ² is the autocatalytic term (U and V react to produce more V), F(1βˆ’U) feeds U from a reservoir, and (F+k)V removes V. The fixed parameters are DU = 0.16 and DV = 0.08 (so U diffuses twice as fast as V). The presets span the parameter map first documented by Pearson (1993):

Implementation: 9-point Laplacian, Euler Integration

The simulation runs on a 200×200 periodic grid using pairs of Float32Array double buffers. The discrete Laplacian uses a 9-point stencil with weights 0.05 for the four diagonal neighbours and 0.20 for the four cardinal neighbours (summing to 1 minus the centre weight of βˆ’1), which provides better isotropy than the standard 5-point stencil. Integration is forward Euler with dt = 1.0; this is numerically stable because DU ≤ 0.16 < 0.25 (the CFL stability limit for this stencil).

Five colour palettes (Amber, Ocean, Plasma, Jade, Mono) map the U concentration field linearly from background to foreground. The render loop writes directly to a ImageData pixel buffer for maximum throughput β€” no intermediate CSS colour strings.

Initialisation: Seeded Blobs

The grid starts at U ≈ 1, V ≈ 0 everywhere (the trivial fixed point), with tiny random noise to break symmetry. Twelve small circular blobs of radius 4 are seeded with U = 0.5, V = 0.25. These act as nucleation sites; without them the noise alone would take much longer to seed the pattern. The final pattern is independent of the seed positions β€” only (F, k) determines which pattern type ultimately emerges.

What to Try

Technical Notes

Tags

DLA Fractals Random Walk Fractal Dimension Phase Portrait Dynamical Systems Van der Pol Lotka-Volterra RK4 Turing Patterns Reaction Diffusion Gray-Scott Morphogenesis Wave 32

Wave 33 Preview

Three simulations planned for Wave 33:

All Wave 33 simulations will ship with EN + UK pages on launch day.