This project's aim is to plot the formation of the Talbot effect in the near field of an infinite periodic diffraction grating of Fourier coefficients
It is recommended to use Docker to install the dependencies and run the script. After having it installed, just create an image with the provided Dockerfile and run the script from the container. To compile the C libraries, run the following from the main folder,
cd pyTalbot/src
make
In order to get all the python required libraries, you may run from the main folder
pip install -r requirements.txt
It is also necessary to compile the C libraries used for integration. For this you need GSL and OpenMPI. You may install them from the terminal in Ubundu and Debian through sudo apt install gsl
and sudo apt install openmpi
, and on macOS through brew install gsl
and brew install openmpi
.
To compile the libraries, run the following from the main folder,
cd pyTalbot/src
make
In order to be able to create the video, it is indispensable to have FFmpeg installed.
You may install it from the terminal in Ubundu and Debian through sudo apt install ffmpeg
and on macOS through brew install ffmpeg
.
This project plots the solution to the 2D wave equation
in the domain
the boundary conditions in
and the initial conditions
All of this can be sumarised through the figure
The solution to this problem can be written in closed form:
which is what we plot. The RHS is mostly straightforward to compute, although certain approximations must be made:
- The most obvious, we have to introduce an
$N$ at which we truncate the series. We usually want to take$N \gg \frac{d}{ \lambda}$ to make sure that we take into account all the oscillatory behaviour. - We have to numerically approximate the integral. In order to do this, we use GSL's adaptative quadrature method, QAG. In case that QAG runs into problems, we use CQUAD, a doubly-adaptative method, instead.
After calculating
There is also the possibility to plot the state of the field at the final time considering the stationary approximation (see section 5 of the notes) and to compare its result to the transient case.
We are including a SLURM file for those interested in running the simulation on a cluster. Furthermore, the code is compatible with both OpenMP and MPI to speed up the computations when available.
This project was developped by Gabriel María Ybarra Marcaida under the supervision of Luis Vega González during the authour's research internship at the Basque Centre for Applied Mathematics in between November 2024 and February 2025.
The authour would like to thank @miguelfrndz and @pcardenal5 with their help with programming issues throughout the development of the project.