3D render of a diffraction grating
Channel: Nils Berglund
Date: 2023-07-19

This is a 3D variant of the recent simulation in the video https://youtu.be/DSFEDUXTkBk showing a diffraction grating.
Diffraction gratings are optical devices that can have weird effects on light, such as splitting it into several beams traveling in different directions. This simulation illustrates such an effect for waves encountering a grating made of evenly spaced circular obstacles. 
The video has two parts, showing the same simulation with two different color schemes:
Wave height: 0:00
Average energy (log scale): 1:36
In the first part, the color hue and z-coordinate show the wave height. In the second part, they show the energy of the wave, averaged from the beginning of the simulation, on a logarithmic scale. There are absorbing boundary conditions on the outer boundaries of the simulation. 

Render time: 48 minutes 55 seconds
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: "MydNyte" by Noir et Blanc Vie@NoirEtBlancVie

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!

#wave_equation #waves #diffraction #diffraction_grating