Preserve collision count when splitting particles#3958
Open
EdenRochmanSharabi wants to merge 3 commits into
Open
Preserve collision count when splitting particles#3958EdenRochmanSharabi wants to merge 3 commits into
EdenRochmanSharabi wants to merge 3 commits into
Conversation
When weight windows split a particle, the child particles now inherit the parent's collision count. Previously, children were created with n_collision=0 via from_source(), which caused CollisionFilter to incorrectly classify scattered children as uncollided, producing biased tallies. Closes openmc-dev#3916
The ctypes _SourceSite struct must match the C++ SourceSite layout. The missing field caused test_source_bank to abort.
The MPI datatype must include all fields in the struct so that collision count is transferred correctly between MPI ranks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Particle::split(), theSourceSitebank now copies the parent'sn_collisionvalueParticle::from_source()restoresn_collisionfrom the source site instead of resetting to zeroCollisionFilterproducing biased (inflated) tallies when weight windows are active, because split children were incorrectly tagged as uncollidedChanges
include/openmc/particle_data.h: Addedint n_collision {0}field toSourceSitestructsrc/particle.cpp: Copyn_collision()insplit(), restore fromsrc->n_collisioninfrom_source()tests/unit_tests/test_collision_filter_ww.py: Regression test comparing uncollided flux fraction between analog and weight-windowed runsTest plan
Closes #3916