3D render of waves in a periodic medium, shown in their index of refraction landscape
Channel: Nils Berglund
Date: 2023-04-24

This is a 3D render of a simulation similar to that in the video https://youtu.be/QF3F9G75PvE , showing waves propagating in a medium with spatially periodic index of refraction. The wave speed has been subtracted from the z-coordinate, creating a landscape in which the valleys are regions with high wave speed (low index of refraction), while the hills are regions with low wave speed (high index of refraction). 
A source, located at the center of the displayed region, is emitting circular waves at regular time intervals. The position-dependent wave speed is given by a sum of Gaussians, which are centered at the vertices of a rectangular lattice. It is thus maximal near the vertices of the lattice, and drops nearly to zero in regions that remain dark during the simulation, or where the wavelength is very small. 
The simulation has two parts, showing the same evolution with two different color gradients:
Wave height: 0:00
Average wave energy: 1:30
In the first part, the color hue shows the wave height, and the z-coordinate shows the wave height minus a multiple of the wave speed. In the second part, the color hue show the energy of the wave averaged from the beginning of the simulation. The z-coordinate shows the average energy, minus a multiple of the wave speed. One can see the the energy tends to accumulate on hills of the landscape, where the wave speed is low.
There are absorbing boundary conditions on the borders of the displayed region. 

Render time: 2 hours 14 minutes
Color scheme: Part 1 - Viridis by Nathaniel J. Smith, Stefan van der Walt and Eric Firing
Part 2 - Inferno by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap

Music: "Vishnu" by Patrick Patrikios@patrikiospatrick

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 Marco Mancini and Julian Kauth for helping me to accelerate my code!