skuschel / postpic

The open-source particle-in-cell post-processor.
GNU General Public License v3.0
66 stars 27 forks source link

How to obtain phase of EM field from EPOCH data #254

Closed zubairy closed 4 years ago

zubairy commented 4 years ago

Dear developers,

Since I found the phase method in postpic, my question is can we obtain the phase of the EM field from the epoch data, or just it can't be used for epoch data, since the output EM field contains only real part?

phase(do_unwrap_phase=True) method of postpic.datahandling.Field instance Returns the (unwrapped) phase of the complex Field.

What I've tested and the results:

Ey = dr.Ey()
phase = Ey.phase()

Ey_XOY_0006 phase_XOY_0006

Ablinne commented 4 years ago

The .phase() method only works for complex fields. You can get the complex field by using the kspace functions and performing a Fourier transform. This should work better:

Ex_complex = dr.kspace_Ex().fft()
Ex_phase = Ex_complex.phase()
zubairy commented 4 years ago

@Ablinne Thanks! I've basically understood the usage of kspace and got the resonable phase for the field.

zubairy commented 3 years ago

Hi @Ablinne,

Can I ask the underlying principle of the physical kspace reconstruction. I saw the document expained that the kspace function basically computes B = 0.5*(B + 1/omega * Cross[k, E]) . Where is this equation come from, from the basic Maxwell equations or from the particle-in-cell algorithm? For a plane wave B == 1/omega * Cross[k, E], why we need to use half part of B itself and the other half part from k cross E to reconstruct B.

And why by this method, we can get the real physical k, i.e., the frequency spetrum only have positive part, while the regular dr.Bz().fft() gives both positive and negtive frequency.

Can you recommend some papers or documents that explain the kspace and complex field reconstruction.

Thanks in advance

Lingang

Ablinne commented 3 years ago

Hi @zubairy,

please have a look at https://doi.org/10.1016/j.jcpx.2019.100019 (https://arxiv.org/abs/1801.04812) where the underlying method is explained. It basically comes down to using a properly complex ansatz for solving Maxwell's free space equations. If you have further questions, don't hesitate to ask.

Best, Alexander