Make keff search control work with depletion. - #4083
Merged
Conversation
Address review feedback on the depletion/keff-search fix: - Replace the MockOperator class and single-use fixture in the unit test with a single unittest.mock.Mock, whose mock_calls records the global call ordering with arguments. Same coverage in a third of the lines, and asserting identity of the vector handed to the operator is a stronger check than the element-wise array comparison it replaces. - Revert the module docstring churn, drop 15 trailing-whitespace lines and restore the test file's 644 mode. - Trim the explanatory comment in _KeffSearchControl.run(). - Add a behavioral assertion to the regression test: with the bug, the depletion vector is reverted to its beginning-of-step values, so no fission products ever appear. Checking that Xe135 is nonzero at the final step catches this for all three parametrizations without needing reference data. Every fission product is exactly 0.0 at both steps in the current ref_depletion_with_*.h5 files, which were generated before the fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
paulromano
enabled auto-merge (squash)
September 9, 2026 22:38
paulromano
disabled auto-merge
September 9, 2026 22:38
paulromano
enabled auto-merge (squash)
September 9, 2026 22:38
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.
Description
When using keff control in combination with depletion the depletion is not working because the new depleted material is overwritten.
This PR fix that.
Fixes https://openmc.discourse.group/t/the-burnup-material-was-not-updated-during-the-criticality-search-in-the-depletion-calculation/6446
Checklist
I have run clang-format (version 18) on any C++ source files (if applicable)I have made corresponding changes to the documentation (if applicable)