This is a variant of the video • 3D rendering of waves in a medium wit... showing waves in a medium with random index of refraction, in which the wave speed has been subtracted from the z-coordinate. This creates 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 wave speed depends on the position in the following way. It is given by a sum of Gaussians, which are centered at the vertices of a triangular lattice, that have been randomly shifted. The amplitude of the Gaussians is also random. The wave speed is thus maximal near the vertices of the triangular 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 15 minutes
Color scheme: Part 1 - Viridis by Nathaniel J. Smith, Stefan van der Walt and Eric Firing
Part 2 - Magma by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap
Music: "Cru" by Yung Logos@yunglogos
See also https://images.math.cnrs.fr/Des-ondes... 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...
C code: https://github.com/nilsberglund-orlea...
https://www.idpoisson.fr/berglund/sof...
Many thanks to Marco Mancini and Julian Kauth for helping me to accelerate my code!