Skip to content

GrayScott

Systems / ODEs / Spatial fields

A reaction–diffusion system whose spots, stripes, and self-replicating patterns are a landmark of Turing morphogenesis.

continuous · ODE4608 dimensionspatterns

Start here

Python
import tsdynamics as ts

system = ts.systems.GrayScott()
traj = system.run(final_time=1500.0, dt=3.0, seed=0)
ts.plot(traj)

traj.t contains the sample times and traj.y the state array; system.info shows the defaults. In a notebook the last line displays the plot. In a Python script, call .show() on it to open a window, or .save("trajectory.svg") to export it.

With an adaptive ODE solver, dt sets the output spacing; rtol and atol control local integration error. For a fixed-step solver, reduce dt to check numerical convergence.

Illustration: N=96 · F=0.06 · k=0.062 · simulation window: 0–9000 · forward playback

Evolving spatial field — press play to follow the snapshots

This finite simulation illustrates one initial condition and view. The diagnostics below report their own inputs and observation windows.

Dynamics at the default parameters

Lyapunov exponents measure separation rates along an orbit. The Kaplan–Yorke dimension is derived from those rates, not a direct geometric measurement. Finite runs depend on the initial condition, transient and observation window; a value near zero needs a convergence check.

Lyapunov spectrum
Not computed: The default spatial discretisation has 4608 states. Its tangent spectrum is outside this catalogue computation budget; choose a grid and k explicitly.
Kaplan–Yorke dimension
Not computed: A numerical Lyapunov spectrum is required.
Divergence ∇·f
Symbolic summary
$- 9216 Du - 9216 Dv - 4608 F - 2304 k$ (constant part of $\nabla\!\cdot f$)
+ per-cell nonlinear terms (over the 2304-cell field)
Method and evidence

+ per-cell nonlinear terms (over the 2304-cell field)

Equilibria / fixed points
Not computed: A 4608-state multistart root search is outside this catalogue budget.
Recorded parameters and software
{
  "parameters": {
    "N": 48,
    "Du": 0.16,
    "Dv": 0.08,
    "F": 0.06,
    "k": 0.062
  },
  "parameter_expressions": {},
  "state_dimension": 4608,
  "explicit_time": false,
  "library_version": "6.0.3",
  "python": "3.14.8",
  "numpy": "2.4.4",
  "scipy": "1.17.1",
  "protocol_version": 1
}

Definition

Python
@staticmethod
def _equations(Y, t, *, N, Du, Dv, F, k):
    # State layout: [u (N*N), v (N*N)]; unit grid spacing (h = 1).
    def uidx(r, c):
        return (r % N) * N + (c % N)

    def vidx(r, c):
        return N * N + (r % N) * N + (c % N)

    rhs = []
    # u-block.
    for r in range(N):
        for c in range(N):
            u0 = Y(uidx(r, c))
            v0 = Y(vidx(r, c))
            lap_u = (
                Y(uidx(r + 1, c))
                + Y(uidx(r - 1, c))
                + Y(uidx(r, c + 1))
                + Y(uidx(r, c - 1))
                - 4 * u0
            )
            rhs.append(Du * lap_u - u0 * v0 * v0 + F * (1 - u0))
    # v-block.
    for r in range(N):
        for c in range(N):
            u0 = Y(uidx(r, c))
            v0 = Y(vidx(r, c))
            lap_v = (
                Y(vidx(r + 1, c))
                + Y(vidx(r - 1, c))
                + Y(vidx(r, c + 1))
                + Y(vidx(r, c - 1))
                - 4 * v0
            )
            rhs.append(Dv * lap_v + u0 * v0 * v0 - (F + k) * v0)
    return rhs

Parameters

Symbol Default Role
N 48 grid points per side (structural — changing it recompiles)
Du 0.16 u diffusion
Dv 0.08 v diffusion
F 0.06 feed rate
k 0.062 kill rate

Field blocks: u, v

Explore further

Reference

Pearson (1993), Science 261, 189-192
doi:10.1126/science.261.5118.189

BibTeX
BibTeX
@misc{grayscott,
  title = {GrayScott system},
  note = {Pearson (1993), Science 261, 189-192},
  doi = {10.1126/science.261.5118.189}
}