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

Injection from EB: do not create particles outside of user-specified bounds #5521

Merged

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Dec 18, 2024

When using the injection from embedded boundaries along with zmin, zmax, xmin, xmax, etc., we were creating a large number of macroparticles along the EB surface, and then removing the particles that are outside of zmin, zmax, xmin, xmax, etc. by setting their ID to an invalid value.

In case where the area defined by zmin, zmax, xmin, xmax, etc. is a small fraction of the EB surface, it is much more efficient not to create these particles in the first place. In addition, it avoids having to create a large number of particle IDs, which are eventually not used in the simulation. (In some use cases, this unnecessarily lead to a particle ID overflow, i.e. WarpX ended up having to generate particle IDs that were outside the maximum possible range given by the number of bits.)

This PR removes this issue.

@RemiLehe RemiLehe changed the title Injection from EB: do not create particles outside of user-specified bounds [WIP] Injection from EB: do not create particles outside of user-specified bounds Dec 18, 2024
@RemiLehe RemiLehe requested a review from dpgrote December 21, 2024 00:05
@RemiLehe RemiLehe changed the title [WIP] Injection from EB: do not create particles outside of user-specified bounds Injection from EB: do not create particles outside of user-specified bounds Dec 21, 2024
@RemiLehe RemiLehe assigned RemiLehe and dpgrote and unassigned RemiLehe Dec 21, 2024
Copy link
Member

@dpgrote dpgrote left a comment

Choose a reason for hiding this comment

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

Looks good. Nice that the fix was fairly small.

@RemiLehe RemiLehe merged commit 98889d6 into ECP-WarpX:development Jan 2, 2025
37 checks passed
@RemiLehe RemiLehe deleted the flux_avoid_creating_macroparticles branch January 2, 2025 17:24
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