Skip to content

Commit

Permalink
Center field scaling around v push
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe committed Oct 1, 2024
1 parent 5421ff4 commit 2274673
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Source/Particles/Gather/ScaleFields.H
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ struct ScaleFields
// This only approximates what should be happening. The particles
// should by advanced a fraction of a time step instead.
// Scaling the fields is much easier and may be good enough.
const amrex::Real dtscale = 1._rt - (m_z_plane_previous - zp)/(m_vz_ave_boosted + m_v_boost)/m_dt;
if (0._rt < dtscale && dtscale < 1._rt)
amrex::Real dtscale = 0.5_rt - (m_z_plane_previous - zp)/(m_vz_ave_boosted + m_v_boost)/m_dt;
if (dtscale < 0._rt) {
dtscale = 0;
}
if (dtscale < 1._rt)
{
Exp *= dtscale;
Eyp *= dtscale;
Expand Down
6 changes: 0 additions & 6 deletions Source/Particles/RigidInjectedParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti,
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();
amrex::ParticleReal* AMREX_RESTRICT ux_save = uxp_save.dataPtr();
amrex::ParticleReal* AMREX_RESTRICT uy_save = uyp_save.dataPtr();
amrex::ParticleReal* AMREX_RESTRICT uz_save = uzp_save.dataPtr();

// Undo the push for particles not injected yet.
// The zp are advanced a fixed amount.
Expand All @@ -267,9 +264,6 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti,
amrex::ParticleReal xp, yp, zp;
GetPosition(i, xp, yp, zp);
if (zp <= z_plane_lev) {
ux[i] = ux_save[i];
uy[i] = uy_save[i];
uz[i] = uz_save[i];
xp = x_save[i];
yp = y_save[i];
if (rigid) {
Expand Down

0 comments on commit 2274673

Please sign in to comment.