Add test for flux bias with weight windows in multigroup mode #3202
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
@jtramm and I were applying some weight windows in multigroup mode yesterday and while variance was being reduced as expected, there was a bias being introduced when weight windows were applied.
It turned out this is caused by the
apply_weight_windows
function call occurring beforesample_reaction
in thecollision_mg
method (here). Once this was changed, the bias disappeared and the weight windows worked as expected.When particles are split before the reaction is sampled not all of the weight is applied to the sampled reaction. In the case of an absorption, for example, some of the particle's original weight will go into split particles that are revived later before the reaction occurs and the particle weight is set to zero, removing that weight from the problem. The split particles in the secondary bank will then contribute to the flux upon revival with weight that should have been removed due to the absorption reaction. When this happens enough, the effect is a bias as though absorption reactions aren't occurring as often as they should.
I've added a test here that checks bias in a simple problem with generated weight windows. Without the fix in
physics_mg.cpp
here, the test fails due to a small bias in the total flux (evidence of failure here). This bias becomes more pronounced as more particles are run -- the test runs enough to make it measureable.Thanks @jtramm for discovering this!
Checklist