[Flash warning] A planar wave crossing a gradient index lens at an angle
Channel: Nils Berglund
Date: 03/04/2024

The first part of this video shows some flashing due to the formation of standing waves.
This is a variant of the simulation https://youtu.be/CdpTq3dSrXA , in which the incoming planar wave makes a small angle with the axis of symmetry of the lens. The videos are inspired by Huygens Optics' recent short https://youtube.com/shorts/VGd3Ajnp6e0 showing the principle of a gradient index lens.
Lenses focus incoming rays of light by delaying them more near the center of the lens than at its periphery. This is often done with a material of constant index of refraction, by making the lens thicker near the center, as shown for instance in the simulation https://youtu.be/rrJJBh9ubUE . However, one can also build lenses of constant thickness, by making the index of refraction of their material depend on the location in the lens.In this simulation, the index decreases like sqrt(n0² - a*r²), where r is the distance to the axis of symmetry. This results in the incoming planar wave being focused at a point in the focal plane, marked by a vertical line. The plot to the right shows a time-averaged value of the field along that plane. 
This video has two parts, showing the same evolution with two different color gradients:
Wave height: 0:00
Averaged wave energy: 1:03
In the first part, the color hue depends on the height of the wave. In the second part, it depends on the energy  of the wave, averaged over a sliding time window.
There are periodic boundary conditions between the top and bottom boundaries, absorbing boundary conditions on the right boundary, and a time-periodic signal is imposed on the left boundary. The display at the right shows the signal along the focal plane, which is indicated by a vertical line. 

Render time: 30 minutes 1 second
Compression: crf 23
Color scheme: Part 1 - Twilight by Bastian Bechtold
https://github.com/bastibe/twilight
Part 2 - Inferno by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap

Music:  "Chicago" by Joe Bagale

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 #lens #gradient_index