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).
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.
Showing the experiment and a native reference run of the same code. The browser run's curves appear here when it finishes.
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.
Reference LAPACK/BLAS (dgesv, dgeqrf, dorgqr) and SPARSKIT2 (ILUT + GMRES, CSR tools) compiled to WebAssembly from source.
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.
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.
(press Run simulation)
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}
}