Reaction-Diffusion Simulator Back
Self-Organization

Reaction-Diffusion Simulator

Generate Turing patterns — spots, stripes, bubbles, coral — in real time using the Gray-Scott model. Freely adjust diffusion coefficients, feed rate, and kill rate.

Parameters

Du (U diffusion)
Dv (V diffusion)
F (feed rate)
k (kill rate)
Speed

Presets

Results
0
Steps
Spots
Pattern
0
FPS
U mean
Reaction–Diffusion Pattern
Theory & Key Formulas

$$\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 concentration shown in false color (blue=0, yellow=1). Different F/k combinations yield diverse patterns.

What is Reaction-Diffusion?

🙋
What exactly is a "reaction-diffusion" system? The name sounds complicated.
🎓
Basically, it's a simple concept: two chemicals spread out (diffuse) and react with each other. In practice, this interplay can create incredibly complex, self-organizing patterns out of a uniform state. For instance, the stripes on a zebra or the spots on a leopard are thought to form this way. Try moving the "Feed Rate (F)" slider in the simulator above to see how a simple change can trigger pattern formation from a blank state.
🙋
Wait, really? So the simulator is modeling two fake chemicals? What do the "U" and "V" stand for?
🎓
Exactly. In the Gray-Scott model used here, "U" is a substrate or "food" chemical that is constantly fed into the system. "V" is an "activator" or "pigment" chemical that consumes U to reproduce, but also decays. The colors you see represent the concentration of U. When you change the "Kill Rate (k)" parameter, you're controlling how quickly V decays, which dramatically changes the pattern.
🙋
That makes sense! So the "Du" and "Dv" sliders control how fast they spread. Why does that matter for making spots versus stripes?
🎓
Great question! It's all about instability. For patterns to form, the inhibitor (U, which spreads faster with a higher Du) must diffuse away more quickly than the activator (V). This allows V to form concentrated spots or bands without being immediately suppressed. A common case is setting Dv much lower than Du. Try the "Spots" preset button—it sets this diffusion ratio and adjusts F and k to create a stable spotted pattern.

Physical Model & Key Equations

The Gray-Scott model is defined by two coupled partial differential equations that govern the concentrations of chemicals U and V over time and space.

$$ \frac{\partial u}{\partial t}=D_u\nabla^2 u - uv^2+F(1-u) $$

$u(x,y,t)$: Concentration of substrate U.
$D_u$: Diffusion rate of U (how fast it spreads).
$\nabla^2 u$: The diffusion term (spreading).
$-uv^2$: The reaction term (U is consumed by V).
$F(1-u)$: Feed term (fresh U is added).

The second equation describes the dynamics of the activator chemical V.

$$ \frac{\partial v}{\partial t}=D_v\nabla^2 v + uv^2-(F+k)v $$

$v(x,y,t)$: Concentration of activator V.
$D_v$ : Diffusion rate of V (typically slower than $D_u$).
$+uv^2$: Reaction term (V reproduces by consuming U).
$-(F+k)v$ : Decay term; V is removed. Here, $k$ is the crucial "kill rate" parameter you control with a slider.

Real-World Applications

Biological Pattern Formation: This is the classic example. The equations provide a plausible model for how animal coat patterns (zebra stripes, leopard spots, angelfish stripes) self-organize from a uniform embryonic state. The parameters (like feed and kill rates) could be controlled by genetic and environmental factors.

Corrosion & Material Degradation: Reaction-diffusion models simulate how corrosive agents (like oxygen or ions) diffuse through a protective coating or material and react with the substrate. Engineers use these simulations to predict failure points and design more resistant materials.

Combustion & Flame Propagation: The spread of a flame front in an engine or burner is a reaction-diffusion process. Fuel and oxidizer diffuse together, and a reaction (combustion) occurs when conditions are right. Simulating this is key to designing efficient and safe engines.

Electrochemical Systems & Battery Design: In a battery, ions diffuse through an electrolyte and react at the electrodes. Modeling this with reaction-diffusion equations helps optimize battery performance, lifespan, and safety by understanding the formation of potentially damaging concentration patterns.

Common Misconceptions and Points to Note

First, do you think "the initial state can be anything"? In reality, the initial state is extremely important; slight noise (randomness) acts as the "seed" for pattern formation. Nothing emerges from a perfectly uniform state. This simulator places a V-shaped "seed" in the center as the initial state, but in practical applications, you need to set noise based on real observational data.

Next, you might expect to quickly create a "desired pattern" through parameter tuning, but the combination of F and k is very delicate. For example, when transitioning from the preset "spots" to "stripes", disordered patterns (chaos) often appear at intermediate parameters. This is not a bug but an essential feature of the system's nonlinearity. In practice, systematically sweeping the parameter space to find "stable regions" is the first step.

Also, be cautious of the misconception that "the diffusion coefficient ratio (Dv/Du) can be fixed". The essence of the Gray-Scott model lies in the fact that the activator V remains in a much narrower region than the inhibitor U (Dv < Du). If you bring this ratio close to 1, patterns will not form, and the system will converge to a uniform state. If you don't see patterns in your simulation, first check this premise.

How to Use

  1. Set diffusion rate for U (valDu): typical range 0.16–0.26 for spot patterns
  2. Set diffusion rate for V (valDv): typically 0.08–0.12, controls stripe formation speed
  3. Adjust feed rate F (valF): values 0.02–0.1 govern pattern wavelength and density
  4. Tune kill rate K (valK): range 0.045–0.065 determines spot vs. stripe transition
  5. Click simulate to evolve the Gray-Scott reaction-diffusion system in real time

Worked Example

Starting with Du=0.20, Dv=0.10, F=0.055, K=0.062: the system generates leopard-spot patterns within 2000 iterations. Reducing F to 0.035 while keeping K=0.062 shifts the pattern toward stripes. Increasing K to 0.080 with F=0.040 produces labyrinthine spirals. These parameter combinations reproduce Turing instabilities observed in zebra stripe morphogenesis and chemical oscillators like the Chlorine Dioxide-Iodine-Malonic Acid (CDIMA) reaction.

Practical Notes

  1. Unstable regions occur near the Turing bifurcation: small adjustments in F or K (±0.003) dramatically shift spot density and branch patterns
  2. High Du/Dv ratios (>2) suppress pattern formation entirely; maintain ratio between 1.5–3 for visible Turing structures
  3. Pattern wavelength scales inversely with feed rate—reduce F by 10% to roughly halve feature size
  4. Simulation stability requires timestep dt ≤ 0.5 for grids larger than 256×256 pixels