You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The total weight per batch was accidentally being reset after each generation; the correct behavior is to sum between generations rather than assign from the previous generation's total weight. Now it is reset to zero only after each batch.
The bug is easy to show. Turn up the generations per batch on any eigenvalue problem.
Nice -- thanks for finding this and putting in the fix! Just do double check, as we are now doing += instead of =, do we need to zero these values at the start of each batch (or was this already being done?)
Yes, total_weight gets zeroed out at the start of initialize_batch, which is precisely the desired behavior. The total weight should increase over the generations and reflect the total in the batch.
On the other hand, the other variables indeed are zeroed out in finalize_generation. So we maybe don't need to use an increment here. Might make more sense to remove the unnecessary zeroing in the other code and use assignment instead here; and this is something to also change up in the main OpenMC repo, too.
It would be so nice to have all these global parameters grouped into a struct to better keep track of them. It seems that total_weight is only used for eigenvalue estimation, and not in tallies themselves (they have their own total weight counter).
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
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.
The total weight per batch was accidentally being reset after each generation; the correct behavior is to sum between generations rather than assign from the previous generation's total weight. Now it is reset to zero only after each batch.
The bug is easy to show. Turn up the generations per batch on any eigenvalue problem.