Skip to content
SpecializedSource checked

Navier-Stokes Projection

Makes a fluid velocity field incompressible by subtracting pressure gradients.

Quick Facts

Compact metadata for implementation and discovery.

Category
Simulation
Difficulty
Advanced
Family
Grid Fluid Simulation
Tier
Specialized
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
4
Code example
Ready
Visualization
Ready

Overview

The projection step solves for pressure so velocity divergence is removed, a core piece of many grid-based fluid solvers.

Core Concepts

velocity divergencepressure solvePoisson equationincompressibility

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(cells)

Average

O(iterations * cells)

Worst

O(iterations * cells)

Space

O(cells)

When to Use

  • Use when a grid fluid solver needs incompressible smoke or water-like motion.
  • Use when smoke simulation is a central requirement.

When Not to Use

  • Avoid when compressible flow or high-accuracy CFD is required.
  • Avoid when the timestep, constraints, or stability requirements exceed what the method can handle.

What It Does

  • Measures velocity divergence
  • Solves a pressure equation
  • Subtracts pressure gradient from velocity

Use Cases

  • Smoke simulation
  • Water simulation
  • Grid-based fluid solvers

Inputs

  • Velocity grid
  • Cell size
  • Boundary conditions

Outputs

  • Divergence-free velocity field
  • Pressure field

Key Formulas (1)

Projection update

velocitynext = velocity − ∇(pressure)
velocity_next = velocity - gradient(pressure)

Subtracts the pressure gradient to reduce divergence.

Pseudocode

  1. 1.Compute divergence of the velocity field
  2. 2.Solve the pressure Poisson equation
  3. 3.Subtract pressure gradient from velocity
  4. 4.Apply boundary conditions
  5. 5.Use the projected velocity for the next step

Canonical Example

Input
velocity field has outward divergence in one cell
Output
projected field has near-zero divergence
Explanation
Pressure correction removes the local expansion.

Implementation Notes

  • Track divergence before and after projection to debug solver quality.
  • Keep units, timestep size, and state variables explicit in tests.
  • Keep a tiny example with expected output beside the implementation.

Common Pitfalls

  • A weak pressure solve leaves visible volume gain or loss.
  • Large timesteps can add energy, damp motion, or make constraints explode.
  • Not defining boundary, empty, or degenerate inputs before implementation.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show a velocity grid before and after arrows are adjusted to remove divergence.

Navier-Stokes Projection mechanism walkthrough step 1 of 5x₀x₁x₂x*
Step 1 of 5: Compute divergence of the velocity field
simulation-state

Notes

Boundary conditions strongly affect fluid behavior near solid walls.

Sources (1)

What each reference supports for this entry.

Stam 1999

Paper

Stable Fluids paper describing projection-based incompressible fluid simulation for graphics.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Often paired withSemi-Lagrangian Advection

Stable fluid solvers commonly pair semi-Lagrangian advection with projection.

Often paired withVorticity Confinement

Vorticity confinement can restore swirling detail after projection-based fluid solves.

Tags

SimulationFluid SimulationMesh MethodIterative Solver