This project implements gray scott's reaction diffusion using python. Individual frames are calculated and generated as .png photos by using Pillow. Numpy arrays are used to store value of concentration of each chemical in each cell. To speed up the calculations, numba is also used. This article by Karl Sims served as a tutorial / inspiration / reference for this project.
- Overview
- Features
- Requirements
- Installation
- Usage
- Output
- License
The Gray-Scott model is a reaction-diffusion system that simulates the interactions between two chemical substances. By adjusting various parameters, you can observe the formation of intricate patterns, including spots, stripes, and other complex structures.
- Real-time simulation of the Gray-Scott reaction-diffusion model.
- Adjustable parameters to control the appearance of patterns.
- Visualization of the simulation using pygame.
- Python (>= 3.6)
- llvmlite (0.40.1)
- numba (0.57.1)
- numpy (1.24.4)
- pygame (2.5.0)
- Clone this repository to your local machine or download the ZIP file.
git clone https://github.com/preyasu-rakshit/reaction-diffusion.git
- Navigate to the project directory.
cd reaction-diffusion
- Install the required dependencies using pip.
pip install -r requirements.txt
- This simulation has two demos: one runs the simulation in real time using pygame. For this demo, run:
python gray-scott-pygame.py
- For the second demo which saves each frame as an image, run:
python main.py
- To change patterns, you need to change two important parameters: feed-rate and kill-rate. Below are some well known patterns and the corresponding values of kill and feed rate:
Pattern | Feed Rate | Kill Rate |
---|---|---|
Default | 0.037 | 0.060 |
Solitons | 0.03 | 0.062 |
Moving Spots | 0.014 | 0.054 |
Waves | 0.014 | 0.045 |
- A sample with f = 0.018, k = 0.051:
This project is licensed under the MIT License.