Skip to content

Fix several issues related to independent operator depletion#3977

Open
paulromano wants to merge 6 commits into
openmc-dev:developfrom
paulromano:microxs-fixes
Open

Fix several issues related to independent operator depletion#3977
paulromano wants to merge 6 commits into
openmc-dev:developfrom
paulromano:microxs-fixes

Conversation

@paulromano

Copy link
Copy Markdown
Contributor

Description

This PR fixes a number of issues related to the use of get_microxs_and_flux and IndependentOperator:

  • Skip missing nuclide/reaction entries in IndependentOperator MicroXS lookups.

    IndependentOperator builds its reaction-rate storage from the depletion chain, but user-provided MicroXS objects may intentionally contain only a subset of those chain nuclides or reactions. Previously, the rate helper indexed directly into MicroXS for every requested chain reaction and raised KeyError when an entry was absent. This now treats missing MicroXS entries as zero reaction rate for that material while preserving the full chain-based reaction-rate indexing.

  • Clarify get_microxs_and_flux documentation for flux-mode energy handling.

    In direct mode (reaction_rate_mode="direct"), the energies argument defines the output energy structure for both fluxes and microscopic cross sections. In flux mode (reaction_rate_mode="flux"), however, energies is used as the multigroup flux tally structure for collapsing continuous-energy microscopic cross sections with MicroXS.from_multigroup_flux; the resulting MicroXS objects remain one-group collapsed cross sections. The docstring now states this distinction explicitly.

  • Return one-group flux arrays in flux mode for get_microxs_and_flux.

    Since flux mode returns one-group collapsed MicroXS objects, returning the original multigroup flux tally created a mismatch between the public fluxes and micros outputs. The multigroup flux is still used internally for the collapse calculation, but the returned flux arrays are summed to one group so they match the returned MicroXS group structure.

  • Default hybrid direct reaction-rate tallies to all selected nuclides when reaction_rate_opts specifies reactions without nuclides.

    In CoupledOperator, the reaction_rate_opts argument treats omitted direct-tally nuclides as "all nuclides" when direct reactions are requested. get_microxs_and_flux now follows the same convention: reaction_rate_opts={'reactions': [...]} creates direct reaction-rate tallies for all selected nuclides rather than creating no direct tally because the nuclide list was empty.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant