From 2274673109a0fb311ec15a63e50d784ed3873ca5 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 1 Oct 2024 06:16:14 -0700 Subject: [PATCH] Center field scaling around v push --- Source/Particles/Gather/ScaleFields.H | 7 +++++-- Source/Particles/RigidInjectedParticleContainer.cpp | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/Particles/Gather/ScaleFields.H b/Source/Particles/Gather/ScaleFields.H index 5731bc047f4..805c0c6de4b 100644 --- a/Source/Particles/Gather/ScaleFields.H +++ b/Source/Particles/Gather/ScaleFields.H @@ -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; diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index d1e1f48ab38..1aaa2289e55 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -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. @@ -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) {