Bar Test Wave Flume
OceanWave3D-NS · 2D free-surface Navier–Stokes · Fortran → WebAssembly

Submerged-bar wave flume, solved in your browser

The Fortran OceanWave2D-INS solver with MPI was compiled with LLVM Flang to WebAssembly and run on one thread in this tab. It is the bar test: T = 2.02 s, H = 2 cm waves in 0.4 m of water, run over a submerged bar on a 612 × 9 sigma grid up to t = 41 s, the end of the gauge window (1640 steps).

Flume

ready
Step
0 / 1640
t / T
0.00
Model time
0.00 s
Wall time
0.0 s
Speed
–
Time left
–

Surface elevation drawn ×5. Shaded bands are the wave generation zone (left) and absorption zone (right). Numbered ticks are the eight wave gauges. A full run takes about 6 minutes on a laptop; gauge records cover t = 31–41 s.

Wave gauges, 31–41 s

Experiment (Beji & Battjes) Native gfortran run (reference) This browser run

Showing the experiment and a native reference run of the same code. The browser run's curves appear here when it finishes.

How it was built

Compiler

LLVM Flang 22.1.6 with the emscripten-forge wasm32 patches, plus two fixes for 32/64-bit array-descriptor mismatches. Fortran runtime built with Emscripten.

Libraries

Reference LAPACK/BLAS (dgesv, dgeqrf, dorgqr) and SPARSKIT2 (ILUT + GMRES, CSR tools) compiled to WebAssembly from source.

MPI

The Fortran solver is written for parallel runs with MPI domain decomposition; in this single-thread browser build its MPI calls go to a single-rank stub, so halo exchanges do nothing and reductions return their input. The solver source is unchanged apart from three small edits: no mkdir shell call, a call that sends each frame to this page, and the run stops at t = 41 s instead of 41 wave periods.

Check

In Node, the WebAssembly build prints the same mass diagnostics as a native gfortran build, to every printed digit. The binary is about 0.9 MB.

Solver output
(press Run simulation)

Reference

A. P. Engsig-Karup and A. Melander, “A High-Order Finite Difference Incompressible Navier-Stokes model for Water Waves and Wave-Structure Interaction”, 39th International Workshop on Water Waves and Floating Bodies (IWWWFB), St Andrews, Scotland, 14–17 April 2024.

@inproceedings{EngsigKarupMelander2024IWWWFB,
  author    = {Engsig-Karup, Allan P. and Melander, Anders},
  title     = {A High-Order Finite Difference Incompressible {N}avier-{S}tokes model for Water Waves and Wave-Structure Interaction},
  booktitle = {Proceedings of the 39th International Workshop on Water Waves and Floating Bodies (IWWWFB)},
  address   = {St Andrews, Scotland},
  month     = apr,
  year      = {2024}
}