Skip to content

What is fluid simulation?

Fluid simulation is a computer model of how liquids and gases move. It stores quantities such as velocity, pressure, and density, then updates them step by step with rules from fluid dynamics. Water, smoke, fire, air, and blood all count as fluids, because they flow instead of holding a fixed shape.

Fluid simulation ranges from engineering software that runs for hours to real-time tools that update every frame. The live WebGL fluid simulation on this site is the real-time kind, and each idea on this page links to a setting you can change on it.

The core idea of fluid simulation

Fluid simulation divides space into small pieces and tracks what the fluid does in each one. Velocity says how fast and in which direction the fluid moves at a point. Pressure says how hard the fluid pushes on its neighbours. Density, or dye, says how much smoke, ink, or color sits at that point.

Each time step, the solver moves those quantities along the flow, corrects the velocity so the fluid does not compress, and adds outside forces such as a stroke from your finger. Repeating that loop many times per second produces swirls, trails, and mixing that look and behave like a real fluid.

The equations behind fluid simulation

Fluid simulation is built on the Navier-Stokes equations, named after Claude-Louis Navier and George Gabriel Stokes, who developed them in the 19th century. For an incompressible fluid such as water, they reduce to two rules: momentum is conserved, and the fluid neither bunches up nor thins out.

Each term in the momentum equation describes one physical effect. A solver handles each effect as a separate step, and the table maps those steps to what you see on the live canvas.

Terms of the incompressible Navier-Stokes equations and their role in a real-time solver
TermPhysical meaningSolver stepWhat you see on the canvas
AdvectionThe fluid carries itself and anything in it along the flowSemi-Lagrangian advectionDye trails follow the direction of your stroke
PressureThe fluid pushes back where it would compressPressure projection (Jacobi iterations)Strokes spread sideways into curls instead of piling up
ViscosityInternal friction slows and smooths the flowVelocity dissipation (Flow fade)Motion slows down after you stop painting
External forceGravity, wind, or any push from outsideSplats from mouse, touch, or Auto driftNew motion appears where you drag
IncompressibilityVolume stays constant everywhereDivergence removalFlow loops back around instead of vanishing

Real-time solvers also add vorticity confinement, a correction that restores small swirls lost on a coarse grid. On this site that correction is the Swirl slider.

Grid and particle methods

Fluid simulation methods differ in how they store the fluid. Grid methods, also called Eulerian methods, keep values in fixed cells. Particle methods, also called Lagrangian methods, move many small particles that carry their own values. Hybrid methods use both.

MethodStores the fluid asStrengthsTypical use
Eulerian grid (stable fluids)Values in fixed grid cellsFast and stable on a GPUSmoke, dye, and real-time effects like this site
SPH (smoothed particle hydrodynamics)Particles with mass and velocitySplashes, droplets, free surfacesLiquids in games and astrophysics
PIC and FLIP (hybrid)Particles that pass velocity to a gridDetailed liquid surfaces with stable pressureFilm and VFX water
Lattice BoltzmannParticle distributions on a latticeParallel and good with complex boundariesEngineering and research flows

SPH was introduced in 1977 for astrophysics problems by Lucy, and separately by Gingold and Monaghan. FLIP grew from particle-in-cell methods in the 1980s and became a standard for film liquids.

Real-time, offline, and engineering fluid simulation

Fluid simulation tools fall into three groups by goal. Real-time tools trade accuracy for speed. Offline tools trade speed for visual detail. Engineering CFD tools, short for computational fluid dynamics, trade speed for measured accuracy.

TypeGoalSpeedExamples
Real-timeInteractive motion that looks rightEvery frame, many times per secondBrowser WebGL demos, game engines
Offline (VFX)Detailed, art-directed visualsSeconds to hours per frameBlender (Mantaflow), Houdini FLIP
Engineering CFDMeasured, validated numbersMinutes to days per caseAnsys Fluent, OpenFOAM

The comparison between the first and last group is covered in CFD vs browser fluid simulation, and the offline group in Blender fluid simulation vs browser.

Try each fluid simulation idea live

Each concept above maps to a control on the live canvas. These steps take about two minutes and show what each term does.

Fluid simulation canvas showing swirling teal, orange, and violet dye
A capture from the live simulation on this site: Classic preset, one random splash, then about ten seconds of Auto drift. The curls come from vorticity confinement, and the long trails come from advection.
  1. Open the live simulation, tap Start, and press C to clear the canvas.
  2. Drag once across the canvas and watch the dye follow your stroke. That is advection.
  3. Open Settings and set Swirl to 0, then drag again. The curls disappear, which shows what vorticity confinement adds.
  4. Set Pressure to 0 and drag. The flow looks softer and less round, because pressure no longer fully pushes back.
  5. Raise Flow fade to 3 and drag. Motion stops almost at once, like a thick, viscous fluid.
  6. Turn on Explain field to hide glow effects and see the structure of the flow itself.

A short history of fluid simulation

Fluid simulation started as an engineering and weather tool. Computational fluid dynamics grew from aerospace and meteorology research in the mid 20th century, when solving flow equations by hand became too slow for real problems.

Real-time fluid simulation is newer. In 1999 Jos Stam presented stable fluids at SIGGRAPH, a method that stays numerically stable even with large time steps. Games and later browsers adopted it because it trades some accuracy for speed. The live simulation on this site uses a GPU version of that grid method.

Common uses of fluid simulation

Fluid simulation serves very different jobs. The right tool depends on how much accuracy the job needs and how long you can wait for a result.

  • Visual effects and games, for water, smoke, fire, and magic effects
  • Engineering analysis in specialist CFD software, for aircraft, cars, HVAC, and pumps
  • Weather and climate models, for air and ocean currents at planetary scale
  • Medicine and biology research, for blood flow and breathing
  • Teaching, to show how pressure and swirl behave
  • Art, relaxation, and screen backgrounds, with tools like the kaleidoscope fluid art mode

Limits of a browser fluid simulation

A real-time browser fluid simulation does not output numbers you could use to size a pipe or certify a part. It runs a 2D grid with a fixed number of pressure iterations per frame so it keeps up with your screen. Engineering accuracy needs validated CFD software and an expert to set it up.

The browser simulation does show the main behaviors of a fluid correctly: transport, incompressibility, dissipation, and swirl. That makes it useful for learning, play, and art, which is what Fluidsimulation.net is for.

Questions

Fluid simulation is a computer program that predicts how a liquid or gas moves. It splits space into small pieces, tracks speed and pressure in each, and updates them many times to show the flow.

The Navier-Stokes equations describe fluid motion. They balance momentum, pressure, viscosity, and outside forces. Engineering CFD solves them in detail; real-time tools solve simplified versions.

CFD is the engineering branch of fluid simulation. CFD aims for measured accuracy on fine meshes. Fluid simulation also includes real-time and visual effects tools that aim for believable motion.

Both exist. 3D simulation is common in film and engineering. 2D simulation, like the one on this site, runs much faster and suits interactive use in a browser.

Yes. The WebGL fluid simulation on Fluidsimulation.net runs free in your browser, with no account and nothing to install.