Reaction Diffusion System
A reaction diffusion system is used to model the spatial dynamics of two chemical reactants 'A' and 'B'. Wherein A + 2B → 3B. The 'plate' is initially filled with 'A'. 'B' is added in a localised manner. Both chemical species react with each other and diffuse across the plate to varying degrees, governed by the following equations:
\[ \frac{\partial A_n}{\partial t} = D_A \nabla^2 A_n + f_A (A_n) \] \[ \frac{\partial B_n}{\partial t} = D_B \nabla^2 B_n + f_B (B_n) \]Where An and Bn denotes the concentration of the chemical species in the nth cell of a grid. DA and DB are their diffusion constants. According to the chemical reaction, one species of A gets converted to one species of B, in the presence of two other B's. Hence, we add A at a rate 'r' and remove B at a rate 'e'. Therefore, the reaction functions are:
\[ f_A (A_n) = - A_n B_n^2 + r \] \[ f_B (B_n) = + A_n B_n^2 - e \]After a long period of time, if either reactant hasn't fizzled out completely, then we obtain intricate patterns. The mechanics of Reaction - Diffusion are important for chemical and biological morphogenesis. Infact, the texture of certain pigments found in nature are similar to the patterns obtained here. Black colour denotes high concentrations of 'B' whereas white colour signifies high concentration of 'A'
A change to the below parameters gets immediately reflected. Pausing is recommended:
Diffusion rate of A:
Diffusion rate of B:
Regeneration rate of A:
Elimination rate of B:
Precision (value of Δt):
Iterations per frame:
Patterns
Frame
Coral
Mitosis
Flower
Note:
- It takes a lot of time to form patterns. The simulation can be speeded up in two ways: 1) increasing Δt or 2) Increasing iterations per frame. (1) results in loss of accuracy whereas (2) can cause serious lag in lower end machines
- Interestingly, the above patterns form faster when viewed in mobile devices, since the size of the landscape is inherently small in mobile screens.
- Simulation is still in alpha stage. Certain values of parameters can easily break it.
Developed by ChanRT | Fork me at GitHub