Make sure time boundary doesn't prevent secondary particle creation #3043
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.
Description
This PR fixes a bug related to when a time boundary is in use that can result in secondary particles not be simulated. The sequence of events that leads to this is as follows:
Particle::event_advance, a time boundary results in the particle's weight getting set to zero.Particle::event_collideis called. This can result in zero-weight secondaries getting created.Particle::event_revive_from_secondarysets the particle's state to one of the just-created zero-weight secondaries, which then causes the event loop to terminate becauseParticle::alive()is false.The solution is to just add a check after calling
event_advance()that the particle is still alive before processing a surface crossing or collision.Fixes #3039
Checklist
I have followed the style guidelines for Python source files (if applicable)I have made corresponding changes to the documentation (if applicable)