Adding multigroup photon transport capability in MC mode - #4141
Draft
Grego01-biot wants to merge 10 commits into
Draft
Grego01-biot wants to merge 10 commits into
Grego01-biot wants to merge 10 commits into
Conversation
Grego01-biot
force-pushed
the
photon-mg-mc
branch
from
September 23, 2026 20:22
bae6ac8 to
cec81d3
Compare
This branch has not been deployed
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
This PR enables multigroup photon transport in the Monte Carlo solver. It builds on #4073, which generates photon MGXS libraries on the Python side (
PhotonTransferMatrixXS,Library(particle_type='photon')) and writes aparticle_typeattribute to the library file. Until now the C++ side never read that attribute, and multigroup mode rejected photon transport outright.This is the first of two PRs toward a multigroup photon random ray workflow; a follow-up will add random ray support on top of this one.
Changes
settings.cpp: lift the check that rejected photon transport in multigroup mode.material.cpp: guard the continuous-energy photon data setup withsettings::run_CE, so multigroup runs no longer look up photon element data incross_sections.xml.mgxs_interface.{h,cpp}: read the library'sparticle_typeinread_header(), store it, and use it when setting up the multigroup globals input_mgxs_header_data_to_globals(). For photon libraries the default inverse velocity is now 1/c in every group. It used to be computed from the neutron mass, so photons moved at neutron speeds, corrupting particle time, time filters and cutoffs, and theinverse-velocityscore.source.cpp: in multigroup mode, before converting source energies to groups, check that the source particle type matches the library and that the energy lies within the library's group bounds, and error out otherwise. Without the type check, a neutron source with a photon library runs silently on photon cross sections.tally.cpp: reject pulse-height tallies in multigroup mode, since they rely on continuous-energy photon physics.Testing
The new
tests/regression_tests/mg_photontest runs a 3-group photon library (P1 scattering, row-constant multiplicity matrix) in a reflective 10 cm cube, i.e. an infinite medium with an exact solution. This test asserts that the group fluxes match the exact solution within 5σ and that photons travel at c (via theinverse-velocityscore). Four parametrized cases cover the new input checks: source energy above and below the library bounds, particle-type mismatch, and a pulse-height tally. It passes locally with history-based and event-based transport.Out of scope
Coupled neutron-photon multigroup transport: a library describes a single particle type, and the source has to match it. Documentation will come with the random ray PR.
Checklist