Gray-Scott reaction diffusion using OpenMP, and AVX2 for the Laplacian (diffuse term).
Named after Peter Gray and Stephen K. Scott, who published several papers in Chemical Engineering Science (1983-1985, collected in [1]).
The equations, order, and (lowercase) naming follows John E. Pearson's paper [2].
Solving using explicit Euler (fast, but less accurate):
Set up OpenMP (multithreading) with all available CPU threads:
omp_set_dynamic( omp_get_max_threads() );
Using a central growth seed. Create a 100x100 image, with f=0.03, k=0.06, tiling and standard pattern thickness:
GrayScott rd( 100, 100, 0.03f, 0.06f, true, 1.f );
Iterate 40k times:
rd.iterate( 40'000 );
Save
SaveImage( "output", 100, 100, rd.access_u() );
Results for 40k and 100k iterations (raw data output):
Examples with random growth seeds (SeededGlyph() in main.cpp), and increased contrast:
C++20
CPU with AVX2
[1] Peter Gray and Stephen K. Scott (1990)
Chemical Oscillations and Instabilities: Non-linear Chemical Kinetics.
International Series of Monographs on Chemistry.
[2] John E. Pearson (1993)
Science, New Series, Vol. 261, No. 5118
Complex Patterns in a Simple System









