Skip to content

Score photon heating from a heating cross section for virtual materials - #133

Open
shimwell wants to merge 1 commit into
upstream-pr-4131from
photon-kerma-heating
Open

shimwell wants to merge 1 commit into
upstream-pr-4131from
photon-kerma-heating

Conversation

@shimwell

@shimwell shimwell commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Description

Photon heating is scored from the energy balance of each collision and credited to the element that was struck. That makes multiply_density=False plus Tally.apply_virtual_material wrong for the photon part of a dose:

  • where the nuclide is absent (the whole point of a virtual material) its bins score exactly zero, with no warning
  • where it is present the atom density is already in the score, so applying the virtual material counts it twice

This PR scores photon heating in nuclide bins with multiply_density=False as the flux times a per element photon heating cross section, the same way neutron heating uses KERMA coefficients. The silicon dose example in the user guide (and the workshop notebook that currently works around this with NIST mu_en) then works for gammas too.

Depends on openmc-dev#4131, which provides the nuclide to element mapping and the photon cache refresh for absent nuclides. This PR is based on the upstream-pr-4131 branch, a copy of that PR, so only the new commit shows here.

The heating cross section

Computed in C++ when the simulation starts, only for the elements such tallies need, from data already in every photon library, so no library regeneration is needed. It is the expectation of the transport energy balance under the same settings:

  • incoherent: Klein-Nishina times the incoherent scattering function over angle, and the Compton profile of each shell exactly as compton_doppler samples it (shell weight, accessible profile mass, E'/E acceptance), integrated in the same cumulative variable the sampler inverts
  • photoelectric: per subshell
  • pair production: averaged over the reduced energy distribution pair_production samples, with the annihilation photons removed through Q
  • removed in all cases: expected fluorescence from atomic relaxation (recursive over the transition data) and thick-target bremsstrahlung of the electrons and positrons, evaluated from TTB tables built for the pure element
  • secondaries below cutoff count as deposited, as in transport

The density effect in the pure element bremsstrahlung tables is evaluated at a reference 1 g/cm3. Cost is about 0.5 s for W.

Other changes

  • tracklength estimator kept for these tallies; analog is rejected with a clear error
  • Material::collision_stopping_power and init_bremsstrahlung moved into free functions so TTB tables can be built for a single element; Material calls them unchanged
  • pair production screening radii and constant shared between sampling and the heating calculation
  • const overload of Particle::photon_xs (scoring holds a const Particle&)
  • the unused heating dataset (MCNP-style ACE heating numbers) is no longer read
  • docs: methods section on the photon heating cross section, user guide note, multiply_density docstring

Validation

Heating from the cross section (isotope bins, tracklength, apply_virtual_material with the material itself) over energy balance heating in pure element spheres, ENDF/B-VIII.1, 50k particles x 10 batches (statistical uncertainty about 0.05 to 0.1%):

20 keV 100 keV 1.25 MeV 10 MeV
C 0.998 1.002 1.000 0.999
Si 1.000 1.001 1.000 1.001
Fe 1.001 1.000 1.000 1.003
W 1.000 1.002 1.001 1.004
Pb 1.001 1.001 1.001 1.003

The 10 MeV W/Pb residual is the reference density of the density effect: at W's real density it goes from 1.0042 to 0.9986. A 10 g/cm3 reference fixes W/Pb but moves C/Si to -0.25%, so 1 g/cm3 was kept. With relaxation and bremsstrahlung both off (pure Compton kinematics) W 1.25 MeV is 1.0004 +/- 0.0004 and C 20 keV 0.9987 +/- 0.0008.

The uncollided heating over flux agrees with NIST mu_en to about 1% below 1.25 MeV. The larger difference at 10 MeV in high Z (up to 5%) is OpenMC's photon physics versus NIST and is the same for energy balance heating.

Transport results are bit for bit identical to the openmc-dev#4131 branch (10 MeV photons in W, heating/total/pair production tallies, strict FP build).

Found along the way, not changed here

The pair production screening radius table has 99 entries for Z = 1 to 99 but is indexed with r[Z_], so each element uses the value for Z + 1 and Z = 99 reads past the end. The heating calculation shares the table with sampling so the two stay consistent when that is fixed separately.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files
  • I have followed the style guidelines for Python source files
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@shimwell
shimwell changed the base branch from develop to upstream-pr-4131 October 6, 2026 13:27
Photon heating is scored from the energy balance of each collision and
credited to the element that was struck. With multiply_density off it
therefore scored zero where the nuclide is absent, and the density was
already included where it is present, so apply_virtual_material gave wrong
answers for the photon part of a dose.

Nuclide bins of a photon heating tally with multiply_density off are now
scored as the flux times a per-element photon heating cross section, as
neutron heating is with KERMA coefficients. The cross section is computed
when the simulation starts, for the elements such tallies need, as the
expectation of the transport energy balance from the photon interaction
data and settings: Doppler broadened incoherent scattering, photoelectric
absorption and pair production, less fluorescence from atomic relaxation,
annihilation photons and thick-target bremsstrahlung for the pure element.
These tallies keep the tracklength estimator; the analog one is rejected.

The thick-target bremsstrahlung table construction is moved out of
Material into free functions so it can be built for a single element, and
the pair production screening data is shared with the sampling routine.
Transport results are unchanged. The unused heating dataset is no longer
read from photon libraries.

Co-authored-by: jon-proximafusion <174589458+jon-proximafusion@users.noreply.github.com>
@shimwell

Copy link
Copy Markdown
Owner Author

Rebased onto the current head of openmc-dev#4131 (688905706). The upstream-pr-4131 base branch was fast-forwarded to match, so this PR still shows a single commit. The rebase had no conflicts.

Since the first version, develop has gained openmc-dev#4157 (positrons below the cutoff annihilate) and openmc-dev#4158 (atomic relaxation emissions below the photon cutoff are skipped). Both change the collision energy balance that this heating cross section reproduces. So I checked the rebased branch both as it is and merged with current develop (936c884ed). The merge is clean and the build has no warnings.

Tests. test_photon_heating_xs.py and test_energy_cutoff.py pass.

Validation table rerun on the develop merge. Same protocol as the table above: heating from the cross section over energy balance heating, pure element spheres, ENDF/B-VIII.1, 50k particles x 10 batches.

20 keV 100 keV 1.25 MeV 10 MeV
C 1.000 1.000 1.000 0.999
Si 1.001 1.000 1.000 1.001
Fe 1.000 1.001 1.000 1.003
W 1.001 1.002 1.001 1.005
Pb 1.001 0.998 1.002 1.003

This matches the original table to about 0.1%, and the rebased branch without the develop merge gives the same numbers. So openmc-dev#4157 and openmc-dev#4158 don't change the agreement: this PR already assumed that annihilation photons always carry away the rest mass energy, and already left out relaxation emissions below the cutoff.

A stricter check: first collisions only. I also compared only the collisions of uncollided photons, using a narrow energy bin at the source energy and 200k x 10 particles. Every element and energy then sits about 0.1 to 0.2% high. At 10 MeV, Fe and Pb are 0.5% high and W is 0.75% high. With electron_treatment = 'led', Fe and W at 10 MeV drop to 1.0016. So the extra 10 MeV difference comes from the bremsstrahlung yield of the pair production electron and positron. That fits the 1 g/cm3 density effect reference described above.

Still to do: point this at develop once openmc-dev#4131 merges. Separately, the r[Z_] screening radius indexing is shared with PhotonInteraction::pair_production. If that is fixed upstream, both places need the same index.

This branch has not been deployed

No deployments
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.

1 participant