Skip to content
Research · November 2026

Putting a dam-break flood in the browser

The same 2D shallow-water solver runs 12 to 625 times faster on WebGPU than on a single CPU thread, with no loss of accuracy

2026-11

Our free flood-education site (flood.gitechdesign.com) simulates dam-break floods in the browser. At its core is our own 2D shallow-water solver, in two implementations of the same algorithm: double precision on the CPU and single precision on WebGPU. We ran both on one laptop to answer two questions: how much faster is the GPU, and does single precision bend the results?

Figure 1. Wall-clock time for a fixed 100 steps (left, log-log) and WebGPU speed-up over the CPU (right). CPU: i9-12900H, single thread, double precision. GPU: RTX 3080 Ti Laptop, WebGPU single precision in Chrome 153. Figure labels are in Chinese.
Figure 1. Wall-clock time for a fixed 100 steps (left, log-log) and WebGPU speed-up over the CPU (right). CPU: i9-12900H, single thread, double precision. GPU: RTX 3080 Ti Laptop, WebGPU single precision in Chrome 153. Figure labels are in Chinese.

Five points

The bigger the grid, the bigger the gap

Over a fixed 100 steps, WebGPU is 12 times faster on a 64×64 grid and 625 times faster on 1024×1024: 77.9 seconds on the CPU against 0.125 seconds on WebGPU. On small grids, command submission and synchronisation dominate the GPU time; on large ones its real throughput shows.

Three reasons it is faster

Every cell runs the same algorithm and reads only its neighbours, so the work is naturally parallel; the state stays in GPU memory, with no read-back to the CPU in the main loop; and single precision moves and computes half as much data as double.

Single precision does not bend the results

Against the Ritter dry-bed dam-break solution, both versions have a relative L2 error of 0.80% and a depth at the dam of 4.44 m, matching the theoretical 4.444 m: the error comes from the scheme itself. In a 2D circular dam break over 4 seconds, the relative difference between GPU and CPU stays around 10⁻⁸, at most 6.8×10⁻⁸, and does not grow over time.

Analytic tests before real terrain

The double-precision solver must pass a set of required tests before it touches real terrain: lake at rest to machine precision, the Ritter dry-bed dam break with a relative L2 error of 0.8%, the Stoker wet-bed dam break at 1.9%, mass conservation, and symmetry across the four quadrants of a circular dam break.

Two layers, two jobs

The double-precision CPU version does offline verification; the single-precision WebGPU version drives the interactive site. They share the algorithm and the data interface, so each can check the other: the offline layer guards accuracy, the online layer delivers speed.

Figure 2. Speed and accuracy together: how much faster, why, the accuracy cost (error growth in a 2D circular dam break over 0–4 s) and the two-layer split. Figure labels are in Chinese.
Figure 2. Speed and accuracy together: how much faster, why, the accuracy cost (error growth in a 2D circular dam break over 0–4 s) and the two-layer split. Figure labels are in Chinese.

Limits

  • The CPU version is single-threaded JavaScript without multithreading or SIMD: a reference implementation, not tuned CPU code.
  • Precision differs: double on the CPU, single on the GPU.
  • Each side sets its own adaptive time step from the CFL condition, so the step sequences are close but not identical; wall-clock time is compared over a fixed number of steps.
  • GPU timings include command submission and synchronisation, which penalises small grids.
  • Measured on one machine in one session; drivers and browser versions will shift the numbers.
  • The flood site is an educational, planning-grade simulator, not a warning system; follow official emergency instructions.

Related