Collapse of a triangle lattice wave protection under waves arriving at an angle
Channel: Nils Berglund
Date: 2021-08-13

This second simulation of waves gradually destroying a coastal protection uses a similar principle as the video https://youtu.be/Iuur_HNIt0Q, but with a number of differences. The obstacles are now arranged along a triangular grid. The index of refraction inside the obstacles is equal to 2 (the wave speed is reduced to 50%), and the waves arrive at an angle, which is more realistic in most situations. As before, the color of the obstacles depends on the energy dissipated by them: cyan means no energy, red means that a threshold has been attained, after which the circle is erased.  
The colors outside the obstacles represent the wave height. Having the waves arriving at a prescribed angle is achieved by imposing suitable oscillating boundary conditions on the left boundary, and on the top and bottom boundary left of the obstacles. There are periodic boundary conditions on the remaining parts of top and bottom (meaning these parts are glued together), and absorbing boundary conditions on the right. I had to include some dissipation outside the obstacles as well, because otherwise the energy would accumulate to the point of causing numerical instabilities. The index of refraction and dissipation are now correctly reset whenever an obstacle disappears.  

Music: "Sky Scraper" by Geographer@geographermusic

See also https://images.math.cnrs.fr/Des-ondes-dans-mon-billard-partie-I.html for more explanations (in French) on  a few previous simulations of wave equations. 

The simulation solves the wave equation by discretization. The algorithm is adapted from the paper https://hplgit.github.io/fdm-book/doc/pub/wave/pdf/wave-4print.pdf 
C code: https://github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html 
Many thanks to my colleague Marco Mancini for helping me to accelerate my code!