This simulation solves the 2D Shallow Water Equations to reproduce how a tsunami is born and travels across an ocean. A seafloor rupture displaces the whole water column, launching long-period gravity waves that race across deep water and then pile up dramatically at the coast. Tsunami warning centres run versions of these same equations to forecast arrival times and run-up heights after a submarine earthquake.
ฮท_next = 2ฮท โ ฮท_prev + dtยฒยทโยท(cยฒโฮท) โ ฮท is surface
elevation above rest, cยฒ = gH is the squared wave speed, H the water
depth, g gravity, and dt the time-step. Wave speed
c = โ(gH) gives โ200 m/s in 4 km deep water and โ10 m/s
near shore.
In the open ocean a tsunami may be only half a metre tall yet hundreds of kilometres long, so ships sail over it unnoticed โ but Green's Law means that same energy compresses near shore, where the wave can rear up into a wall of water many metres high.