diff options
author | 2019-08-22 14:21:49 -0700 | |
---|---|---|
committer | 2019-08-22 14:21:49 -0700 | |
commit | 84a9c25163825d4fba4bf52fe0e05c54705f1901 (patch) | |
tree | 7cee559d622c1356a088bced304a380f3c642a4e /Source/Particles/PhysicalParticleContainer.cpp | |
parent | c46c17634f39db916e7b23d9b5ec842f10ad683d (diff) | |
parent | 25690770d463071483bc78c99f29bbe056ec9355 (diff) | |
download | WarpX-84a9c25163825d4fba4bf52fe0e05c54705f1901.tar.gz WarpX-84a9c25163825d4fba4bf52fe0e05c54705f1901.tar.zst WarpX-84a9c25163825d4fba4bf52fe0e05c54705f1901.zip |
Merge pull request #279 from ECP-WarpX/fix_refine_plasma
Fix refine plasma
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 1d1d6c1b7..5318b0e3a 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -405,14 +405,16 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) // then how many new particles will be injected is not that simple // We have to shift fine_injection_box because overlap_box has been shifted. Box fine_overlap_box = overlap_box & amrex::shift(fine_injection_box,shifted); - max_new_particles += fine_overlap_box.numPts() * num_ppc - * (AMREX_D_TERM(rrfac,*rrfac,*rrfac)-1); - for (int icell = 0, ncells = overlap_box.numPts(); icell < ncells; ++icell) { - IntVect iv = overlap_box.atOffset(icell); - int r = (fine_overlap_box.contains(iv)) ? AMREX_D_TERM(rrfac,*rrfac,*rrfac) : 1; - for (int ipart = 0; ipart < r; ++ipart) { - cellid_v.push_back(icell); - cellid_v.push_back(ipart); + if (fine_overlap_box.ok()) { + max_new_particles += fine_overlap_box.numPts() * num_ppc + * (AMREX_D_TERM(rrfac,*rrfac,*rrfac)-1); + for (int icell = 0, ncells = overlap_box.numPts(); icell < ncells; ++icell) { + IntVect iv = overlap_box.atOffset(icell); + int r = (fine_overlap_box.contains(iv)) ? AMREX_D_TERM(rrfac,*rrfac,*rrfac) : 1; + for (int ipart = 0; ipart < r; ++ipart) { + cellid_v.push_back(icell); + cellid_v.push_back(ipart); + } } } } |