aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar RevathiJambunathan <revanathan@gmail.com> 2020-01-11 00:36:38 -0800
committerGravatar RevathiJambunathan <revanathan@gmail.com> 2020-01-11 00:36:38 -0800
commit4e1b36d2b7adc7fad187212aa8bac43278e9f307 (patch)
tree4f7e60442aaf72edfcddd30707ea4be7fd85f124 /Source/Particles/PhysicalParticleContainer.cpp
parent56165d92f371601302f96613ed1669bdcf87e68b (diff)
downloadWarpX-4e1b36d2b7adc7fad187212aa8bac43278e9f307.tar.gz
WarpX-4e1b36d2b7adc7fad187212aa8bac43278e9f307.tar.zst
WarpX-4e1b36d2b7adc7fad187212aa8bac43278e9f307.zip
moving external field on particle function to FieldGather (pti,...)
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index eae1b2964..a4a9dbcfc 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -964,7 +964,7 @@ PhysicalParticleContainer::EvolveES (const Vector<std::array<std::unique_ptr<Mul
#endif // WARPX_DO_ELECTROSTATIC
void
-PhysicalParticleContainer::ApplyExternalFieldOnParticles(WarpXParIter& pti,
+PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti,
RealVector& Exp, RealVector& Eyp, RealVector& Ezp,
RealVector& Bxp, RealVector& Byp, RealVector& Bzp,
Gpu::ManagedDeviceVector<ParticleReal> xp,
@@ -1077,9 +1077,9 @@ PhysicalParticleContainer::FieldGather (int lev,
// copy data from particle container to temp arrays
//
pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]);
- ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
- m_xp[thread_num], m_yp[thread_num],
- m_zp[thread_num]);
+ //ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
+ // m_xp[thread_num], m_yp[thread_num],
+ // m_zp[thread_num]);
//
// Field Gather
@@ -1210,9 +1210,9 @@ PhysicalParticleContainer::Evolve (int lev,
// copy data from particle container to temp arrays
//
pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]);
- ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
- m_xp[thread_num], m_yp[thread_num],
- m_zp[thread_num]);
+ //ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
+ // m_xp[thread_num], m_yp[thread_num],
+ // m_zp[thread_num]);
// Determine which particles deposit/gather in the buffer, and
// which particles deposit/gather in the fine patch
@@ -1858,9 +1858,9 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
//
pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]);
- ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
- m_xp[thread_num], m_yp[thread_num],
- m_zp[thread_num]);
+ //ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
+ // m_xp[thread_num], m_yp[thread_num],
+ // m_zp[thread_num]);
int e_is_nodal = Ex.is_nodal() and Ey.is_nodal() and Ez.is_nodal();
FieldGather(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
@@ -2229,6 +2229,13 @@ PhysicalParticleContainer::FieldGather (WarpXParIter& pti,
// If no particles, do not do anything
if (np_to_gather == 0) return;
+
+ // initializing the field value to the externally applied field before
+ // gathering fields from the grid to the particles.
+ AssignExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
+ m_xp[thread_num], m_yp[thread_num],
+ m_zp[thread_num]);
+
// Get cell size on gather_lev
const std::array<Real,3>& dx = WarpX::CellSize(std::max(gather_lev,0));