From 4c93fb2f90321dab2477eaabe04785100869c073 Mon Sep 17 00:00:00 2001 From: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com> Date: Thu, 6 Aug 2020 06:31:38 -0700 Subject: swap fieldGather and external fields (#1235) * swap fieldGather and external fields * clarify EB external on particle for RZ * swap order and initialize Exp-Bzp for Photons --- Source/Particles/PhysicalParticleContainer.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Source/Particles/PhysicalParticleContainer.cpp') diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 250cf2816..04e7c75d8 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1482,10 +1482,7 @@ PhysicalParticleContainer::PushP (int lev, Real dt, getPosition(ip, xp, yp, zp); amrex::ParticleReal Exp = 0._rt, Eyp = 0._rt, Ezp = 0._rt; - getExternalE(ip, Exp, Eyp, Ezp); - amrex::ParticleReal Bxp = 0._rt, Byp = 0._rt, Bzp = 0._rt; - getExternalB(ip, Bxp, Byp, Bzp); if (!t_do_not_gather){ // first gather E and B to the particle positions @@ -1495,6 +1492,10 @@ PhysicalParticleContainer::PushP (int lev, Real dt, dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes, nox, galerkin_interpolation); } + // Externally applied E-field in Cartesian co-ordinates + getExternalE(ip, Exp, Eyp, Ezp); + // Externally applied B-field in Cartesian co-ordinates + getExternalB(ip, Bxp, Byp, Bzp); if (do_crr) { amrex::Real qp = q; @@ -1861,10 +1862,7 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti, getPosition(ip, xp, yp, zp); amrex::ParticleReal Exp = 0._rt, Eyp = 0._rt, Ezp = 0._rt; - getExternalE(ip, Exp, Eyp, Ezp); - amrex::ParticleReal Bxp = 0._rt, Byp = 0._rt, Bzp = 0._rt; - getExternalB(ip, Bxp, Byp, Bzp); if(!t_do_not_gather){ // first gather E and B to the particle positions @@ -1874,6 +1872,10 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti, dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes, nox, galerkin_interpolation); } + // Externally applied E-field in Cartesian co-ordinates + getExternalE(ip, Exp, Eyp, Ezp); + // Externally applied B-field in Cartesian co-ordinates + getExternalB(ip, Bxp, Byp, Bzp); scaleFields(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp); -- cgit v1.2.3