Differential Equations  Gray Scott Equations
微分方程Introduction to Gray Scott Equations
The GrayScott equations are a set of partial differential equations used to model reactiondiffusion systems, particularly in chemistry and biology. They describe the interaction between two chemical species, typically referred to as
The GrayScott model is known for producing a variety of complex, spatially structured patterns, such as spots, stripes, and waves. The nature of the patterns depends on the parameters
Formulation of GrayScott Equations
The GrayScott model is defined by the following system of PDEs:
where:
and are the concentrations of the two chemical species. and are the diffusion coefficients of and , respectively. is the feed rate of the reactant . is the rate at which decays. is the Laplacian operator, representing diffusion in space.
Interpretation of Terms
 Diffusion Terms:
and represent the spatial diffusion of species and . These terms cause the chemicals to spread out over time.  Reaction Terms:
and represent the interaction between and . The term in the equation for indicates that is consumed in the reaction to produce , while the term in the equation for indicates that is produced in the reaction.  Feed and Decay Terms:
represents the addition of species into the system at a constant rate, while represents the decay of species .
Derivation of Numerical Solutions
We try to keep everything simple. The GrayScott equations are discretized in space using a finite difference method, and the resulting system of ODEs is solved using explicit Euler timestepping.
To give the formulation, we use
The Laplacian in 2D cartesian coordinates is approximated using the fivepoint stencil:
Here we formally present the algorithm for solving the GrayScott equations:
 Use a rectangular grid to discretize the spatialtemporal domain.
 Use forward difference to approximate the time derivative, and fivepoint central difference to approximate the Laplacian to obtain
at each grid point. The term form the truncation error of the finite difference method. The same applies to . The equation applies for time steps 。  Drop the truncation error terms and rearrange the equation to obtain the update rule
.  The initial condition (IC) is set by assigning given values to all
at . The periodic boundary condition (BC) is set by copying the values of at the opposite boundary, i.e., and the same for . The boundary condition is applied at each time step .
The update rule
1 

The periodic boundary condition is not explicitly implemented in the shader. Instead, we use the GL_REPEAT
texture wrapping mode to handle the boundary condition.
Test of Accuracy and Stability
Accuracy
It is difficult to obtain an analytical solution for the GrayScott equations. From the truncation error term, we could expect the method to have a firstorder accuracy in time and secondorder accuracy in space.
Convergence
We could empirically show that the method converges under the condition
First we test the convergence of the method by increasing the spatial resolution while keeping the time step size constant. We set
We also tried to change the time step size while keeping the spatial resolution constant. The result shows that lower time step size leads to consistent results, and the system diverges when the time step size exceeds a certain value.
We finally demonstrate that by decreasing the time step size and increasing the spatial resolution simultaneously, the method could be conditionally convergent. Following the condition
in these simulations. The result shows that the method is convergent under this condition.
Stability
We test the stability of the method by extending final simulation time
Simulation Results
We wrote a GPUaccelerated simulation program using OpenGL and GLSL. The program solves the GrayScott equations on a 2D grid and visualizes the results in realtime.
The program contains a GUI that allows users to adjust the parameters of the GrayScott equations, such as python grayscott.py
in the terminal.
We present the results of the simulation with different parameters. The patterns generated by the GrayScott equations are highly sensitive to the parameters. By adjusting these parameters, we can observe a wide range of patterns, including spots, stripes, and waves. The following images show the phase diagram of the GrayScott equation and the results obtained at different locations in the domain. We set
Conclusion
The GrayScott equations are a powerful tool for modeling reactiondiffusion systems and generating complex spatial patterns. By discretizing the equations and solving them numerically, we can observe a wide range of patterns, including spots, stripes, and waves. The numerical method we presented is conditionally convergent and stable under certain conditions. By adjusting the parameters of the model, we can explore the rich dynamics of reactiondiffusion systems and gain insights into the underlying mechanisms that give rise to complex patterns in nature.