Reaction-Diffusion system simulation in Dyalog APL and BQN
Find a file
2023-10-03 13:38:33 +02:00
.gitignore Add reaction-diffusion in BQN, with video generation script 2023-10-03 13:38:33 +02:00
generate_animation.sh Add reaction-diffusion in BQN, with video generation script 2023-10-03 13:38:33 +02:00
grayscott.bqn Add reaction-diffusion in BQN, with video generation script 2023-10-03 13:38:33 +02:00
grayscott.dyalog Switch to simpler initialization 2020-12-07 19:37:41 +01:00
img.png Switch to simpler initialization 2020-12-07 19:37:41 +01:00
img.pnm Switch to simpler initialization 2020-12-07 19:37:41 +01:00
inferno.pnm Add reaction-diffusion in BQN, with video generation script 2023-10-03 13:38:33 +02:00
Makefile Initial commit 2020-12-07 19:35:30 +01:00
out.mp4 Add reaction-diffusion in BQN, with video generation script 2023-10-03 13:38:33 +02:00
README.org Remove broken link from readme 2023-10-03 11:49:51 +02:00

Reaction-Diffusion Model

Reaction-Diffusion system simulation using the Gray-Scott model, in Dyalog APL.

/dimitri/reaction-diffusion/media/commit/c607954d344617b08238113e6be915827d52ee9a/img.png

Running

Install Dyalog APL and Netpbm (apt-get install netpbm). Then run make. This will create the img.pnm and img.png files in the current directory.

The images are generated from APL by creating a Netpbm file, which are nice because they are just plain-text. It is then converted to PNG using pnmtopng.

Parameters

All the parameters are defined directly in /dimitri/reaction-diffusion/src/commit/c607954d344617b08238113e6be915827d52ee9a/grayscott.dyalog.

The parameters of the model are:

  • dt: the time step,
  • da: the diffusion rate for A,
  • db: the diffusion rate for B,
  • f: the feed rate for A,
  • k: the kill rate for B.

Additionally, you can change N, the size of the grid, and steps, the number of time steps to simulate.

Finally, the function mat2pbm exports to a bitmap (black and white) format, while mat2pgm exports a grayscale image.

References

This page gives a good explanation of the Gray-Scott model. This notebook gives a nice example of implementation in Python with Numpy. For even more details on the model and a classification of pattern, see this page.