Stir a real-time fluid with your mouse and watch dye and velocity swirl across the grid. Every frame solves a stable form of the Navier–Stokes equations — the same maths behind real liquids and gases — right here on your device. Drag to inject colour and momentum, load a preset (smoke plume, ink drop, swirling vortex or rainbow), and tune the viscosity and dye fade while the readouts track the flow. Nothing is uploaded.
You are in the Physics lab.
What your dragging, the swirling colour and the live readouts are telling you.
Every time you drag across the canvas you push two things into the cells under the cursor at once: a splash of coloured dye and a kick of velocity in the direction you moved. The Force slider scales how hard that kick lands, and the Colour mode readout shows which dye you are painting. A preset does the same thing for you — the smoke plume, ink drop and swirling vortex each drop a telling burst of dye and momentum in one shot.
Once injected, the dye no longer sits still — the velocity field advects it, carrying each cell's colour to wherever the flow was heading, which is what stretches a blob into ribbons and streaks. At the same time diffusion lets neighbouring cells trade velocity so the motion smooths out; that is viscosity, the fluid's internal friction. Turn Viscosity up and the flow goes thick and syrupy, down and it runs thin and free. The Dye fade slider sets how quickly the colour dissipates, and the Mean flow readout rises as you stir and settles as the motion dies away.
A real fluid conserves mass — it cannot pile up or leave gaps. After each move the projection step corrects the velocity field so it is incompressible, and that constraint is exactly what turns a straight push into rolling vortices. Without it the flow would look flat and lifeless; with it, every drag leaves curling eddies that keep spinning long after you let go.
The three stages the solver runs every frame to move the fluid and its dye.
The fluid carries things along with it. Each cell looks backwards along the velocity field to find where its contents came from a moment ago, then pulls that velocity and dye forward. This is what makes dye streak and swirl instead of sitting still.
Neighbouring cells exchange velocity so the flow smooths out over time — that is viscosity, the fluid's internal friction. The solver spreads the field with a few Gauss–Seidel iterations; raising the viscosity slider makes the motion thick and syrupy, while lowering it makes it thin and free-flowing.
A real fluid conserves mass — it cannot pile up or vanish. The projection step corrects the velocity field so it is incompressible, which is exactly what creates the rolling vortices. Without it, the flow would look flat and lifeless.
<iframe> on your own site. It loads the same solver script as this page, with the surrounding page furniture stripped away. It runs entirely client-side with no tracking.Teaching or blogging about physics? You can embed this on your own site free — one line of code, no sign-up.
A ready-to-assign lab using the simulation above. Free to use — nothing to install or sign up for, and no student data leaves the browser.
Describe the flow pattern (smooth vs chaotic) at low and high speed, and around obstacles.
Fluids flow smoothly (laminar) at low speed and break into chaotic, swirling turbulence at high speed, especially past obstacles that shed vortices. All of this is governed by the Navier–Stokes equations for momentum and mass conservation.
Educators: link or embed this simulation freely in your LMS or course guide.
Put the Fluid Simulation on your own page — free, no sign-up, no watermark. It runs entirely in your visitors' browsers. Copy the snippet and paste it into your page's HTML.