Skip to content

Implement DecaySpectrum distribution type and utilize in R2S#3930

Open
paulromano wants to merge 37 commits intoopenmc-dev:developfrom
paulromano:decay-spectrum
Open

Implement DecaySpectrum distribution type and utilize in R2S#3930
paulromano wants to merge 37 commits intoopenmc-dev:developfrom
paulromano:decay-spectrum

Conversation

@paulromano
Copy link
Copy Markdown
Contributor

Description

This branch adds a new openmc.stats.DecaySpectrum distribution for decay photon sources. Instead of expanding each activated material into a fully combined photon energy distribution in Python, DecaySpectrum stores nuclide atom densities and region volume, writes them to XML, and lets the C++ solver resolve the corresponding decay photon spectra from the depletion chain at runtime. This improves R2S photon source generation performance and enables decay photon source particles to carry their parent nuclide, allowing tallies with ParentNuclideFilter to compute photon transport results decomposed by radionuclide.

I've done some tests using this feature on the FNG dose benchmark and confirm that I get results that match our previous mesh-based R2S results. Additionally, I've tested out the new radionuclide breakdown, which matches our previous D1S results very well. Here are the R2S based results for FNG dose showing the dominant radionuclides that contribute to the dose:

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)

Co-authored-by: Copilot <copilot@github.com>
@paulromano paulromano requested a review from pshriwise April 29, 2026 16:49
Copy link
Copy Markdown
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Excited about this @paulromano! Opens some very nice analysis doors for activation problems. Design looks very good overall to me.

Some initial thoughts here. I can take a crack at some of the lower hanging fruit if you're okay with that.

Comment thread src/distribution.cpp
Comment thread src/distribution.cpp Outdated
Comment thread openmc/deplete/r2s.py
domain = cell

activated_mat = step_result.get_material(str(original_mat.id))
nuclides = activated_mat.get_nuclide_atom_densities()
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.

Similar to Material.decay_photon_energy, it seems like it might be useful to provide a Material.decay_spectrum method?

Though now that I write it out those two methods could seem misleadingly similar. Open to discussion here.

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.

Could also be marked for a follow-on PR.

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.

If we do go this route, it might be good to switch Material.decay_photon_energy to generate a DecaySpectrum object and return the result of a call to DecaySpectrum.to_distribution (with the requisite bells and whistles of decay_photon_energy) to consolidate some similar functionality between those two areas of code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Interesting point! I'd say we should leave this for a follow-on PR though

Comment thread tests/unit_tests/test_stats.py
Comment thread src/source.cpp
Comment thread include/openmc/distribution.h Outdated
openmc.stats.Legendre
openmc.stats.Mixture
openmc.stats.Normal
openmc.stats.DecaySpectrum
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.

We'll want to make appropriate changes to the types that appear under the univariate distributions in the XML I/O section as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminder! I ended up changing the XML representation to make it more compact/consistent while I was at it

Copy link
Copy Markdown
Contributor

@pshriwise pshriwise May 5, 2026

Choose a reason for hiding this comment

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

Ah, nice! Yeah I think that's good update.

@paulromano
Copy link
Copy Markdown
Contributor Author

@pshriwise Thanks for the review! All your comments have been addressed

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.

2 participants