Skip to content

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 requested review from MaxThevenet and ax3l August 1, 2024 18:50
@RemiLehe RemiLehe disabled auto-merge September 18, 2024 16:08
@RemiLehe RemiLehe merged commit fd637e0 into optimas-org:main Sep 18, 2024
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