Waves approaching a sandbar

This models surface gravity waves they approach a sandbar. Waves are generated in the deep water on the left of the domain, then propagate towards a shallowing continental slope, before impinging upon a sandbar. A sponge-layer on the right-side of the domain absorbs the waves before they reflect back.

The above movie highlights the areas of the waves that are steeper than 7:1, the value at which waves typically break. A Matlab script is included to recreate the movie shown above.

The code is spectral, using a cosine transform to compute all the derivatives. The model does not use fast-cosine transforms because the form of the equations does not allow for this.

The code is available for download from GitHub