Folded multiple temperatures in to each h5 data file; now im getting 50% less storage required of endf70. yay! Next I think I can get rid of some s(a,b) information, will investigate that and then on to revising openMC so it can read and use this data

This commit is contained in:
Adam Nelson 2016-08-21 06:05:19 -04:00
parent fd6b22b454
commit 3b65dde0fd
5 changed files with 657 additions and 222 deletions

View file

@ -124,47 +124,79 @@ for filename in ace_libraries:
continue
lib = openmc.data.ace.Library(filename)
nuclides = {}
for table in lib.tables:
if table.name.endswith('c'):
name, xs = table.name.split('.')
if xs.endswith('c'):
# Continuous-energy neutron data
try:
if name not in nuclides:
neutron = openmc.data.IncidentNeutron.from_ace(
table, args.metastable)
except Exception as e:
print('Failed to convert {}: {}'.format(table.name, e))
continue
table, args.metastable)
# try:
# neutron = openmc.data.IncidentNeutron.from_ace(
# table, args.metastable)
# except Exception as e:
# print('Failed to convert {}: {}'.format(table.name, e))
# continue
# Fission energy release data, if available
if args.fission_energy_release is not None:
fer = openmc.data.FissionEnergyRelease.from_compact_hdf5(
args.fission_energy_release, neutron)
if fer is not None:
neutron.fission_energy = fer
# Fission energy release data, if available
if args.fission_energy_release is not None:
fer = openmc.data.FissionEnergyRelease.from_compact_hdf5(
args.fission_energy_release, neutron)
if fer is not None:
neutron.fission_energy = fer
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
neutron.name))
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
neutron.name))
# Determine filename
outfile = os.path.join(args.destination,
neutron.name.replace('.', '_') + '.h5')
neutron.export_to_hdf5(outfile, 'w')
# Determine filename
outfile = os.path.join(args.destination,
neutron.name.replace('.', '_') + '.h5')
neutron.export_to_hdf5(outfile, 'w')
# Register with library
library.register_file(outfile)
# Register with library
library.register_file(outfile)
elif table.name.endswith('t'):
# Add nuclide to list
nuclides[name] = outfile
else:
# Then we only need to append the data
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
neutron.name))
neutron = \
openmc.data.IncidentNeutron.from_hdf5(nuclides[name])
neutron.add_temperature_from_ace(table, args.metastable)
neutron.export_to_hdf5(outfile + '_1', 'w')
os.rename(outfile + '_1', outfile)
elif xs.endswith('t'):
# Thermal scattering data
thermal = openmc.data.ThermalScattering.from_ace(table)
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
thermal.name))
if name not in nuclides:
thermal = openmc.data.ThermalScattering.from_ace(table)
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
thermal.name))
# Determine filename
outfile = os.path.join(args.destination,
thermal.name.replace('.', '_') + '.h5')
thermal.export_to_hdf5(outfile, 'w')
# Determine filename
outfile = os.path.join(args.destination,
thermal.name.replace('.', '_') + '.h5')
thermal.export_to_hdf5(outfile, 'w')
# Register with library
library.register_file(outfile, 'thermal')
# Register with library
library.register_file(outfile, 'thermal')
# Add data to list
nuclides[name] = outfile
else:
# Then we only need to append the data
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
thermal.name))
# if table.name == 'poly.11t':
# import pdb; pdb.set_trace()
thermal = openmc.data.ThermalScattering.from_hdf5(nuclides[name])
thermal.add_temperature_from_ace(table)
thermal.export_to_hdf5(outfile + '_1', 'w')
os.rename(outfile + '_1', outfile)
# Write cross_sections.xml
libpath = os.path.join(args.destination, 'cross_sections.xml')