openmc.mgxs.convert_flux_groups

openmc.mgxs.convert_flux_groups(flux, source_groups, target_groups)[source]

Convert flux spectrum between energy group structures.

Uses flux-per-unit-lethargy conservation, which assumes constant flux per unit lethargy within each source group and distributes flux to target groups proportionally to their lethargy width.

Added in version 0.15.4.

Parameters:
  • flux (Iterable of float) – Flux values for source groups. Length must equal source_groups.num_groups.

  • source_groups (EnergyGroups or str) – Energy group structure of the input flux with boundaries in [eV]. Can be an EnergyGroups instance or the name of a group structure (e.g., ‘CCFE-709’).

  • target_groups (EnergyGroups or str) – Target energy group structure with boundaries in [eV]. Can be an EnergyGroups instance or the name of a group structure (e.g., ‘UKAEA-1102’).

Returns:

Flux values for target groups. Total flux is conserved for overlapping energy regions.

Return type:

numpy.ndarray

Raises:
  • TypeError – If source_groups or target_groups is not EnergyGroups or str

  • ValueError – If flux length doesn’t match source_groups, or flux contains negative, NaN, or infinite values

See also

EnergyGroups

Energy group structure class

Notes

The assumption of constant flux per unit lethargy within each source group is physically reasonable for most reactor spectra but is not exact. For best accuracy, use source spectra with sufficiently fine energy resolution.

Examples

Convert FNS 709-group flux to UKAEA-1102 structure:

>>> import numpy as np
>>> flux_709 = np.load('tests/fns_flux_709.npy')
>>> flux_1102 = openmc.mgxs.convert_flux_groups(flux_709, 'CCFE-709', 'UKAEA-1102')

Convert using EnergyGroups instances:

>>> source = openmc.mgxs.EnergyGroups([1.0, 10.0, 100.0])
>>> target = openmc.mgxs.EnergyGroups([1.0, 5.0, 10.0, 50.0, 100.0])
>>> flux_target = openmc.mgxs.convert_flux_groups([1e8, 2e8], source, target)

References