Search⌘ K

Coding Example: Reaction-Diffusion

Explore how to implement the Gray-Scott reaction-diffusion system simulating chemical species patterns using NumPy vectorization. This lesson helps you understand modeling differential equations efficiently and supports experimenting with parameters to observe dynamic pattern formation.

Problem Description

Reaction and diffusion of chemical species can produce a variety of patterns, reminiscent of those often seen in nature. The Gray-Scott equations model such a reaction. For more information on this chemical system see the article Complex Patterns in a Simple System (John E. Pearson, Science, Volume 261, 1993).

Let’s consider two chemical species U and V with respective concentrations u and vand diffusion rates Du and Dv.

V is converted into P with a rate of conversion k. f represents the rate of the process that feeds U and drains U, V and P. This can be written as:

Chemical reaction Equations
U+2V3VU + 2V \rightarrow 3V u˙=Du2uuv2+f(
...