Skip to content

Make keff search control work with depletion. - #4083

Merged
paulromano merged 5 commits into
openmc-dev:developfrom
GuySten:depletion-keff-search-fix
Sep 9, 2026
Merged

Make keff search control work with depletion.#4083
paulromano merged 5 commits into
openmc-dev:developfrom
GuySten:depletion-keff-search-fix

Conversation

@GuySten

@GuySten GuySten commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

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 performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

GuySten and others added 2 commits August 29, 2026 21:02
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 paulromano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @GuySten!

@paulromano
paulromano enabled auto-merge (squash) September 9, 2026 22:38
@paulromano
paulromano disabled auto-merge September 9, 2026 22:38
@paulromano
paulromano enabled auto-merge (squash) September 9, 2026 22:38
@paulromano
paulromano merged commit e13e940 into openmc-dev:develop Sep 9, 2026
16 checks passed
@GuySten
GuySten deleted the depletion-keff-search-fix branch September 9, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants