Warwick-Plasma / epoch

Particle-in-cell code for plasma physics simulations
https://epochpic.github.io
GNU General Public License v3.0
184 stars 58 forks source link

2D FFT of laser pulse #742

Open laxmisubramanyam opened 1 week ago

laxmisubramanyam commented 1 week ago

Hi Friends,

Please, is it possible to help me to understand how to do 2D FFT of a laser pulse. The pulse is defined on the spatial grid as Ey(x,y). I can do 1D FFT (by taking line out of the electric field) but I messed up to extend that approach to 2 dimension.

Any help will be very appreciable.

Thanks a lot. Laxmi

laxmisubramanyam commented 1 week ago

Hi @Status-Mirror,

I want to do spectral analysis similar to the one performed in Fig 4 of the attached article.

POP_Giulietti_2013.pdf

Status-Mirror commented 1 week ago

Hi @laxmisubramanyam,

Figure 4 has two axes: $x$ and $k_x$, from Fourier transforms of $E_y$. These figures show the Fourier spectrum of $x$-propagating waves at different positions along the domain in $x$. In this particular example, I think the approach is more similar to a 1D Fourier transform. I don't know what they mean by "the spectrum of the field times a super-Gaussian function" in the caption, but I can explain how I would create a similar plot.

Firstly, dump the full $E_y$ grid to your SDF file. In a 2D simulation, you have cells in the $x$ and $y$ directions. Take a line-out along $x$ as you did before - you can even average the $E_y$ values across a few cells in $y$, provided the fields are similar in these regions (this may help cut down noise).

As a basic example, let's say you now have a 1D array with 100 $E_y$ values along 100 cells in $x$. Next, split this domain into a few regions, where each is long enough to show a few oscillations of the $E_y$ field. Let's say we use 10 bins, each containing 10 cells. We can then work out the Fourier transform of $E_y$ over these cells, which gives us a $k_x$ spectrum for this part of the domain. We can assign this $k_x$ to the central $x$ position of our range.

The net result is we get different $k_x$ spectra evaluated at different positions, which will allow us to plot a heatmap like Fig 4 of Giulietti. If I had to guess what they meant by "super-Gaussian", I'd say that they spread out their spectrum in the $x$ direction using some super-gauss function, instead of just assigning the full spectrum to one $x$ position as I have.

Hope this helps, Stuart

laxmisubramanyam commented 1 week ago

Hi @Status-Mirror,

Thanks a lot for your help and reply. Please, find attached the Matlab script I am using to calculate the 1D spectrum of the laser pulse. If possible, please, could you suggest how I can modify this script to do as shown in Fig. 4 of Giulietti paper.

Eventually, my main purpose is to see which part of the laser pulse undergoes spectrum modification (is it mainly coming from the front, back or central part of the pulse). May be such question can be answered by full 2D FFT of the pulse.

Thank you so much for your help. Laxmi

epoch2d_1D_fft_matlabfile.txt

laxmisubramanyam commented 6 days ago

Hi @Status-Mirror,

It would be very helpful if you could please help me to re-arrange my Matlab script (in the previous message) to achieve to plot as done in Giulietti paper.

Thanks a lot.