Skip to content

Add energy_deposition tally and update neutron functions accordingly#383

Merged
ilhamv merged 34 commits intoCEMeNT-PSAAP:devfrom
melekderman:feature/edep-tally
Apr 5, 2026
Merged

Add energy_deposition tally and update neutron functions accordingly#383
ilhamv merged 34 commits intoCEMeNT-PSAAP:devfrom
melekderman:feature/edep-tally

Conversation

@melekderman
Copy link
Copy Markdown
Member

This pull request introduces support for tallying energy deposition ("edep") in mesh tallies. It adds the new "edep" score type, implements the logic for calculating energy deposition during neutron collisions, and ensures that energy deposition is only tallied in valid scenarios. The changes also include the necessary infrastructure to score and accumulate energy deposition results in mesh tallies.

Support for energy deposition ("edep") tallying:

  • Added new score type SCORE_EDEP for energy deposition to constant.py, and integrated it into the tally score system in tally.py and related modules. [1] [2] [3] [4] [5]
  • Restricted the use of the "edep" score to mesh tallies only and disallowed its combination with the "energy" multiplier.

Implementation of energy deposition calculation:

  • Refactored the neutron collision process to compute and return the energy deposited (edep_weighted) during each collision, including contributions from implicit capture, elastic/inelastic scattering, and fission. Updated the respective scattering and fission routines to return the appropriate weighted energy output for tallying. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Scoring and tallying infrastructure:

  • Implemented the mesh_tally_edep function in score.py to accumulate energy deposition scores in mesh tallies, including phase-space and mesh bin checks.
  • Updated the simulation loop to call mesh_tally_edep after each collision when appropriate.

@melekderman melekderman requested a review from ilhamv February 28, 2026 08:20
@melekderman melekderman added this to the v0.13.0 milestone Feb 28, 2026
@melekderman melekderman added the enhancement New feature or request label Feb 28, 2026
@ilhamv
Copy link
Copy Markdown
Member

ilhamv commented Mar 4, 2026

As discussed, the plan is to wait for the merge of #385, which reorganizes tally types by the estimator (tracklength, surface-crossing, and collision). The edep in this PR uses the collision estimator.

@melekderman melekderman self-assigned this Mar 14, 2026
@melekderman
Copy link
Copy Markdown
Member Author

I have completed the necessary changes and included unit and regression tests. I believe it is now ready for review, @ilhamv. FYI

Copy link
Copy Markdown
Member

@ilhamv ilhamv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Melek. I made commits to the PR:

  1. Replacing "edep" with "energy_deposition" to be more explicit
  2. Include the cell filter support. This should work, but needs testing, though.
  3. Introduce collision_data to record key quantities from collision (like energy deposition).
  4. Redesign the surface/collision/tracklength tally.
  5. Shorten the duration of edep regression test.

@ilhamv ilhamv self-requested a review March 15, 2026 04:38
@ilhamv
Copy link
Copy Markdown
Member

ilhamv commented Mar 15, 2026

@melekderman - One other change that I think is needed:

Rather than making all reactions return the total outgoing energy of the secondary neutrons, let's just feed the collision_data_container as a function argument and update the "energy_deposition" quantity accordingly.
By doing so, we anticipate future quantities of interest that we may want to record during the reaction.

After that, this PR is ready to merge!

@melekderman
Copy link
Copy Markdown
Member Author

Thank you for your review, Ilham! And thanks for collision data container idea because it was an open question for me regarding electron reactions as well. I will change the way recording energy deposition and let you know.

@melekderman
Copy link
Copy Markdown
Member Author

@ilhamv - I refactored the native.py so reactions update collision_data_container directly instead of returning the outgoing energy. This keeps energy_deposition handling at the reaction level and leaves room for future collision QoIs.

@ilhamv
Copy link
Copy Markdown
Member

ilhamv commented Mar 18, 2026

Thanks, @melekderman!
I made minor edits to simplify the logic.
There is one last thing to do. In fission, we should include the large positive Q-value in the energy deposition. Note that this requires adding Q-value into MC/DC nuclear data for each MT (need to update tools/data_library_generator).

@melekderman melekderman changed the title Add edep tally and update neutron functions Add energy_deposition tally and update neutron functions accordingly Mar 18, 2026
@ilhamv
Copy link
Copy Markdown
Member

ilhamv commented Apr 4, 2026

@melekderman - I made some more changes:

  1. Including the Q-value in inelastic scattering energy deposition as well.
  2. I really like your implicit XS-average capture energy deposition! That super makes sense since in neutron transport we don't care about the different capture reactions, as the outcomes are the same, the termination of the incident neutron. However, to anticipate the multi-particle, where we do need to know what actual capture reaction is occuring, I replace the implicit energy deposition with analog sampling, that is, we first sample the actual capture reaction from the group.
  3. Given the growing complexity of the capture reaction, a dedicated capturefunction is created.
  4. And some minor comment edits.

This should complete the first principle, the Q-value-based energy deposition approach that is compatible with the envisioned multi-particle transport. The planned improvement (new Issues for future PRs) includes the incorporation of the energy-dependent fission Q-value or the derived heating coefficients, "kappa" and/or "kerma".

Let me know what you think. This PR is almost done!
Thanks!

@ilhamv ilhamv merged commit 4cd1973 into CEMeNT-PSAAP:dev Apr 5, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants