Return discrete lines exactly in lin-lin tabular energy sampling - #4069
Open
dallonby wants to merge 1 commit into
Open
Return discrete lines exactly in lin-lin tabular energy sampling#4069dallonby wants to merge 1 commit into
dallonby wants to merge 1 commit into
Conversation
ContinuousTabular, KalbachMann, and CorrelatedAngleEnergy all guard the histogram interpolation branch with k >= n_discrete, returning a sampled discrete line's energy exactly — but none of them guard the lin-lin branch. A discrete hit leaves the walk with r1 < c_k, so the lin-lin inversion runs with a negative (r1 - c_k) and shifts the sampled energy below the line (bounded by the max(0, ...) clamp at E_l_k - p_l_k/frac). In ENDF/B-VIII.0 the discrete-lines-with-lin-lin combination appears in 19,913 incident-energy tables — all secondary-photon distributions (discrete gammas from (n,2n), (n,3n), (n,n') continuum and similar), so coupled neutron-photon transport samples smeared gamma lines. No neutron-product table in the library uses the combination, so neutron-only results are unaffected. The fix mirrors the existing histogram guard in all three samplers; for Kalbach-Mann the r/a parameters use the line's tabulated values, which is what the interpolation reduces to at E_out = E_l_k. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dallonby
added a commit
to dallonby/openmc
that referenced
this pull request
Aug 21, 2026
CHI_DELAYED -> PR openmc-dev#4067; discrete-line lin-lin sampling (with the ENDF/B-VIII.0 photon-table census) -> issue openmc-dev#4068 + PR openmc-dev#4069; MG density_mult tally asymmetry -> issue openmc-dev#4070. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Fixes #4068.
ContinuousTabular,KalbachMann, andCorrelatedAngleEnergyguard their histogram interpolation branch withk >= n_discrete(a sampled discrete line is returned at exactly its tabulated energy), but not the lin-lin branch — a discrete hit leaves the CDF walk withr1 < c_k, so the lin-lin inversion runs with a negative(r1 - c_k)and shifts the sampled energy below the line.This PR mirrors the histogram guard in all three samplers. For Kalbach-Mann, the discrete branch takes
r[k]/a[k]directly — identical to what the parameter interpolation reduces to atE_out = E_l_k, so no behavior change beyond the energy fix.Impact (measured against the official ENDF/B-VIII.0 HDF5 library; details in #4068): the discrete-lines-with-lin-lin combination appears in 19,913 secondary-photon tables (discrete gammas of (n,2n)/(n,3n)/(n,n′)-continuum reactions across ~half the nuclides) and in zero neutron-product tables — so coupled neutron–photon runs currently sample smeared gamma lines, while neutron-only results are unaffected by this change.
Found while porting the transport engine to Apple Silicon GPUs (dallonby/openmc-metal).
Checklist
🤖 Generated with Claude Code