How far can you trust the numbers?
Every case below runs the app's own solver (src/lbm.js) on a problem with a known answer —
an exact solution, a published result, or a conservation law — and checks the answer against a stated
tolerance. The results shown were recorded with node tube-flow-sim/tests/validation.test.js;
press Re-run to compute them again in your browser, from the same code.
Cases
GPU solver: same answer as the CPU solver
The WebGPU solver (src/lbm-gpu.js) is a port of the same scheme. Each case runs both for 400 steps and
compares every node: velocity within 5·10⁻⁴ of the speed (float32 summation order), density within 10⁻⁵, the drag on the body within
0.01%, the wall force within 0.5% (a sum of thousands of nearly cancelling terms), mass within 10⁻⁶.
| case | nodes | velocity diff | density diff | drag GPU / CPU − 1 | wall force | mass |
|---|---|---|---|---|---|---|
Recorded with tests/gpu.test.js on an Intel Xe laptop GPU: all 5 cases pass (27/27 checks), ~200 million lattice updates per second. | ||||||
Benchmark: the wake of a sphere
Long GPU runs (tests/benchmark.js): a sphere moving through a tube with 20% blockage, 16 cells across,
1.8 million cells, compared with Johnson & Patel (1999, J. Fluid Mech. 378, 19–70) for a sphere in unbounded flow.
| Re | quantity | simulation | Johnson & Patel (unbounded) |
|---|---|---|---|
| 100 | recirculation length L/d | 0.86 | 0.88 |
| 100 | drag coefficient C_d | 1.20 | 1.09 — the tube's blockage raises the drag |
| 300 | wake | steady, oblique | steady, planar-symmetric from Re ≈ 210 |
| 300 | mean lift coefficient | 0.066 | ≈ 0.065 |
| 376 | wake | periodic shedding | periodic shedding above Re ≈ 270 |
| 376 | Strouhal number | 0.150 | 0.137 at Re 300, rising toward ~0.17 at Re 500 |
Limits — what the numbers don't cover
- Resolution. A body needs at least ~6 cells across for drag within a few percent (at 4.8 cells the Stokes drag is 12% low); the app says when a case's Reynolds number is beyond what the grid can resolve and runs the highest it can instead.
- No turbulence model. Flows are resolved directly; wakes become under-resolved well before transition in open flow (Re ~ 10³).
- Weak compressibility. Lattice Boltzmann is weakly compressible: the app keeps the Mach number ≤ 0.17 (errors ~ Ma² ≈ 2–3%).
- Confinement. Every case is in a tube. Published open-flow data (Schiller–Naumann, Johnson & Patel) are for comparison: blockage raises the drag and delays wake instabilities.
- Start-up. A run starts from the inflow profile with the body present, which gives a brief force spike and pressure waves that die out over one to two flow-throughs; the measurements average over windows after that.
Reproduce
node tube-flow-sim/tests/lbm.test.js # 28 checks (also run on every change) node tube-flow-sim/tests/validation.test.js # this report → tests/validation-results.json python -m http.server 8767 # then, with Playwright and a WebGPU-capable Chromium: CHROME=<chrome.exe> node tube-flow-sim/tests/gpu.test.js