Store energy-dependent isomeric production data verbatim in depletion chains - #122
Open
jon-proximafusion wants to merge 4 commits into
Open
Store energy-dependent isomeric production data verbatim in depletion chains#122jon-proximafusion wants to merge 4 commits into
jon-proximafusion wants to merge 4 commits into
Conversation
Adds ProductionTable and IsomericProduction dataclasses to openmc.deplete.nuclide, a Nuclide.isomeric_production mapping keyed by (reaction type, target), XML round-trip via a new <isomeric_production> child element of <reaction>, validation of the stored data, format documentation, and unit tests. Also fixes a latent NameError in Nuclide.validate where the reaction branch ratio message referenced the decay branch ratio sum. See #121.
…edits Chain.reduce deep-copies isomeric production data for retained targets and warns when data is dropped with an excluded target. Chain.set_branch_ratios keeps attached data for targets that survive a rewrite and, controlled by a new preserve_isomeric_data argument, raises or warns when a rewrite would remove a target carrying data. Adds a Chain.get_isomeric_production accessor and tests. See #121.
Adds an openmc.deplete._isomeric module that parses ENDF MF=8/9/10
radioactive production sections from raw section text, keeping the
MF=9 yields and MF=10 partial cross sections verbatim, and maps final
state level numbers to metastable targets by matching excitation
energies against decay data (with positional pairing as fallback and
fold-to-ground for unmappable levels).
Chain.from_endf gains isomeric_branching, branching_files (extra
evaluations consulted where the primary neutron file has no data,
e.g. TENDL), scalar_branching ('none' default keeps historical
behavior; 'thermal' and multigroup flux collapse available),
elis_rtol, and isomer_mapping_log arguments. Metastable targets are
emitted as additional reaction entries and every mapping decision can
be written to a report file.
Tested against verbatim ENDF/B-VIII.1 Am241 and Nb93 section fixtures
and an integration test on real decay plus neutron files reproducing
the Am241 thermal capture split of 0.90 to ground and 0.10 to
Am242_m1 from level LFS=2. See #121.
Fixes from an adversarial review of the branch: - Multigroup scalar collapse now clamps group midpoints into the MF=9 grid instead of silently zeroing groups outside it, which discarded the entire thermal group for group structures starting at 0 eV. - The positional level-to-isomer fallback now pairs whole levels, not individual records, so an MF=9 and MF=10 record of one state can no longer be split across two different metastable targets. - Production data attached to a (type, target) pair appearing on more than one reaction element no longer multiplies on XML round trip. - from_endf validates the scalar_branching tuple shape and flux sum, validates elis_rtol, and raises when branching_files, scalar_branching, or isomer_mapping_log are passed without isomeric_branching=True. Reactions with MF=9/10 data on more than one MT use the first (summary) MT and note the skipped ones in the mapping report. - Deduplicated the ground-target inference in set_branch_ratios, added ProductionTable and IsomericProduction to the Python API docs, fixed source label examples to match evaluation headers, corrected type annotations, and added tests for all of the above plus the mapping report writer, the replace_missing folding path, and the validate message fix. See #121.
This was referenced Jul 6, 2026
Open
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.
Implements the chain-file side of #121: depletion chain files can now carry the evaluations' energy-dependent isomeric production data verbatim, so no side files are needed to know how a transmutation reaction splits between ground and metastable states.
What is stored
For each reaction target, an optional
<isomeric_production>child element of<reaction>holding the ENDF MF=9 yield functions and MF=10 partial cross sections exactly as evaluated (original grids, values, and multi-region interpolation), together with the final-state level number, excitation energy, QM/QI, and the source library recorded in the evaluation header. No renormalization, thinning, or ratio pre-computation is performed; consumers fold the data with whatever spectrum they have. Old readers parse only the<reaction>attributes and ignore the child elements, and scalar branching ratios are unchanged by default (ground 1.0, metastables 0.0), so existing workflows includingadd_branching_ratiosbehave exactly as before.Changes
openmc/deplete/nuclide.py:ProductionTableandIsomericProductiondataclasses, aNuclide.isomeric_productionmapping keyed by (reaction type, target), XML round trip, and validation of the stored data (physical ranges, orphan entries, pointwise MF=9 sum checks). Also fixes a latentNameErrorinNuclide.validatefor nuclides with no decay modes and inconsistent reaction sums.openmc/deplete/_isomeric.py(new): MF=8/9/10 parsing from raw section text using the endf-python record readers, level-to-isomer assignment by excitation-energy matching against decay data (with positional pairing as fallback and fold-to-ground for unmappable levels, never naming targets from the LFS level index), scalar ratio collapse modes, and a mapping report.openmc/deplete/chain.py:Chain.from_endfgainsisomeric_branching,branching_files(extra ENDF evaluations consulted where the primary neutron file has no MF=8/9/10 data, e.g. TENDL),scalar_branching,elis_rtol, andisomer_mapping_logarguments;reducecarries the data for retained targets;set_branch_ratiospreserves attached data through scalar rewrites (with apreserve_isomeric_datasafeguard); newget_isomeric_productionaccessor.Verification