aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-12-19 17:06:54 -0800
committerGravatar MaxThevenet <mthevenet@lbl.gov> 2019-12-19 17:06:54 -0800
commit6c0b080598b8d34abb29f254b5e82d3f7dce38ec (patch)
tree8fa0a4198e0bd11925df22fc88b1bab7712ca5df /Source/Particles/PhysicalParticleContainer.cpp
parent7d1a572483d5f1b314020b5282c92d48afa26f9d (diff)
downloadWarpX-6c0b080598b8d34abb29f254b5e82d3f7dce38ec.tar.gz
WarpX-6c0b080598b8d34abb29f254b5e82d3f7dce38ec.tar.zst
WarpX-6c0b080598b8d34abb29f254b5e82d3f7dce38ec.zip
splitting distance depends on ppc only if uniform per cell
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index d5c08074a..de0f0a813 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -1431,15 +1431,19 @@ PhysicalParticleContainer::SplitParticles(int lev)
{
pti.GetPosition(xp, yp, zp);
- // offset for split particles is computed as a function of cell size
- // and number of particles per cell, so that a uniform distribution
- // before splitting results in a uniform distribution after splitting
const amrex::Vector<int> ppc_nd = plasma_injector->num_particles_per_cell_each_dim;
const std::array<Real,3>& dx = WarpX::CellSize(lev);
amrex::Vector<Real> split_offset = {dx[0]/2._rt/ppc_nd[0],
dx[1]/2._rt/ppc_nd[1],
dx[2]/2._rt/ppc_nd[2]};
-
+ if (ppc_nd[0] > 0){
+ // offset for split particles is computed as a function of cell size
+ // and number of particles per cell, so that a uniform distribution
+ // before splitting results in a uniform distribution after splitting
+ split_offset[0] /= ppc_nd[0];
+ split_offset[1] /= ppc_nd[1];
+ split_offset[2] /= ppc_nd[2];
+ }
// particle Array Of Structs data
auto& particles = pti.GetArrayOfStructs();
// particle Struct Of Arrays data