@@ -50,7 +53,18 @@ The final on-grid neighbor list data structure consists of two arrays. First, we
Note that, because of our use of managed memory to store the particle data and the neighbor list, the above code will work when compiled for either CPU or GPU.
The above algorithm deals with constructing a neighbor list for the particles on a single grid. When domain decomposition is used, one must also make copies of particles on adjacent grids, potentially performing the necessary MPI communication for grids associated with other processes. The routines `fillNeighbors`, which computes which particles needed to be ghosted to which grid, and `updateNeighbors`, which copies up-to-date data for particles that have already been ghosted, have also been offloaded to the GPU, using techniques similar to AMReX's `Redistribute` routine. The important thing for users is that calling these functions does not trigger copying data off the GPU.
The above algorithm deals with constructing a neighbor list for the particles on a single grid.
When domain decomposition is used, one must also make copies of particles on adjacent grids,
potentially performing the necessary MPI communication for grids associated with other processes.
The routines `fillNeighbors`, which computes which particles needed to be ghosted to which grid, and `updateNeighbors`,
which copies up-to-date data for particles that have already been ghosted, have also been offloaded to the GPU,
using techniques similar to AMReX's `Redistribute` routine.
Note that when the particles are dense, only a small portion of the ghost particles are neighbors to the particles
inside the grids. AMReX provides a function `selectActualNeighbors` to filter out the ghost particles that will
not be used for building the neighbor list. So the subsequent calls to `updateNeighbors` can avoid transferring
these unused ghost particles, which significantly reduces the communication cost in some tests.
To use this optimization, set `particles.reduceGhostParticles` to :cpp:`true` in MFiX-Exa's inputs.
Once the neighbor list has been constructed, collisions with both particles and walls can easily be processed.