-
Notifications
You must be signed in to change notification settings - Fork 196
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RemiLehe
commented
Sep 27, 2024
RemiLehe
commented
Sep 27, 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 |
There was a problem hiding this comment.
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
changed the title
[WIP] Add WarpX example for FEL simulation
Add WarpX example for FEL simulation
Oct 11, 2024
RemiLehe
commented
Oct 11, 2024
EZoni
requested changes
Oct 11, 2024
There was a problem hiding this 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.
Examples/Physics_applications/free_electron_laser/analysis_fel.py
Outdated
Show resolved
Hide resolved
Examples/Physics_applications/free_electron_laser/analysis_fel.py
Outdated
Show resolved
Hide resolved
Examples/Physics_applications/free_electron_laser/analysis_fel.py
Outdated
Show resolved
Hide resolved
Examples/Physics_applications/free_electron_laser/analysis_fel.py
Outdated
Show resolved
Hide resolved
Examples/Physics_applications/free_electron_laser/analysis_fel.py
Outdated
Show resolved
Hide resolved
RemiLehe
commented
Oct 11, 2024
Co-authored-by: Edoardo Zoni <[email protected]>
EZoni
approved these changes
Oct 11, 2024
dpgrote
pushed a commit
to dpgrote/WarpX
that referenced
this pull request
Oct 23, 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 ECP-WarpX#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.
dpgrote
pushed a commit
to dpgrote/WarpX
that referenced
this pull request
Oct 23, 2024
…ing window velocity (ECP-WarpX#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 ECP-WarpX#5337 will add a test which features a moving window with a speed different than `c`. This is a follow-up of ECP-WarpX#5226, which modified the transformation of the simulation box coordinates for arbitrary moving window velocity, but did not yet update the `BackTransformed` diagnostic code.
dpgrote
pushed a commit
to dpgrote/WarpX
that referenced
this pull request
Oct 23, 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 --------- Co-authored-by: Brian Naranjo <[email protected]> Co-authored-by: Edoardo Zoni <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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