Skip to content

Notes on `move_p`

Robert Bird edited this page Mar 20, 2019 · 2 revisions

Move_p Cell Crossing Analysis

The move_p kernel contains a loop that has multiple termination cases, and runs for an (often) unknown number of iteration per particle. This is the case because it deals with cell crossings, the number which a particle does can not be known apriori.

The maximum number of loop iterations is 5 (so on some platforms it may make sense to let this loop unroll to 8), with the first loop representing the cell the particle is leaving.

The frequency of the crossing is heavily input deck dependent.

For rough calculations, we typically expected that around 5-10% of particles will cross a cell in a timestep (i.e. that is the exception, not the norm.), but it can be much higher for highly structured decks with fast moving particles. Within move_p, each subsequent loop iteration becoming increasingly less likely, as it represents the case where particles cross increasingly more cells.

2D LPI Deck

Below are some sample numbers for a simple 2D lpi deck, with 26,984,448 particles and 52,704 cells (total), running for 20 steps.

  • 1 iterations: 4.9%
  • 2 iterations: 0.1%
  • 3 iterations: <0.1%
  • 4 iterations: 0.0%
  • 5 iterations: 0.0% (very rare, represents shooting a corner in 3D which does not happen in this structured problem)

Harris Deck

Below are some sample numbers for a simple 2D test run (using the deck in ./sample/harris) with 262,144 particles and 4,096 cells (total). Over 484 steps, we see the following percent of loop iterations, relative to the total number of particles:

  • 1 iterations: 25.0% (comparatively high!)
  • 2 iterations: 1.6%
  • 3 iterations: 0.1%
  • 4 iterations: 0.1%
  • 5 iterations: 0.0% (very rare, represents shooting a corner in 3D which does not happen in this structured problem)

outbndj test

The outbndj "integrated test" represents an interesting stress test of this cell crossing, and gives the following (approximate) statistics (131 particles, 10000 iters):

  • 1 iterations: 93.3% (intentionally high!)
  • 2 iterations: 64.4%
  • 3 iterations: 25.3%
  • 4 iterations: 3.3%
  • 5 iterations: 0.1%

The particle cannot interact with more than 5 cells, because the CFL limits the step length to be smaller than the dimension of a single grid cell.


Raw Data:

31705994 total particles hit move_p, of 262,144 for 484 steps.

Clone this wiki locally