Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEL simulation in the boosted frame #4861

Open
rl3418 opened this issue Apr 16, 2024 · 8 comments
Open

FEL simulation in the boosted frame #4861

rl3418 opened this issue Apr 16, 2024 · 8 comments
Labels
component: boosted frame boosted frame components & logic question Further information is requested

Comments

@rl3418
Copy link

rl3418 commented Apr 16, 2024

I'm trying to do a 1D simulation of an gamma=200 beam travelling through an undulator. I transformed everything to a frame with gamma_f=50 an performed a simulation in that frame. The results I obtained from WarpX is very different compared to OSIRIS. I have attached to input file I used and a comparison of the density evolution in the boosted frame.

density_boost_frame_200_short
200_50.txt

@ax3l ax3l added question Further information is requested component: boosted frame boosted frame components & logic labels Apr 22, 2024
@jlvay
Copy link
Member

jlvay commented Apr 23, 2024

Hi. You seem to be doing the Lorentz Transform of the undulator field by hand, which is not needed I think with WarpX. Let me check tomorrow with the team.

@RemiLehe
Copy link
Member

RemiLehe commented Apr 23, 2024

@rl3418
Thanks for raising this issue.
Do you understand what is causing the sharp modulations in the Osiris simulations (which are not seen in WarpX)? Are these physical?
One might think that these modulations correspond to FEL microbunching, but their shape (sharp spikes instead of a sinusoidal modulation, at early times) do not seem consistent with what is usually observed for micro-bunching. Or is there something I am missing?

Also: I tried to quickly estimate the expected microbunching wavelength.
My understanding is that the undulator B field has a 1 T oscillation amplitude. From this, I found that, for your particular parameters, the K parameter is 0.93, and the corresponding expected radiation wavelength in the lab-frame ( $\lambda_u/(2\gamma_0^2)(1+K^2/2)$ ) is 0.18 microns. The corresponding radiation wavelength in the boosted-frame is 1.8e-5 m. Does this calculation seem correct?

This seems roughly consistent with the wavelength of the small-amplitude density modulation seen in the orange curve. So my impression is that that the WarpX simulation starts to show (sinusoidal) microbunching. But again, I am not sure what the sharper, shorter-wavelength modulations in the Osiris simulations correspond to, physically. Does this make sense?

@jlvay
Copy link
Member

jlvay commented Apr 23, 2024

Hi. I see that you are actually doing the Lorentz Transform of all quantities by hand rather than relying on WarpX doing this automatically for you, which is the preferred way.
This can be done by setting:
warpx.gamma_boost = my_constants.gamma_f
warpx.boost_direction = 'z'

and setting every quantity, e.g., beam density, length and velocity, and the undulator field, in the lab frame, then use back-transformed diagnostics (see https://warpx.readthedocs.io/en/latest/usage/parameters.html#backtransformed-diagnostics) to get the data back-transformed automatically from the boosted frame of simulation to the lab frame.

You can also read more about how boosted frame simulations work under the hood from the theory section: https://warpx.readthedocs.io/en/latest/theory/boosted_frame.html#

Let us know if you have questions about that.

@rl3418
Copy link
Author

rl3418 commented Apr 29, 2024

Thanks for the reply, I'll try the warpx.gamma_boost parameter then.

I think your calculation is correct. The radiation wavelength is about 1.8e-5 m. I'm just trying to do a scan to see if the FEL gain length from the boosted frame simulations agree with the theoretical prediction.

The modulation in the Osiris simulations does seem a bit unphysical, which is why I moved to the WarpX in the first place. I originally thought that the beam is just reaching the saturation level very fast.

@rl3418
Copy link
Author

rl3418 commented May 2, 2024

Does dt and dx transform to dt'=dt*gamma*(1+beta) and dz'=dz*gamma*(1+beta) when the warpx.gamma_boost parameter is specified? Also, does warpx transform the <species_name>.zinject_plane automatically as well?

@rl3418
Copy link
Author

rl3418 commented May 2, 2024

Seems like the time step is taken to be warpx.const_dt. Is this supposed to specified in the boosted frame?

@ax3l
Copy link
Member

ax3l commented May 3, 2024

Does dt and dx transform to dt'=dtgamma(1+beta) and dz'=dzgamma(1+beta) when the warpx.gamma_boost parameter is specified? Also, does warpx transform the <species_name>.zinject_plane automatically as well?

Yes, correct. We transform all input parameters from lab to boosted frame automatically, to make WarpX easy to use in the boosted frame.

Seems like the time step is taken to be warpx.const_dt. Is this supposed to specified in the boosted frame?

I would suggest to use the CFL option warpx.cfl and the resolution amr.n_cell to set the time step automatically from the spatial resolution.
(Note that for FDTD stencils and standard PSATD, you want to use a CFL close to, but smaller than, 1, e.g., the default we set is 0.999 and 0.9999 is a good choice, too.)

@RemiLehe
Copy link
Member

@rl3418 You can find an example WarpX script in this PR: #5337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: boosted frame boosted frame components & logic question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants