aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-07-31 12:22:20 -0700
committerGravatar MaxThevenet <mthevenet@lbl.gov> 2019-07-31 12:22:20 -0700
commita85bb92ffd79ac3bd04970dd2af94b74fd194985 (patch)
tree1678724eea5dcc0bcc200669afa71c537e18b75c /Source/Particles/PhysicalParticleContainer.cpp
parentfcbe147e185a36fbf1c3be2db440e6a5b51e9dd6 (diff)
downloadWarpX-a85bb92ffd79ac3bd04970dd2af94b74fd194985.tar.gz
WarpX-a85bb92ffd79ac3bd04970dd2af94b74fd194985.tar.zst
WarpX-a85bb92ffd79ac3bd04970dd2af94b74fd194985.zip
comments in PPC
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index b205ba274..61902af5d 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -368,8 +368,13 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
const int grid_id = mfi.index();
const int tile_id = mfi.LocalTileIndex();
+ // Max number of new particles, if particles are created in the whole
+ // overlap_box. All of them are created, and invalid ones are then
+ // discaded
int max_new_particles = overlap_box.numPts() * num_ppc;
+ // If refine injection, build pointer dp_cellid that holds pointer to
+ // array of refined cell IDs.
Vector<int> cellid_v;
if (refine_injection and lev == 0)
{
@@ -391,6 +396,7 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
amrex::AsyncArray<int> cellid_aa(hp_cellid, cellid_v.size());
int const* dp_cellid = cellid_aa.data();
+ // Update NextID to include particles created in this function
int pid;
#pragma omp critical (add_plasma_nextid)
{
@@ -433,6 +439,10 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
std::size_t shared_mem_bytes = plasma_injector->sharedMemoryNeeded();
int lrrfac = rrfac;
+ // Loop over all new particles and inject them (creates too many
+ // particles, in particular does not consider xmin, xmax etc.).
+ // The invalid ones are given negative ID and are deleted during the
+ // next redistribute.
amrex::For(max_new_particles, [=] AMREX_GPU_DEVICE (int ip) noexcept
{
ParticleType& p = pp[ip];