Reaction-Diffusion Chaos Lab (Gray-Scott)

Paint chemicals on a live Gray-Scott grid, explore the (F, k) parameter map and verify the maths with built-in checks.

Drag / touch the canvas to paint chemical v (turn on Eraser to remove). Click or drag on the parameter map to change F and k.
The science

The Gray-Scott model describes two chemicals: a feed chemical u that is supplied at rate F, and an activator v that consumes u autocatalytically and is removed at rate F + k:

∂u/∂t = Dₐ ∇²u − u v² + F (1 − u)
∂v/∂t = Dᵥ ∇²v + u v² − (F + k) v

Here Dₐ=0.2 and Dᵥ=0.1 (grid units), the explicit Euler step is 1, and the Laplacian is the 5-point stencil. Because u diffuses faster than v a Turing-type instability can arise: the uniform state is unstable to a band of wavelengths and spots, stripes, coral or worms grow. Which pattern appears depends only on (F, k) - the parameter map in the lower right shows where the presets sit.

Checks. "Run checks" builds a small test grid and verifies (1) that the analytic fixed point is preserved by the discrete scheme, (2) that diffusion alone conserves mass, (3) that a cosine mode decays exactly as (1 − Dₐ(2 − 2cos(2πm/N)))ⁿ, and (4) the Hopf-curve root.

Simplifications. Explicit Euler with a fixed step, no noise term, a 320x200 grid and dimensionless units - the pattern wavelength in cells is not a physical length. The Turing/Hopf boundaries drawn are the homogeneous-state analysis; the full pattern boundaries also depend on the diffusion ratio.