|
 |
 |
 |
 |
|
|
The reaction-diffusion algorithm is usually described by two calculus equations. I prefer to describe an algorithm as an algorithm, so the following explains how the cellular automaton is run. The "neighbors" of each cell consist of the (up to) 4 adjacent and (up to) 4 diagonal cells.
Pick a random cell.
Diffusion:
With the number of adjacent neighbors being N, take the difference of 1/Nth of the U value and 1/Nth of the neighbor's U. Scale this value by multiplying it with the U Diffusion Rate. Add this "change" amount to the cell and subtract the same amount from the neighbor. (So, Change = {(OldU/N)-(NeighborU/N)} * UDiffusionRate. NewU = OldU + Change, and NewNeighborU = OldNeighborU - Change.) Repeat this for each adjacent neighbor, for the U values and the V values separately.
Do the same for the diagonal neighbors, except multiply the U Diffusion Rate by 0.707. This compensates for the distance of these cells compared to the adjacent ones.
Reaction:
The reaction rate is proportional to the concentration of U, and V-squared. Multiply this by the reaction rate to scale it.
React = U * V * V * ReactionRate
NewU = OldU - React
NewV = OldV + React
Replenishing:
It's assumed that the underlying tissue has a U value of 1. So the replenishing is determined by taking the difference between 1 and the U level, and then scaling it by the replenish rate.
NewU = OldU + [(1 - OldU) * Replenish].
Decaying:
The V molecule decays at a rate proportional to how much is there.
NewV = OldV - [OldV * (Replenish + Decay)]
[repeat for the next cell]
This simulation does each cell in its own time before moving on to the next cell. Since they are chosen randomly, there will be some cells calculated twice before others have gone at all. Running all cells simultaneously has more of a tendency to produce bad results, and in reality the chemical reactions in the skin cells will not all be in lockstep.
|
|