immiscible fluid mixing simulation
ben fry

This 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. (By contrast, two 'miscible' fluids would diffuse into one another, like milk being poured into coffee.) A more detailed explanation is available on this page.

Press keys 1 through 9 to control the amount of gravity (how quickly the fluids swap position).

This was a class project developed for Nature of Mathemetical Modeling in Fall 1999. (Later ported without changes to vanilla JavaScript.) Also check out this version running on a Palm handheld. Yay 90s!