Stable fluids
Jos Stam
Introduces an unconditionally stable numerical method for solving the Navier-Stokes equations via semi-Lagrangian advection and implicit diffusion, enabling fast, real-time, and blowup-free fluid simulation in computer graphics.
Simulating realistic fluid behaviors such as smoke, water, fire, and liquid paint is a vital requirement across visual effects, digital art, and interactive graphics. Historically, physics-based fluid animations relied on explicit numerical methods that become unstable and numerically blow up if large simulation time steps or grid resolutions are used. These numerical breakdowns forced animators to use tiny time steps, severely limiting simulation speed, increasing computational costs, and preventing real-time, interactive manipulation of fluid motion.
The article demonstrates an unconditionally stable method for solving the full, three-dimensional Navier-Stokes equations governing fluid flow. The primary objective is to enable real-time, interactive fluid modeling for computer graphics without risking numerical failure, regardless of the time step size chosen by the user.
To achieve this, the author replaced traditional explicit schemes with a four-step modular framework: adding external forces, transporting velocity by tracing particles backward along flow paths via the method of characteristics, resolving internal viscosity through an implicit diffusion solver, and applying a projection step to enforce mass conservation. The resulting software was implemented in a compact C library of roughly 500 lines of code and tested within an interactive system on an SGI Octane workstation, simulating both two-dimensional and three-dimensional fluid flows and advecting scalar properties such as density, temperature, and visual texture coordinates across grid sizes ranging from 16-cubed to 36-cubed.
The findings confirm three key breakthroughs. First, the algorithm achieves unconditional numerical stability, allowing users to take significantly larger time steps without simulation blowups. Second, the solver operates with linear computational complexity, or near-linear complexity when using Fast Fourier Transforms for periodic boundaries, enabling real-time interactive performance during 3D simulations. Third, by advecting texture coordinates alongside dynamic density fields, the system successfully produces highly detailed, wispy gaseous effects even on coarse, low-resolution computational grids.
These results demonstrate that computer graphics tools can prioritize visual realism and user interactivity over strict physical exactness. By eliminating catastrophic numerical instabilities, production teams and software developers can drastically reduce simulation turnaround times, avoid expensive re-runs, and allow artists to manipulate fluid phenomena directly in real time.
Software teams and tool developers should adopt this stable semi-Lagrangian framework for interactive fluid and gas effects, and combine the fluid solver with dynamic solid textures to maximize visual detail at minimal computational expense. When implementing periodic boundaries, teams should leverage Fourier transform methods for simple and efficient pipelines.
Decision-makers should note that the primary trade-off of this solver is high numerical dissipation, meaning fluids lose energy and dampen more rapidly than in real-world physics, making the method unsuitable for engineering or aerodynamic validation. Additionally, the baseline implementation does not address dynamically moving free boundaries, such as splashing water surfaces. Nonetheless, for computer graphics and interactive artistic tools, confidence in the algorithm's stability, interactivity, and visual quality is exceptionally high.
- Paper: Large steps in cloth simulation, D. Baraff et al. (1998). This seminal work pioneered the use of implicit integration to achieve stable, large-time-step physical simulation in computer graphics, establishing the numerical paradigm that Stam adapted for fluid flow.
- Paper: Physics-informed neural networks (PINNs) for fluid mechanics: a review, Shengze Cai et al. (2021). This review surveys modern physics-informed neural network approaches that build beyond classical numerical grid solvers for the Navier-Stokes equations.
