Skip to content

Do not transport source particles below the energy cutoff - #4144

Open
GuySten wants to merge 3 commits into
openmc-dev:developfrom
GuySten:claude/charming-maxwell-0fufj9
Open

GuySten wants to merge 3 commits into
openmc-dev:developfrom
GuySten:claude/charming-maxwell-0fufj9

Conversation

@GuySten

@GuySten GuySten commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Source particles born below the energy cutoff for their type used to be transported until their first collision. Particles created during transport are checked against the cutoff when they are made, and existing particles are checked after each collision, but source particles were never checked. With this change, below-cutoff source particles are handled the same way as particles that fall below the cutoff during transport:

  • Neutrons are killed in initialize_particle_track, with no energy deposited. This matches neutrons killed after a collision. Their weight still counts toward total_weight, so tally normalization is unchanged. They skip weight windows, so they can't be split. In event-based mode, dead source particles are no longer queued for transport (process_init_events).
  • Photons get a collision distance of 0 in event_advance. They collide where they are born, and the existing cutoff check in sample_photon_reaction kills them and deposits their energy locally, which heating and pulse-height tallies score. In a void they are killed without depositing energy. This check applies at every step, so photons made below the cutoff by neutron reactions or atomic relaxation also deposit where they're made instead of travelling to a collision first.
  • Electrons and positrons need no change: in a material they already collide and deposit energy at their birth site.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format on any C++ source files (if applicable). The local clang-format version wasn't checked against the required version 18.
  • 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): test_source_below_energy_cutoff in tests/unit_tests/test_energy_cutoff.py

Note: this code has not been compiled or run locally, because the build environment had no HDF5. CI will be the first check.

Source particles with energy below the cutoff for their particle type
were previously transported until their first collision. They are now
killed at initialization (still counting toward the total source
weight) and are not dispatched in event-based mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TspbrV3dSyNnBADnfLjP1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TspbrV3dSyNnBADnfLjP1
Photons below the energy cutoff now collide immediately at their current
position instead of being killed at source initialization, so the existing
cutoff check in sample_photon_reaction deposits their energy locally, as it
does for photons that fall below the cutoff during transport. In a void they
are killed without deposition. Electrons and positrons already collide at
their birth site, and source neutrons below the cutoff are still killed at
initialization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TspbrV3dSyNnBADnfLjP1
@GuySten
GuySten requested a review from paulromano September 23, 2026 18:26
@GuySten
GuySten marked this pull request as ready for review September 23, 2026 18:26

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.

2 participants