Feature Library

A wind tunnel around anything

2.26 GPU · 0.26 CPU ms
A still of the A wind tunnel around anything demo
Still
The live demo starts when it’s in view.Drag the body to move it · turn it by its handle or the wheel ([ and ] on the keys) · drag the cards through the air

A real-time lattice Boltzmann (D2Q9) flow in WebGPU compute around solids you describe as plain shapes.

What it costs a frame

2.26 ms
0.26 ms
GPU
2.26 ms
CPU, median
0.26 ms
CPU, 95th pct
0.41 ms
Draw calls
0
Weight
Heavy

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: The sports car on the 512-wide grid (512 × 214 at 1920 × 1080 with the dock), about 16 lattice steps a frame at 60 Hz, 44 smoke lines of 512 particles, 32,768 tracers, one card swept to and fro along the top (the body stays home); 4× multisampled HDR, bloom and tone map; timed with its own timestamp queries. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool2.260.260.41
apple · Apple A19 Proin a browser tab · 16 November 20266.791.902.22
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20267.010.660.80

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

How steadily it runs on Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab

Typical frame ?
16.67 ms
1% low ?
49 fps
Varies by ?
±0.64 ms
All metricsIntel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab
p50p95p9916.00 ms19.96 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.67 ms
p95 ?
17.68 ms
p99 ?
18.05 ms
Slowest ?
26.09 ms
Mean ?
16.74 ms
Standard deviation ?
0.64 ms
1% low ?
49 fps
0.1% low ?
38 fps
Hitches ?
0 of 600
Over budget ?
1 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.1 / 1.4 / 2.6 ms

Input

No input during this run. A browser-tab run plays none.

Memory

JavaScript heap ?
160 → 87.2 MB
Growth ?
-73.13 MB

What it needs

Renders with
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Aerodynamics on a product page
  2. Teaching wakes, stall and vortices
  3. A body people move and turn to see the flow answer
  4. Page cards as walls in the wind
  5. Live drag and lift for a shape
  6. Smoke round obstacles in a game

Pitfalls, in brief

  1. Keep the wind under about 0.12 cells a step (Mach 0.2): the lattice is a slightly compressible gas, and faster air turns into pressure waves and then noise. setFlow clamps it at 0.13; a moving wall is clamped at 0.12.
  2. The Reynolds number decides the flow, not the speed: Re = u × length ÷ ν, in cells.
  3. Never start the air impulsively: a body appearing in a moving stream (or a stream switched on round a body) rings the whole tunnel with pressure waves that take minutes to die down and swamp the pressure view. reset() starts it at rest and eases the inlet up over rampSteps; keep that, and throw away the forces of the first seconds after it.
  4. A 2D lattice is a slice: its drag and lift are per unit span and at a Reynolds number of a few thousand, not a real car’s 10⁷.
  5. One reading is a fraction of a shedding cycle: average the coefficients over a few seconds (runningMean).
11 more in brief
  1. Cards and panels you make solid crowd the air too: two parked high in the stream turned the aerofoil’s lift at 6° from +0.42 to −0.1.
  2. Never make a car’s wheels full solids on the road in a side view: in 2D they seal the gap under the floor, and the trapped air, pumped by the spinning wheels through their staircase edges, ran the downforce up past 40 and on.
  3. Steps follow real time (stepsPerSecond, at most 16 a frame), always an even number, so the two population buffers end where they began.
  4. Shapes are tested at cell centres: a part thinner than about two cells leaks.
  5. A solid that jumps leaves its old cells to be refilled with its velocity: pass the distance a card moved spread over that frame’s steps (domRectToShape’s moved and steps), or the air sees it teleport and does not move.
  6. forces is read from a buffer copied every 20 frames and mapped without waiting: call afterSubmit() after each queue.submit, or it never updates.
  7. Without WebGPU, createTunnelCanvas runs the WebGL2 port: the same air and look.
  8. A new grid (resize) starts the air again: debounce resizes, as the demo does.
  9. The field draws nothing inside solids: draw the bodies yourself (an SVG or your scene) over the canvas.
  10. A body the user moves must not teleport: let it follow the pointer at a capped speed (about 0.1 cells a step, its far end no faster than about 0.06 when turning) and pass what it moved each frame as its walls’ motion (poseShape’s motion).
  11. Clamp a moved body clear of the floor and of the absorbing layers at the inlet, the top and the outlet (clampInto): inside them the air is pulled back to the free stream and the readings mean nothing.
16 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

P. L. Bhatnagar, E. P. Gross & M. Krook, A model for collision processes in gases (Physical Review, 1954): The BGK single-relaxation collision every cell does each step.

Y. H. Qian, D. d’Humières & P. Lallemand, Lattice BGK models for Navier–Stokes equation (Europhysics Letters, 1992): The D2Q9 lattice: its nine directions, weights and equilibrium.

Joseph Smagorinsky, General circulation experiments with the primitive equations (Monthly Weather Review, 1963): The eddy viscosity that grows with the local strain and keeps fast, thin flows stable.

Shuling Hou, James Sterling, Shiyi Chen & Gary Doolen, A lattice Boltzmann subgrid model for high Reynolds number flows (1996): Smagorinsky in the lattice: the relaxation time solved in closed form from the non-equilibrium momentum flux.

Anthony J. C. Ladd, Numerical simulations of particulate suspensions via a discretized Boltzmann equation (Journal of Fluid Mechanics, 1994): Halfway bounce-back with a moving wall’s velocity, and the force on a solid by momentum exchange.

Eastman Jacobs, Kenneth Ward & Robert Pinkerton, NACA Report 460 (1933): The four-digit aerofoil sections (the demo’s 2412) from their published thickness and camber formulas.

Theodore von Kármán (1911): The vortex street the cylinder sheds.

Jorge Jimenez, Next generation post processing in Call of Duty: Advanced Warfare (SIGGRAPH 2014): The 13-tap downsample and tent upsample of the bloom pyramid.

Khronos PBR Neutral tone mapper (Emmett Lalish, 2024): The tone map onto the page, written out in WGSL.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (2020): The PCG hash behind the tracers’ starts and the grain.

WAI-ARIA Authoring Practices Guide (W3C): The radio group pattern for the demo’s body and field pickers (one Tab stop, arrows move).

lattice boltzmanninteractivedrag and rotated2q9cfdfluidcomputeraw webgpuwgslstreaklinessmoketracerspressurevorticitydragliftaerodynamicsmoving wallsdom + gpuatomicstimestamp querieswebgl2 fallbackno dependencies

Near it in the frame