Skip to content

Conversation

@RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Oct 11, 2024

In the rigid injection, the fields where scale by the fraction of time spent between n*dt and (n+1)*dt to the right of the injection plane. However, to be consistent with the leap-frog velocity update, this needs to be between (n-1/2)*dt and (n+1/2)*dt instead.

As a side-effect of this PR, saving and re-setting u and optical_depth to their original value is not needed anymore since the scaling factor for E and B is 0 for particles to the left of the plane.

@RemiLehe RemiLehe marked this pull request as ready for review October 31, 2024 13:25

amrex::ParticleReal* AMREX_RESTRICT x_save = xp_save.dataPtr();
amrex::ParticleReal* AMREX_RESTRICT y_save = yp_save.dataPtr();
amrex::ParticleReal* AMREX_RESTRICT z_save = zp_save.dataPtr();
Copy link
Member Author

Choose a reason for hiding this comment

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

Saving and re-setting u to its original value is not needed anymore since the scaling factor for E and B is 0 for particles to the left of the plane.

@RemiLehe RemiLehe force-pushed the scale_rigid_injection branch from 4b430f1 to f6e4566 Compare October 31, 2024 19:21
@RemiLehe RemiLehe changed the title [WIP] Rigid injection: Center field scaling around the v push Rigid injection: Center field scaling around the v push Oct 31, 2024
@RemiLehe RemiLehe requested a review from dpgrote October 31, 2024 19:29
@RemiLehe RemiLehe assigned RemiLehe and dpgrote and unassigned RemiLehe Oct 31, 2024
// If the particle stays to the left of the plane during the
// whole push, simply set the scaling factor to 0.
if (dtscale < 0._rt) {
dtscale = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps add a comment that since the scale factor is zero, the push of the velocity doesn't change the velocity.

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.

This looks good. I approve, but have one suggestion for a comment to add.

@RemiLehe RemiLehe enabled auto-merge (squash) November 1, 2024 17:19
@RemiLehe RemiLehe merged commit 20a7954 into BLAST-WarpX:development Nov 1, 2024
37 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