Reaction-Diffusion simulation using the Gray-Scott model, available in both C and web versions. It visualizes various patterns that emerge from the interaction of two virtual chemicals in a 2D grid.
GPL-3.0 License
This project implements a Reaction-Diffusion simulation using the Gray-Scott model, available in both C and web versions. It visualizes various patterns that emerge from the interaction of two virtual chemicals in a 2D grid.
Reaction-Diffusion systems are mathematical models that describe how the concentration of substances changes in space over time due to local chemical reactions and diffusion. These systems can produce a wide variety of patterns, including spots, stripes, and more complex structures, making them useful for modeling various biological and chemical phenomena.
The C version provides a decent-performance simulation using the Raylib graphics library. It offers:
Jump to C installation instructions
The web version allows for easy access and sharing of the simulation. Features include:
This simulation uses the Gray-Scott model, defined by the following partial differential equations:
∂A/∂t = D_A ∇²A - AB² + f(1-A)
∂B/∂t = D_B ∇²B + AB² - (k+f)B
Where:
Clone the repository:
git clone https://github.com/datavorous/Gray-Scott-Reaction-Diffusion-Model.git
For C version, install Raylib following the instructions on their website.
The web version requires no additional installation.
Navigate and run the build.bat
file, after placing the libraylib.a
file inside the lib/
folder. This will compile and run the simulation.
Open the index.html
file in your web browser, or visit the online demo.
To change patterns in the C version, modify the f
and k
values in the main.cpp
file according to this table:
Pattern | f | k |
---|---|---|
Mitosis | 0.0367 | 0.0649 |
Coral Growth | 0.0545 | 0.062 |
Fingerprint | 0.055 | 0.062 |
... (and so on) |
In the web version, use the dropdown menu to select different patterns.
reaction-diffusion-simulation/
├── bin/
│ └── Makefile
├── include/
├── lib/
├── src/
│ └── main.cpp
├── build.bat
├── index.html
└── README.md
bin
folderbuild.bat
or run it from the command lineWe welcome contributions to the Reaction-Diffusion Simulation project! Here's how you can help:
main
.Follow the Conventional Commits specification:
type(scope): brief description
Longer description if necessary
Closes #123
Q: Why does the simulation slow down with larger grids? A: The computational complexity increases with grid size. Consider lowering the resolution or using a more powerful machine.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Note: This project is for educational purposes only. It does not claim to accurately represent real-world chemical or biological processes.