Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.
Belousov-Zhabotinsky (BZ) reaction is a class of chemical reaction that exhibits morphogenesis or spontaneous pattern creation. The mechanism by which it generates patterns is known as reaction-diffusion and was actually separately proposed by Alan Turing in his famous paper, "
The Chemical Basis of Morphogenesis".
I stumbled across
this paper written by Alasdair Turner. He wrote some code for
Processing to simulate the reaction, so I spent a little time this morning porting it to ActionScript and giving it a UI.
The initial condition is a randomised and homogenous mix of values. As the simulation runs, typical BZ spirals and circles appear - this is morphogenesis.
I've added horizontal sliders to tweak the rate of reaction between the different substrates in the reaction. Subtle variations in these rates can change the patterns between circles and spirals and have can get the entire virtual petri dish oscillating.
I've also added
false color rendering to the output. The values from the BZ solver range from 0 to 1, my code gets the colour value from a linear gradient based on the reaction value in each cell. The list on the left has a handful of gradients that can be selected.
The code itself is pretty simple - with the exception of an item renderer for the gradients in the list, all the code sits in the main application MXML file. However, it's doing a lot of work each frame and isn't fast.
Does this code simulate 'real reactions? Belousov himself had problems trying to publish his work because he couldn't really explain his findings and there was some disbelief the reaction existed at all. However, there are plenty of examples on YouTube of BZ spirals appearing out of chemical reactions.