OPAL-Cycl - Particle out of bounds
Close to the septum of the PSI Ring cyclotron we lose a lot of particles and particles might end up out of the field map. Thus, we get magnetic field values of \mathcal{O}(10^{177}) which is not physical. This ends up of producing NAN values of the particle positions what causes problems in case of AMR (adaptive mesh refinement) simulations.
I propose to destroy the particles directly after applying the field line 3494 of ParallelCyclotronTracker::computeExternalFields_m by
if ( outOfBound ) {
itsBunch_m->destroy(1, i, true);
}
With this fix, it works -- that is: a small test worked.
Are there any concerns or better suggestions?
CC: @snuverink_j