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

Add WarpX example for FEL simulation #5337

Merged
merged 58 commits into from
Oct 11, 2024
Merged

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Sep 26, 2024

This adds an example for how to run FEL simulations with the boosted-frame technique.
https://warpx--5337.org.readthedocs.build/en/5337/usage/examples/free_electron_laser/README.html

@ax3l ax3l added the component: documentation Docs, readme and manual label Sep 26, 2024
lambd = 1.0 / np.fft.fftfreq(Nz, d=info.dz)
lambda_radiation_lab = lambd[fft_E[:Nz].argmax()]
lambda_expected = lambda_u / (2 * gamma_boost**2)
# assert abs(lambda_radiation_lab - lambda_expected) / lambda_expected < 0.01
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be updated after #5226

RemiLehe added a commit that referenced this pull request Oct 11, 2024
BTD diagnostics sometimes show artifacts at the edge of the range of
collected data. (See for instance the red curve below.)

My understanding is that this happens because the BTD collection planes
use data from the guard cells outside of the simulation domain, when
interpolating fields that are then used for the Lorentz back-transform.
The guard cell data may not be physically correct (e.g. it may not have
the right cancellation between `E` and `B`), and could thus cause this
artifact.

This PR avoids this issue by prevents the collection planes to collect
data when it is half a cell from the edge of the simulation domain.

See the example below, taken from
#5337 (plot of the laser field,
from the BTD diagnostic)
![Figure
40](https://github.com/user-attachments/assets/e4549856-4182-4a87-aa26-2d3bc6ac8e2c)
The BTD diagnostics values are identical with this PR, except for the
problematic point appearing at the edge of the domain.
RemiLehe added a commit that referenced this pull request Oct 11, 2024
…ing window velocity (#5341)

In the `development` branch, the `BackTransformed` diagnostics assume
that the moving window moves exactly at the speed of light. This PR
generalizes the code for arbitrary moving window velocity.

This PR does not add an automated test, but the upcoming PR #5337 will
add a test which features a moving window with a speed different than
`c`.

This is a follow-up of #5226, which modified the transformation of the
simulation box coordinates for arbitrary moving window velocity, but did
not yet update the `BackTransformed` diagnostic code.
@RemiLehe RemiLehe changed the title [WIP] Add WarpX example for FEL simulation Add WarpX example for FEL simulation Oct 11, 2024
Copy link
Member

@EZoni EZoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really well done, thank you! I left only minor comments.

@RemiLehe RemiLehe closed this Oct 11, 2024
@RemiLehe RemiLehe reopened this Oct 11, 2024
@RemiLehe RemiLehe enabled auto-merge (squash) October 11, 2024 16:46
@RemiLehe RemiLehe merged commit d371166 into ECP-WarpX:development Oct 11, 2024
60 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: documentation Docs, readme and manual
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants