This cellular automata models a granular material in a gravitational field. There are two kinds of cells. Immovable ground cells and movable sand grains. Grains fall from a source at the top of the window and proceed down to the ground. Grains pile up and redistribute themselves according to the cellular automata rules. Application of the rule is a little more sophisticated than the Game of Life or Forest Fire rules.
Here, at each iteration, the cell space is twice partitioned into 2x2 blocks. The first partition finds the 2x2 blocks centered at sites with even coordinates. The second partition finds the 2x2 blocks centered at sites with odd coordinates. This kind of partitioning scheme is called a Margolus Partition. Updates alternate between partitions. On each partition the following rules are applied to each 2x2 block.
As you can see we've only shown 8 of the 16 possible 2x2 blocks. 7 of the remaining 8 blocks are static, e.g. don't change. The last possibility is
A last step, that we didn't discuss, is ground cells. Ground cells behave differently from sand in that they do not move. You can read the reference below to see how to modify the rule to incorporate ground cells.
* taken from Cellular Automata Modeling of Physical Systems, Chopard B. and Droz M., Cambridge University Press, 1998.
A chance to play with sand without getting your hands dirty. The black pipe at the top center is a source of sand grains. The black line at the bottom is the ground. Use the mouse to put pieces of ground wherever you want. A click will toggle the cell between ground and no ground. A click and drag will create a swath of ground cells.
The Start button will start the grains moving according to the rules. Stop stops the evolution. The Step button steps through the evolution one update at a time. Reset clears the board.
There are a couple of preset configurations available in the menu at the top.
Hint: It's ok to put a swath of ground across the pipe at the top if you want to stop or limit the flow of grains into the frame.
Note: The more grains that enter the frame, the harder the calculation. This applet will really slow down if you let too many grains enter the frame.
Note: There's no automatic stopping criteria, so this applet will run as long as you let it--even if no grains are actually moving.