Fixed a bug in plotting cross sections with S(a,b) data (#3558)

This commit is contained in:
GuySten 2025-09-03 05:52:27 +02:00 committed by GitHub
parent 00edc77691
commit eaed400987
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -413,7 +413,8 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None,
# Prep S(a,b) data if needed
if sab_name:
sab = openmc.data.ThermalScattering.from_hdf5(sab_name)
sab = openmc.data.ThermalScattering.from_hdf5(
library.get_by_material(sab_name, data_type='thermal')['path'])
# Obtain the nearest temperature
if strT in sab.temperatures:
sabT = strT
@ -640,14 +641,13 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
sab = openmc.data.ThermalScattering.from_hdf5(
library.get_by_material(sab_name, data_type='thermal')['path'])
for nuc in sab.nuclides:
sabs[nuc] = library.get_by_material(sab_name,
data_type='thermal')['path']
sabs[nuc] = sab_name
else:
if sab_name:
sab = openmc.data.ThermalScattering.from_hdf5(sab_name)
sab = openmc.data.ThermalScattering.from_hdf5(
library.get_by_material(sab_name, data_type='thermal')['path'])
for nuc in sab.nuclides:
sabs[nuc] = library.get_by_material(sab_name,
data_type='thermal')['path']
sabs[nuc] = sab_name
# Now we can create the data sets to be plotted
xs = {}
@ -655,8 +655,8 @@ def _calculate_cexs_elem_mat(this, types, temperature=294.,
for nuclide in nuclides.items():
name = nuclide[0]
nuc = nuclide[1]
sab_tab = sabs[name]
temp_E, temp_xs = calculate_cexs(nuc, types, T, sab_tab, cross_sections,
sab_name = sabs[name]
temp_E, temp_xs = calculate_cexs(nuc, types, T, sab_name, cross_sections,
ncrystal_cfg=ncrystal_cfg
)
E.append(temp_E)