Refraction (and diffraction) though a raindrop
Channel: Nils Berglund
Date: 2021-07-18

This simulation is inspired by the video https://youtu.be/gpSO-bdt5ns which showed waves encountering a grid of circular regions where their speed of propagation is lower. Maybe you noticed some weird things going on inside the circles. So here is a close-up of a linear wave reaching a circular area in which the speed of propagation is reduced to 30% of its value outside. You can see many interesting features, such as partial and total reflection, and refraction phenomena - I'm sure the specialists in wave motion will point out more, having to do with the formation of rainbows, caustics, Airy functions and whatnot. 
The colors show the energy density of the wave  (obtained by adding squares of the time-derivative of the wave height, and the wave speed times the norm of their spatial gradient). There are periodic boundary conditions on the top and bottom sides of the displayed domain, and absorbing boundary conditions on the sides, which however don't work perfectly, which is why you see some waves reflected from the boundary. 

Music:  Hypnothis by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 licence. https://creativecommons.org/licenses/by/4.0/
Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1100634
Artist: http://incompetech.com/

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!