Pattern formation in reaction-diffusion systems using the Gray-Scott model

Lichuan Zheng
June 2020


Pattern formation have received considerable attention in the fields of biology and chemistry. In systems consisting of many interacting components, a variety of irregular spatiotemporal patterns occur during the evolution processes. However, these complex patterns could be simulated by a simple reaction-diffusion system consists of a set of partial differential equations called the Gray Scott equations. Here we show our simulations by using JavaScript with p5.js library. 


In 1952, a year before American biologist James Watson and English physicist Francis Crick discovered DNA, Alan Turing, a British mathematician best known for his work on code-breaking and artificial intelligence, published his only one paper related to biology, “The chemical basis of morphogenesis”, which proposed a theory of how regularly repeating patterns are formed in nature. 1

A comparison of cheetah, leopard and jaguar.2

In this paper, he proposed a system consists of a number of chemicals diffusing through a mass of tissue of given geometrical form and reacting together within it. Although he did not apply his model to any specific biological situation, biologists are uncovering evidence of the patterning mechanisms that Turing proposed in his paper.3 People believe those countless varieties of stripes, spots and scales  on vertebrates  emerge from the interaction of two of these hypothetical chemical substances called “morphogens”.4

It is suggested that a system of chemical substances, called morphogens, reacting together and diffusing through a tissue, is adequate to account for the main phenomena of morphogenesis. — Alan Turing

The underlying mechanism that produces these observable spatial pattern is called Turing-type mechanism. Imagine two chemicals, u, called the activator, and v, called the inhibitor, diffuse in a closed system at different rates. Assume the diffusion coefficient of u, Du, and the diffusion coefficients of v, Dv are different. 

Turing mechanism in general form:
$$ \frac {\partial u}{\partial t} = D_u  \nabla^2 u + \gamma f(u,v)$$ $$ \frac {\partial v}{\partial t} = D_v \nabla^2 v + \gamma g(u,v)$$

where f(u,v) and g(u,v) denote the interation between these two morphogens. While these are called reaction-diffusion equations, we use Gray-Scott(GS) model, which was based on the Turing mechanism, to do the simulations. Notice that we are still working on a system with two kinds of chemicals. And we assume the chemical reactions to be:

$$ U+2V \rightarrow 3V$$ $$ V \rightarrow P$$

P is an inert product of these irreversible reactions. By inputting a parameter k representing the rate of conversion of V to P, and a f representing the rate of the feeding process, the above equations could be transformed to reaction-diffusion equations in Gray-Scott model:

$$ \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 $$


In this way, we are going to design a simulating system where we can choose different feed rates and death rates. We created a canvas of 700*400 pixels. By initialing a pixel with a value, 1 in this case, we can trigger the reaction. The diffusion is obtained by a laplace function. Renew values according to the previous values, this dynamical process is shown by using forward Euler integrations of the finite-difference equations5

  for (var x = 1; x < width - 1; x++) {
    for (var y = 1; y < height - 1; y++) {
      var a = grid[x][y].a;
      var b = grid[x][y].b;
      next[x][y].a = a + (dA * laplaceA(x, y)) - (a * b * b) + (feed * (1 - a));
      next[x][y].b = b + (dB * laplaceB(x, y)) + (a * b * b) - ((k + feed) * b);

      next[x][y].a = constrain(next[x][y].a, 0, 1);
      next[x][y].b = constrain(next[x][y].b, 0, 1);


Simulation results and corresponding values.
Name Feed Rate f Death Rate k
Waves 0.014 0.045
Chaos 0.026 0.051
Spots and Loops 0.018 0.051
Moving Spots 0.014 0.054
Chaos and Holes 0.034 0.056
Mazes 0.029 0.057
Holes 0.039 0.058
Pulsating Solitons 0.025 0.060
The U-Skate World 0.062 0.06093
Worms 0.078 0.061
Solitons 0.030 0.062
Right click and show controls to start the videos below if they freeze.
Spots and Loops
Moving Spots
Chaos and Holes
Pulsating Solitons
The U-Skate World
Location of the results
Location of the results simulated above.
Location of the unstable mode
Location of the unstable mode by Jeff S. McGough and Kyle Riley, in Pattern formation in the Gray-Scott model.


1. Jennifer Ouellette, "Biologists Home In on Turing Patterns", March 25, 2013,

2. Jean Charles Werner, “Cheetah, leopard & jaguar (en).jpg”, From Wikimedia Commons, the free media repository, November 14, 2018,_leopard_%26_jaguar_(en).jpg.

3. Jonathan Lambert, “Ancient Turing Pattern Builds Feathers, Hair — and Now, Shark Skin”, January 2, 2019,

4. J. D. Murray, “Why Are There No 3-Headed Monsters? Mathematical Modeling in Biology”,

5. John E. Pearson, “Complex Patterns in a Simple System”,



  1. Click Play/Pause button to start or pause the simulation
  2. Either paint directly on the canvas or click Random button to initialize
  3. One can also reset the canvas by clicking Clear button
  4. Use the sliders to set the values of the Feed rate k and the Death rate k, or type in the last two digits in the textboxes
  5. Google Chrome is always better