Physics simulations and visualizations
A stalling wing and a confined plasma, computed live.
Date: 2026
A personal project, out of passion: understanding physical phenomena by simulating them, and getting better at fluid mechanics, plasma physics or the study of crowds. Rather than isolated scripts, a workshop: a shared core, display engines and a shared control panel, where each new simulation is cheap to add and the physics is checked by tests against known results.
Two simulations run there today, in the browser, with nothing to install: a wind tunnel, to see the air carry a wing then stall, and a tokamak, to see a magnetic field hold a plasma and its particles; a third, simpler one moves a crowd towards a goal. Fourteen situations are ready to watch, and every setting is shared through the page’s address. The project dates from 2026, taken up again in the autumn to show interesting physical effects.
These simulations also serve as a base when I build models for client projects: the same core animates the crowd on this site’s home page.
The result







What was done
01
The workshop
A shared core: the fixed-step computation loop, separate from drawing, bodies, a spatial grid, flocking behaviours, and typed parameters from which the control panel, the situations and the URL parameters derive.
TypeScript · Vite · pnpm
02
The display engines
Three ways to draw the same simulation: a 2D canvas with its colour maps and charts, PixiJS, and Three.js with instancing for thousands of bodies.
Canvas 2D · PixiJS · Three.js
03
The wind tunnel
The air computed with the lattice Boltzmann method, on the processor, tens of millions of cells per second; profiles drawn from their equations; lift and drag measured on the body.
Lattice Boltzmann (D2Q9)
04
The tokamak
An analytic, divergence-free magnetic field whose twist follows the plasma current, islands on demand; field lines and their Poincaré sections; particles as full orbits or guiding centres.
Boris pusher · Guiding centre
05
The crowd
Agents that keep apart, align and gather, drawn to a goal and pushed away by obstacles, on a grid to stay fast.
Boids
06
The checks
Computations compared with known results: a cylinder’s wake, the stall, the divergence-free field, energy conserved, banana widths, the trapped share, the drift with no current.
Vitest
07
The generator
A new simulation created in one command, with its app, its port and its place in the workshop.
Node.js
How it works
Scroll: the drawing follows.
01 / 08
A workshop of simulations, in the browser
A project to build visual physics simulations that run in any browser, with nothing to install. A shared core carries the computation loop, at a fixed time step, separate from the drawing; display engines in 2D and 3D; a control panel derived from each simulation’s parameters. A new simulation is cheap to add, and its physics must be right and checked.
02 / 08
Set, watch, measure, share
Every simulation offers the same services: situations ready to watch, each with its sentence; grouped controls, changed while it runs; readings taken live and charted over time; play, pause, one step, restart, from the keyboard. Every setting is written into the page’s address, to share a situation or capture an image of it after a given number of steps, identically.
03 / 08
The wind tunnel: see the air carry a wing
To understand what makes a wing fly. You pick a body, four wing profiles, a flat plate or a cylinder, its incidence from −10° to 30°, and the speed of the air, from an insect’s flight to a small drone’s. The air is computed live, cell by cell, and watched as smoke, vortices, speed or pressure. At 4°, the smoke follows the profile and the lift stays steady.
04 / 08
The stall, and a cylinder’s wake
At 16°, the air leaves the top of the wing and rolls up into vortices: drag jumps, lift oscillates. Behind a cylinder, vortices shed alternately, the von Kármán street. Tests compare these computations with known results: no lift at 0°, the stall at 16°, and the rate of the cylinder’s vortices, within a few percent of the value measured in the laboratory.
05 / 08
The tokamak: see the field hold a plasma
To understand how a magnetic field holds a plasma. A tokamak in 3D, to turn and zoom, and its section. You set the field, from 1 to 6 teslas, the plasma current, from 0 to 2 megaamperes, and the machine’s shape. Each field line winds in a helix on its surface; the safety factor is plotted live, and a small perturbation tears a surface into magnetic islands.
06 / 08
A trapped particle
A deuteron, an electron or an alpha particle, at the chosen energy, released at the speed and the place you want. Too slow along the field, it bounces back on the inner side, where the field is stronger, and traces a banana whose width shows in centimetres; otherwise it passes, or is lost on the wall. Or a cloud of one hundred to four thousand particles, and the share that stays trapped. Tests check the banana’s width and the trapped share against theory, within a few percent.
07 / 08
With no current, the plasma escapes
Cut the plasma current: the lines no longer twist, ions drift up, electrons down, to the wall, at the speed theory predicts. Eight situations are ready, from helical lines to the fusion alpha, which a stronger current keeps in the machine.
08 / 08
The crowd: agents heading for a goal
A third, simpler simulation: agents that head for a goal while keeping clear of their neighbours and going round two pillars, from ten to twelve hundred of them, with a goal you move with a click. The same core animates the crowd on this site’s home page.
Specifications
- Date
- 2026
- Built with
- TypeScript · Canvas 2D · Three.js · Vite · Vitest
- Platforms
- Web
- Scale
- 14 ready-made situations · 16 physics tests