/ Turing Pattern Simulator
JA EN ZH
Back
Reaction-Diffusion Simulator

Turing Pattern
Reaction-Diffusion Simulator

Explore self-organizing patterns using the Gray-Scott model. Adjust just two parameters — feed rate and kill rate — to generate leopard spots, zebra stripes, spirals, and labyrinthine structures. Click the canvas to seed new patterns.

Gray-Scott Model Float32Array performance Click to interact 5 color schemes
Turing
Pattern Presets
Parameters
Feed rate f
Kill rate k
Diffusion Du
Diffusion Dv
Speed (steps/frame)8
Color Scheme
Statistics
Results
Step
0
Avg v conc.
0.000
Pattern type
Spots
FPS
--
Actions

Click canvas to inject chemical B

Theory: Turing's Reaction-Diffusion Equations

The Gray-Scott Model

This simulator numerically solves the Gray-Scott model. Two chemical species — A (concentration u) and B (concentration v) — react and diffuse through space.

∂u/∂t = Du · ∇²u − u·v² + f·(1−u)
∂v/∂t = Dv · ∇²v + u·v² − (f+k)·v

The reaction term u·v² represents an autocatalytic reaction: A and B react in a 2:1 ratio to produce more B. The feed rate f controls how fast A is replenished from outside; the kill rate k controls the removal of B.

Intuition for Pattern Formation

Because Du > Dv, species A spreads quickly and stays dilute, while B remains locally concentrated. This asymmetry — slow activator, fast inhibitor — is the hallmark of Turing instability. It causes a spatially uniform state to buckle into periodic concentration waves.

Engineering Applications

Reaction-diffusion equations are used in combustion front analysis, localized corrosion modeling, solidification interface stability, and tissue engineering. Turing instability also serves as a canonical benchmark for testing numerical solvers, and topology optimization researchers exploit the mechanism to generate regular porous lattices.

💬 Why does Turing's idea still fascinate engineers?

🙋
Professor, leopard spots and zebra stripes look completely different — but this simulator uses the same equation for both?
🎓
Exactly. You only tweak f and k by a tiny amount and the whole pattern switches from spots to stripes. Think of it this way: the leopard embryo's skin cells operate in the "spot zone" of parameter space, and the zebra's cells land in the "stripe zone." Same math, different parameter point.
🙋
So an animal's genome essentially encodes those two numbers?
🎓
More precisely, genes control the ratio of diffusion speeds of the melanin-inducing molecules during embryonic skin development. Turing predicted this whole mechanism purely mathematically in 1952 — before digital computers existed — and we only confirmed it experimentally with zebrafish in the 2010s.
🙋
What about in actual engineering? It feels very biology-oriented.
🎓
It shows up everywhere. Corrosion pitting? That's localized activation vs. passivation — reaction-diffusion. Combustion finger instabilities? Same math. There's even a trend in topology optimization to deliberately trigger Turing instability to design porous scaffold structures for bone implants. The pattern forms itself — you just tune f and k.

What is a Turing Pattern?

🙋
What exactly is a Turing pattern? I've heard of leopard spots and zebra stripes, but how can a chemical reaction create something like that?
🎓
Basically, it's a self-organizing pattern that emerges from a simple reaction-diffusion system. In practice, imagine two chemicals—an "activator" and an "inhibitor"—diffusing and reacting. If the inhibitor diffuses faster, it can suppress the activator in some areas, creating spots or stripes. Try moving the "Feed Rate" and "Kill Rate" sliders above to see how tweaking the reaction changes the pattern from a blank state.
🙋
Wait, really? So the sliders control the "recipe" for the chemicals? What happens if I crank up the "Feed Rate" all the way?
🎓
Exactly! The "Feed Rate" (F) controls how much of the basic "food" chemical is added. A common case is that a very high feed rate overwhelms the system, and you get a uniform, stable state—no patterns. For instance, in the simulator, set F high and K low, and you'll see the color go solid. The patterns only emerge in a specific "Goldilocks zone" of parameters.
🙋
That's fascinating. So the "Kill Rate" is for the inhibitor? How do these two rates work together to decide between spots and stripes?
🎓
Great question! The "Kill Rate" (K) determines how quickly the inhibitor removes the activator. In practice, their ratio is key. A moderate F with a slightly higher K might give you wandering spots, while a different combination creates stable stripes. Try adjusting them slowly together in the simulator. You'll see the pattern morph through phases—it's like tuning into different "channels" of natural design.

Physical Model & Key Equations

The Gray-Scott model simulates the concentrations of two chemicals, U (activator) and V (inhibitor), over time. The core idea is that U activates itself and V, while V consumes U. The equations govern how these concentrations change due to reaction and diffusion.

$$ \frac{\partial U}{\partial t}= D_U \nabla^2 U - UV^2 + F(1-U) $$ $$ \frac{\partial V}{\partial t}= D_V \nabla^2 V + UV^2 - (F+K)V $$

$U, V$: Concentrations of activator and inhibitor.
$D_U, D_V$: Diffusion rates (how fast each chemical spreads). Typically $D_V \gt D_U$.
$F$: Feed rate of the base chemical into U.
$K$: Kill rate, the removal rate of V.
The term $UV^2$ is the nonlinear reaction where V consumes U.

The pattern emerges from an instability. A small, random fluctuation in concentration can grow if the inhibitor diffuses away fast enough to not suppress the activator locally. This is called diffusion-driven instability.

$$ \text{Pattern Condition: } D_V / D_U \gt 1 $$

This condition means the inhibitor must diffuse significantly faster than the activator. It creates a feedback loop: a slight bump in U grows, V is produced and diffuses away, which allows U to grow further in the center but suppresses it at the edges, leading to a defined spot or stripe.

Real-World Applications

Developmental Biology: Turing's original hypothesis was for morphogenesis—how embryos develop patterns. For instance, the spacing of hair follicles in mammals or the stripes on a zebrafish are believed to be governed by reaction-diffusion mechanisms similar to this model.

Materials Science & Chemistry: Certain chemical reactions, like the Belousov-Zhabotinsky (BZ) reaction, produce oscillating concentric rings and spirals in a petri dish, which are direct experimental examples of reaction-diffusion patterns.

Computer Graphics & Texturing: The algorithms behind this simulator are used to generate realistic-looking animal fur, leopard spots, and zebra stripes in movies and video games procedurally, rather than painting each pattern by hand.

CAE & Simulation: Engineers use these principles to model and understand pattern formation in new materials, such as the self-assembly of nanostructures or the corrosion patterns on metals, which can inform better design and material selection.

Common Misconceptions and Points of Caution

Model assumptions: The mathematical model used here relies on simplifying assumptions such as linearity, homogeneity, and isotropy. Always verify that your real system satisfies these assumptions before applying results directly to design decisions.

Units and scale: Many calculation errors arise from unit conversion mistakes or order-of-magnitude errors. Pay close attention to the units shown next to each parameter input.

Validating results: Always sanity-check simulator output against physical intuition or hand calculations. If a result seems unexpected, review your input parameters or verify with an independent method.

How to Use

  1. Set feed rate (F) using slider sl-f: typical range 0.01–0.1. Higher values inject reactant A continuously.
  2. Set kill rate (K) using slider sl-k: typical range 0.01–0.08. Controls removal of product V.
  3. Adjust diffusion rates (Du, Dv) with sl-du and sl-dv: Du ≈ 1.0, Dv ≈ 0.5 creates instability zones where patterns emerge.
  4. Run simulation and observe self-organizing spots or stripes forming across the 2D domain over 5000+ timesteps.

Worked Example

Gray-Scott model with F=0.055, K=0.062, Du=1.0, Dv=0.5 produces leopard-spot patterns within 3000 iterations on a 256×256 grid. Setting F=0.045, K=0.031 instead yields labyrinthine stripe patterns (like zebra coat). Reaction equations: ∂U/∂t = Du·∇²U − U·V² + F·(1−U); ∂V/∂t = Dv·∇²V + U·V² − (F+K)·V. Varying F±0.005 dramatically shifts pattern wavelength; K controls pattern stability.

Practical Notes

  1. Instability region: Turing patterns only appear for F and K pairs within a narrow band (e.g., F ≈ 0.03–0.07, K ≈ 0.02–0.08). Outside this zone, patterns collapse to uniform state.
  2. Diffusion ratio Du/Dv critically controls pattern type: ratio ≈ 2.0 favors spots; ratios near 1.0 tend toward stripes. This explains why leopard skin has Du/Dv ≈ 2, fish pigmentation differs.
  3. Initialize with random seed in V domain (typically 5–10% noise) to trigger symmetry-breaking. Deterministic initial conditions suppress pattern nucleation.
  4. Real biological applications: sea-shell pigmentation, coral reefs, and developmental morphogenesis follow similar Gray-Scott kinetics with local F, K heterogeneity.