last rank needs to resize to remove slipped beam particles from previous time step #426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves #424.
In the last time step, the slipped beam particles need to be removed, because they don't belong to the current time step anymore.
Assuming we have 2 boxes (= 2 ranks) with 10 particles per box. In the last time step, 2 particles slip from the first to the second box. if that happened in a previous time step, the original 10 particles would be send to the next rank and then sorted there. In the last time step, the particles are not send. Now, when calculating the second box, the rank has its original 10 particles in that box + the two slipped particles, which are already one time step ahead. Despite being wrong, the simulation crashed in IO, because now the number of particles exceeded the total number of particles of the beam.
This PR fixes this problem: in Notify, the particles which should have been sent to the next rank are removed by resizing (in the same way they would have been removed, if they had been sent).
This problem was tested with the following input script:
Running on 6 CPUs, it fails on
development
and gives the correct results with this PR.const
isconst
)