Skip to content

Implement tally filter for filtering by reaction#3809

Merged
paulromano merged 15 commits into
openmc-dev:developfrom
paulromano:reaction-filter
Feb 21, 2026
Merged

Implement tally filter for filtering by reaction#3809
paulromano merged 15 commits into
openmc-dev:developfrom
paulromano:reaction-filter

Conversation

@paulromano

Copy link
Copy Markdown
Contributor

Description

This PR introduces a new tally filter that allows scores to be filtered based on the reaction type. This is useful for specialized scores that don't directly represent a reaction rate, e.g., if you are tallying heating or secondary particle production.

Closes #3230

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) 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

GuySten commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

How does this filter handle endf sum rules?
For example, is using "(n,nonelastic)" legal?

@paulromano

Copy link
Copy Markdown
Contributor Author

@GuySten Great point, right now it won't work for summation reactions but I think that shouldn't be too hard to implement -- let me see what I can do.

@paulromano

Copy link
Copy Markdown
Contributor Author

@GuySten I just implemented the capability to handle summation reactions like (n,nonelastic)

@GuySten

GuySten commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

For neutrons, 'total' means mt=1 while for photons 'total' means mt=501.
I lean towards adding an incident particle field to this filter to prevent ambiguity.

I think that it is a bit unexpected that when tallying photon flux total will be empty.
What do you think?

@paulromano

Copy link
Copy Markdown
Contributor Author

@GuySten I've just made some updates to deal with the photon total reaction (MT=501). Rather than having a separate filter by particle, now the behavior is that if the user passes "total" for a ReactionFilter, they get a warning saying that it is redundant and defaults to MT=1 but that that they should use (n,total) or photon-total to be explicit.

@GuySten GuySten 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.

Looks good to me!

@GuySten GuySten added the Merging Soon PR will be merged in < 24 hrs if no further comments are made. label Feb 20, 2026
@paulromano
paulromano merged commit 139907c into openmc-dev:develop Feb 21, 2026
16 checks passed
@paulromano
paulromano deleted the reaction-filter branch February 21, 2026 16:17
jon-proximafusion pushed a commit to shimwell/openmc that referenced this pull request Apr 13, 2026
apingegno pushed a commit to apingegno/openmc that referenced this pull request May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merging Soon PR will be merged in < 24 hrs if no further comments are made.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to tally information on recoiling nuclei

2 participants