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

Use more robust calculation of the emittance. #240

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

RemiLehe
Copy link
Collaborator

@RemiLehe RemiLehe commented Aug 1, 2024

In the issue reported in #236, it turns out that, for some input parameters, the simulation returned on only 2 macroparticles at the end of the acceleration stage.

In this case, this case, the emittance should be exactly 0, but due to floating-point errors, the quantity x2*u2 -xu**2 happened to be negative.

This PR checks that the number of particles is bigger than 2, to avoid this type of error

@RemiLehe RemiLehe changed the title Use alternative way to define emittance in WarpX script Use more robust calculation of the emittance. Aug 1, 2024
@n01r
Copy link
Collaborator

n01r commented Aug 1, 2024

This works and fixes the problem :)

@RemiLehe RemiLehe enabled auto-merge August 1, 2024 18:49
@RemiLehe RemiLehe merged commit fd637e0 into optimas-org:main Sep 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants