Click here to download a Windows executable of my 2D fluid dynamics demo (Updated 9:50am 9 Dec 2004). Unzip and run the "water-release.exe" file. Use the left, middle and mouse buttons to interact with the demo - see the readme.txt for more info.
Source code is contained within the jiglib download. Unfortunately I don't think it compiles just at the moment because I haven't updated it to work with some refactoring of jiglib itself - sorry about that!
If you have problems getting it to run, please let me know and send me details about your computer - e.g. processor, operating system (Windows, but XP, NT etc) and graphics card. You can see a video of it on YouTube.
The demo consists of (1) a container that you can move around with the left mouse button (2) a buoyant box/rectangle that you can grab and move with the right mouse button and (3) some "water" that you can move with the keys "wasd" and make a fountain with the middle mouse button.
The images below come from running the water_high.cfg file which uses 1000 particles. This runs at around 45FPS on my machine (2GHz Athlon XP 2400+ with GF5600) when the fluid is "coloured" in (top picture). In the bottom picture it runs at over twice this frame-rate.
Here I started with the rectangle on the left side and moved it across forming a dam, and making the water spill over:
This shows the particles representing the water pouring off the rectangle (which I was just moving upwards). You can see a lot of the particles bunch up around the borders (because of the way density is calculated, and the pressure gradient is derived from density). This is a waste of particles, so solving it would make the algorithm more efficient.