I’ve noticed the following odd behaviour when plotting energy spectra using defined energy grids (or I am fundamentally misunderstanding this filter). I will demonstrate with the pincell example:
tallies = openmc.Tallies()
#create two sets of energy tallies:
#one set with uniform log energy grids with np.logspace and
#the second set with pre-defined grids
#evenly-spaced grids
num_groups = [75, 150, 300, 600, 1200]
for n in num_groups:
groups = np.logspace(-5, log10(20e6), n)
tally = openmc.Tally(name=str(n))
tally.scores = ['flux']
efil_in = openmc.EnergyFilter(groups)
tally.filters = [efil_in]
tallies.append(tally)
#pre-defined grids
scale_energy_grid = [1.000E-5, 1.000E-4, ... 1.733E+7, 2.000E+7 ] #shortened for easier viewing
grids = ['CASMO-70', 'XMAS-172', 'SCALE-238', 'SHEM-361', 'UKAEA-1102']
for grid in grids:
if grid=='SCALE-238':
groups = scale_energy_grid
else:
groups = openmc.mgxs.GROUP_STRUCTURES[grid]
tally = openmc.Tally(name=grid)
tally.scores = ['flux']
efil_in = openmc.EnergyFilter(groups)
tally.filters = [efil_in]
tallies.append(tally)
tallies.export_to_xml()
openmc.run()
When plotting the results of all these EnergyFilter tallies we see fairly smooth results for the set of tallies using np.logspace, but wildly oscillating spectra from the set which used defined group structures:
Again I might be misunderstanding how the filter works, but some clarification would be much appreciated!
Thanks,
Sourena