Fluid
Kevin Beason /
Description
1/9/2006
fluid and fluid3D are a 2D and 3D fluid simulator,
respectively,
implemented in C++ and Open Inventor. They solve the
Navier-Stokes equations for fluid-like flow (pic).
For the fluid solver,
I began with Jos Stam's 2D 60-line solver based on the fast fourier
transform (FFT) (ref), which has period boundaries.
To this I added various visualization and interaction abilities, such as
texture advection, plus improved
fluid solver techniques such as vorticity confinement and monotonic cubic interpolation
(ref).
For the 3D version I modified the solver to use Gauss-Seidel relaxtion to
solve for the pressure term, instead of the FFT, again using source code
provided by Jos Stam (ref). Of course, I also extended his solver to 3D. I
added a texture based volume renderer
(using transparent, grid-aligned texture-mapped quads),
I also added Andrew Selle's vortex-particle method (ref) for adding fine turbulent flow
features for explosions. Implementing this method took about a day. Finding
and fixing the bugs, and running dozens of simulations to fine tune parameters
took weeks, or months.
For photorealistic results I used my ray tracer to render the
density as smoke or fog (using isotropic scattering).
You can see my results below.
2D simulation

Density advection with vortex confinement
|

Texture coordinate advection, with grid texture (left) and a
photograph of me (right).
|

Color coded visualization of the velocity.
|

Added particled advection and mouse interaction.
You can use the mouse to add a velocity force,
to stir things up.
|
3D simulation

3D simulation using vortex particles running on a 180x260x180 grid. See
movie below for an animation.

I implemented blackbody emission in my ray tracer, and incorporated several constants defined
in "Physically Based Modeling and Animation of Fire" by Nguyen at al.,
including bouyancy, smoke density, etc.
Left to right:
Smoke simulation with new constants,
flame (5000K), flame (50000K), flame together with smoke
(flame is scaled by a constant, a hack).

Christmas tree-shaped green fog. The fog is initialized as a cone and perturbed with
12000 vortex particles (Selle et al.), then
scaled by a Perlin noise volumetric heightfield (hyper texture) during
rendering. The ground is a fractally displaced 2D heightfield.
Movies

Getting the smoke to behave in a particular
way is a difficult. Here is a
compilation movie of 56 smoke test-run simulations
in my effort to reproduce the vortex particle method paper results.
Click image to download. Size: 5.6 MB. Length: 4:47 s.
|
|

This movie shows a smoke simulation on a 180x260x180 grid, using the
method described in the Siggraph 2005 paper titled
A Vortex Particle
Method for Smoke, Water, and Explosions. This effort was meant
to reproduce one of their results, a rising smoke plume. The simulation
required about 4 minutes per frame. Rendering was done with
my ray tracer
using photon mapping to simulation indirect illumination
for a full global illumination solution. Download:
avi
gif
|
Future work
I would like to simulate clouds for a nice outdoor rendering.
Acknowledgements
Thank you to Dr. Sussman for
explaining several fluid-mechanics topics to me, and
Dr. Banks for his support.
Source Code
References
"Stable Simulation of Fluids", SIGGRAPH 2002 Course Notes #9
(Simulating Nature: Realistic and Interactive Techniques), by Jos Stam
"A simple fluid solver based on the FFT", Jos Stam
"Stable Fuids", Jos Stam
"Real-Time Fluid Dynamics for Games", Jos Stam
"Visual Simulation of Smoke", R. Fedkiw, J. Stam, H. W. Jensen
"A Vortex Particle Method for Smoke, Water, and Explosions", A. Selle, N.
Rasmussen, R. Fedkiw