From 6c0b080598b8d34abb29f254b5e82d3f7dce38ec Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Thu, 19 Dec 2019 17:06:54 -0800 Subject: splitting distance depends on ppc only if uniform per cell --- Source/Particles/PhysicalParticleContainer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Source/Particles/PhysicalParticleContainer.cpp') 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 ppc_nd = plasma_injector->num_particles_per_cell_each_dim; const std::array& dx = WarpX::CellSize(lev); amrex::Vector 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 -- cgit v1.2.3 From fabbe4dde65a48fc583f0ab407b7ee4ad77cecac Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Thu, 19 Dec 2019 17:26:47 -0800 Subject: oops --- Source/Particles/PhysicalParticleContainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Particles/PhysicalParticleContainer.cpp') diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index de0f0a813..94d9bc363 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1433,9 +1433,9 @@ PhysicalParticleContainer::SplitParticles(int lev) const amrex::Vector ppc_nd = plasma_injector->num_particles_per_cell_each_dim; const std::array& dx = WarpX::CellSize(lev); - amrex::Vector split_offset = {dx[0]/2._rt/ppc_nd[0], - dx[1]/2._rt/ppc_nd[1], - dx[2]/2._rt/ppc_nd[2]}; + amrex::Vector split_offset = {dx[0]/2._rt, + dx[1]/2._rt, + dx[2]/2._rt}; 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 -- cgit v1.2.3