4d shapes
something happened: either someone embedded this in an iFrame for some reason (why?!) or you don't have JS enabled
This is a compressible fluid simulator in 2d, simulating a fluid which, of course, can be compressed, but using the eulerian specification (field, not particles). This also means that it is a sound simulator.
The simulation uses a finite-difference method. The equation that describes this fluid is a PDE (partial differential equation) and would ideally be simulated with perfect accuracy. However, doing so would require infinite RAM and time, which I'm sure you don't have. Instead, the simulator breaks space and time up into time steps: time is broken into timesteps, and space is broken up into the grid.
Using this grid, the simulator, each timestep, first calculates pressure changes (fluid going in -> higher pressure), then the velocity changes (flow from high to low pressure), then diffuses pressure, velocity, and smoke, and finally advects them (moves them using the velocity). To avoid asymmetry, the previous values are used for all computations. Also, the top and bottom walls are not removable, as removing them would NaN the simulation.
However, because of this so-called "discretization", this simulation isn't infinitely accurate. There's two main ways this simulation can be inaccurate. The first is inaccuracies. One main error is neumerical dissipation, which basically means that it is impossible to simulate a non-viscous fluid here, because the advection algorithm uses bilinear interpolation (that ugly thing you see when you zoom in a lot on most things). Also, this fluid is compressible, but because of the fact that the grid is not compressible, regions of very high/low pressures can look weird. The second main type of error is explosion, where big numbers get "a little" too big and sometimes get so big that it breaks the simulation. Both of these are neumerical errors.
Given the performance of gravity simulator, you may wonder how I made this more than 1FPS. I did so by using the TypedArray, which basically means the computer has to do thousands of times less work for each part of the fluid.changelog:
fundamentalChange.newThing.tweak.bugfix