Module 4: Space and Pattern Formation
Reaction-Diffusion Equations and Turing Instability
This module adds space to the dynamics of Modules 1 to 3. You study reaction-diffusion equations, derive the conditions under which diffusion destabilizes a uniform state (Turing 1952; murray2003mathematical?), and build finite-difference solvers for the Gierer-Meinhardt and Gray-Scott models in one and two dimensions (Gierer and Meinhardt 1972; Pearson 1993). Every simulation is checked against the linear theory and against the stability and convergence limits of the numerical scheme.
Session Structure
Session 19: Background on reaction-diffusion equations
Reaction-Diffusion Equations Linearization Laplacian Eigenmodes
Session 20: Turing instability, deriving the conditions
Turing Conditions Dispersion Relation Turing Space
Session 21: Laboratory, pattern formation in 1D
Gierer-Meinhardt Model in 1D Turing Numerics Unstable Modes in 1D Laplacian in 1D Boundary Conditions Gierer-Meinhardt Solver in 1D Time-Step Stability Animation in 1D Animal Coat Patterns Assignment: Pattern Formation (graded)
Session 22: Laboratory, pattern formation in 2D
Laplacian in 2D Gierer-Meinhardt Solver in 2D Animation in 2D Unstable Modes in 2D Gray-Scott Model Gray-Scott Animation Gray-Scott Parameters Gray-Scott: Interaction Gray-Scott: Sliders Assignment: Pattern Formation (graded)
The graded assignment is released in Session 21 and extended in Session 22. An interactive 1D simulator runs at bam-applied-math-lab.streamlit.app.
Learning Goals
- Write a reaction-diffusion model in the scaled form with \(\gamma\) and \(d\), and linearize it around a uniform steady state.
- Compute the eigenmodes of the Laplacian on an interval and a rectangle for Neumann, Dirichlet, and periodic conditions.
- Derive the four Turing conditions and the dispersion relation, and find the unstable band and the fastest-growing mode.
- Implement the 1D and 2D Laplacian with
np.roll()and enforce boundary conditions after each explicit Euler step. - State the explicit Euler stability bound, recognise the artefact that appears when it is violated, and run a convergence check.
- Compare predicted unstable modes with simulated patterns, and explain where linear theory stops being informative.
Numerical Workflow
Every laboratory page follows the same loop:
- Create a spatial grid.
- Approximate the Laplacian with vectorized finite differences.
- Evaluate the reaction terms.
- Update the fields with explicit Euler.
- Enforce the boundary conditions, or exploit the periodic wrapping of
np.roll(). - Plot, animate, or interact with the result.
What You Need
numpystores the spatial fields as arrays.np.roll()gives the neighbouring grid points.matplotlib.pyplotsets up figures, axes, labels, and static plots.matplotlib.animationupdates lines and images frame by frame.matplotlib.backend_baseshandles mouse clicks and key presses on the Gray-Scott interaction page.matplotlib.widgetsprovides the sliders on the same page.
Why Not scipy.integrate.solve_ivp?
In Modules 1 and 2, solve_ivp() handled the time integration because the state was a short ODE vector. Here the main numerical work is different. You discretize space first, update every grid point at every step, and enforce the boundary conditions yourself after each step. That is why this module uses explicit Euler loops.
Use notebooks to test stencils, plot snapshots, or inspect intermediate arrays. Use Python scripts for smooth animations. If your 1D solver still feels shaky, fix it before you start the 2D pages: the 2D code is much easier once the 1D stencil and Euler update are routine.
Explicit Euler is simple and transparent, but it is only conditionally stable. If a simulation explodes immediately, reduce dt, increase dx, or test on a smaller grid first (Time-Step Stability).