Skip to content

Commit

Permalink
Check if boundary particles container has been created before clearan…
Browse files Browse the repository at this point in the history
…ce. (AMReX-Codes#2935)

This fixes a segmentation fault when using more GPUs for updating particles
than fluid.
  • Loading branch information
hengjiew authored Sep 6, 2022
1 parent fb0b31e commit 8f8198c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Src/Particle/AMReX_NeighborParticlesI.H
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,10 @@ selectActualNeighbors (CheckPair&& check_pair, int num_cells)
for (int lev = 0; lev < this->numLevels(); ++lev)
{
// clear previous neighbor particle ids
for (auto& keyval: m_boundary_particle_ids[lev]) {
keyval.second.clear();
if (!m_boundary_particle_ids.empty()) {
for (auto& keyval: m_boundary_particle_ids[lev]) {
keyval.second.clear();
}
}

for (MyParIter pti(*this, lev); pti.isValid(); ++pti) {
Expand Down

0 comments on commit 8f8198c

Please sign in to comment.