Skip to content

Conversation

@yrrepy
Copy link
Contributor

@yrrepy yrrepy commented Jan 4, 2026

Description

Often it is necessary for various reasons to have fluxes in different energy structures.
It is not always possible to just directly re-score the flux in a Monte Carlo with the desired spectrum.
e.g.: an experiment provides a given or particular evaluated neutron flux with a given energy spectrum, but later on it is desired to use it with a different application, that perhaps has a slightly different energy structure. Etc.

This new method adds the capability to convert an arbitrary 'source' spectrum to an arbitrary 'target' spectrum, it can use user specified spectra and/or existing OpenMC GROUP_STRUCTURES. It uses the standard approach, that is energy group re-binning with flux-per-lethargy conservation.

https://fispact.ukaea.uk/wiki/Keyword:GRPCONVERT
https://fispact.ukaea.uk/wiki/Spectra_conversion
https://scientific-publications.ukaea.uk/wp-content/uploads/api_manual.pdf#subsection.10.1

A number of tests are included, including conversion of FNS flux from CCFE-709 to UKAEA-1102 with flux, flux/d_leth plots with zoom in of the energy ranges with differing structure.

I have furthermore tested down-sampling (fine -> coarse) and other structures.
Below is a plot of FNS CCFE-709 flux as:

  • native CCFE-709
  • CCFE-709 -> UKAEA-1102
  • CCFE-709 -> UKAEA-1102 -> CCFE-709 (roundtrip)
  • CCFE-709 -> XMAS-172
image

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • 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)

yrrepy added 2 commits January 3, 2026 12:37
This adds convert_flux_groups() to convert flux spectra between
different energy group structures. The source and target flux can both either be arbitrary user input energy group structures or existing named GROUP_STRUCTURES in OpenMC.  The spetra conversion is done on an equal flux per unit lethargy basis, similar to FISPACT-II GRPCONVERT, https://fispact.ukaea.uk/wiki/Keyword:GRPCONVERT)
Convert FNX flux from CCFE-709 to UKAEA-1102. Plot compares flux vs. flux. Flux/leth. Zooms in on areas of different energy structure. Mapping to finer bins is evident.
Copy link
Contributor

@GuySten GuySten left a comment

Choose a reason for hiding this comment

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

In general this is a nice feature!
I think you should drop one of files from this PR as it is not a test file.

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like an example and not a test.
You should remove this file from the PR.

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