# Reaction-Diffusion

Various simulated concentrations spread out and interact.

# 1 Models

# 1.1 Gray-Scott

\( \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 \)

See https://groups.csail.mit.edu/mac/projects/amorphous/GrayScott/.

# 2 Algorithm

The model has continuous space and time, but digital computers work more easily with discrete grids.

\( \nabla^2 \) is the Laplacian: the sum over a neighbourhood of the center of (neighbour value - center value). Typically one neighbour in each direction, larger neighbourhoods might reduce any numerical instability but cost more calculation effort.

The other values are taken at cell centers.

All pixels (or voxels) need to be calculated simultaneously (don’t mix old and new values in one calculation).

So far I’ve been using simple forward Euler to solve the equations:

u += dudt * dt;

where dt is a small constant (too big and error increases, too small and it takes too long for interesting things to happen).

# 3 Implementations

# 3.1 RDEX

My project from 2008-2019: Reaction-Diffusion EXplorer.

Simulates 2D Gray-Scott model on GPU using OpenGL, making a database of the 4D parameter space, with sound.

RDEX screenshot

# 3.2 Untitled Experiment 2024

Simulates 4D Gray-Scott model on GPU using OpenGL, displaying the 4D results as a flat 2D tile-of-tiles.

# 3.3 RD3X

2026 unpublished work in progress. Simulates 3D Gray-Scott model on CPU using OpenMP (port to GPU is on the todo list), displaying the 3D results as anaglyph using a simple ray marcher.

3D reaction diffusion

The above image of branching tubes used parameters

Du = 0.14
Dv = 0.07
f = 0.05
k = 0.065
dx = 1
dt = 0.5