Skip to content

Thomas-Klietsch/Gray-Scott

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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].

$\frac{\partial u}{\partial t}=d_u\nabla^2u-uv^2+f(1-u)$

$\frac{\partial v}{\partial t}=d_v\nabla^2v+uv^2-v(f+k)$

Solving using explicit Euler (fast, but less accurate):

$u = u + d_t \frac{\partial u}{\partial t}$

$v = v + d_t \frac{\partial v}{\partial t}$

Usage

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 $u$ data directly to image file:

SaveImage( "output", 100, 100, rd.access_u() );

Results for 40k and 100k iterations (raw data output):

40k result100k result

Examples with random growth seeds (SeededGlyph() in main.cpp), and increased contrast:

Seed = 1115807737Seed = 1688804253Seed = 184289529Seed = 271556917

Seed = 3141592654_, scalar = 0.5Seed = 495473109Seed = 943088287Seed = 995678360

Requirement

C++20

CPU with AVX2

Notes

[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

About

Gray-Scott diffusion reaction with AVX2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors