immiscible fluid mixing simulation
ben fry

This applet simulates a container with two fluids of different densities. The fluids are immiscible, like oil and water. In the simulation, the denser fluid starts on top, and slowly the two fluids change places. This phenomenon is known as a Rayleigh-Taylor instability. (As an aside, two 'miscible' fluids would diffuse into one another, in the manner of milk being poured into coffee.)

Press 's' to toggle smaller/larger size if it's running too slow/too fast. Press keys 1 through 9 to control the amount of gravity (how quickly the fluids swap).

Also check out this version that runs on a Palm handheld.

A more detailed explanation is available on this page.

Built with Processing