Skip to content

Remove buggy synchronization at end of steps #5820

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

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

dpgrote
Copy link
Member

@dpgrote dpgrote commented Apr 8, 2025

This PR does cleanup, removing a potential bug that happens when the velocity is synchronized with position in the final diagnostic. The particle boundary conditions had not been applied so the field gather could be out of bounds.

Further cleanup is done, renaming Synchronize to SynchronizeVelocityWithPosition, and having it check is_synchronized, since the synchronization may have already been done.

Rename Synchronize to SynchronizeVelocityWithPosition.
SynchronizeVelocityWithPosition checks is_synchronized.
@dpgrote dpgrote added bug Something isn't working cleaning Clean code, improve readability labels Apr 8, 2025
@EZoni EZoni requested review from RemiLehe and EZoni April 15, 2025 23:47
@RemiLehe
Copy link
Member

@dpgrote Thanks for this PR! Would you be able to merge development into this PR and update the checksums?

*m_fields.get(FieldType::Bfield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{2}, lev)
);
if (!is_synchronized) {
Copy link
Member

Choose a reason for hiding this comment

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

This may be one of those examples where making it clear that is_synchronized is a member variable of the WarpX class, through the prefix m_, would help not get lost while reading the code. For a minute I was trying to understand where is_synchronized is defined in this function. We could rename it according to the WarpX style rules in a separate PR.

@EZoni
Copy link
Member

EZoni commented Apr 24, 2025

Two big PRs are being merged as we speak:

Since those PRs introduce new CI tests, I would recommend that we merge development here, after those PRs are merged, before resetting the checksums in this PR.

@aeriforme
Copy link
Member

aeriforme commented May 1, 2025

I could use this fix after #3630 was merged.
I have some simulations (that use that PR) where the last time step fails, not matter which step it is.
I merged this branch and it works fine.

@EZoni EZoni added the bug: affects latest release Bug also exists in latest release version label May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working cleaning Clean code, improve readability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move velocity and position synchronization to appropriate place in PIC loop
4 participants