Respond to comments on #692 and make a few little fixes

This commit is contained in:
Paul Romano 2016-08-08 06:49:24 -05:00
parent a15e493dab
commit d8b9d78a23
5 changed files with 17 additions and 6 deletions

View file

@ -282,7 +282,7 @@ class Library(object):
lines = [ace_file.readline() for i in range(13)]
while len(lines) != 0 and lines[0] != '':
while len(lines) != 0 and lines[0].strip() != '':
# Read name of table, atomic mass ratio, and temperature. If first
# line is empty, we are at end of file

View file

@ -97,7 +97,7 @@ class Tabulated1D(object):
if self.interpolation[k] == 1:
# Histogram
y[contined] = yi
y[contained] = yi
elif self.interpolation[k] == 2:
# Linear-linear

View file

@ -178,7 +178,7 @@ class IncidentNeutron(object):
@temperature.setter
def temperature(self, temperature):
cv.check_type('temperature', temperature, Real)
cv.check_greater_than('temperature', temperature, 0.0)
cv.check_greater_than('temperature', temperature, 0.0, True)
self._temperature = temperature
@energy.setter
@ -448,6 +448,10 @@ class IncidentNeutron(object):
# Create summed reaction with appropriate cross section
rx = Reaction(mt)
mts = data.get_reaction_components(mt)
if len(mts) == 0:
warn('Photon production is present for MT={} but no '
'reaction components exist.'.format(mt))
continue
rx.xs = Sum([data.reactions[mt_i].xs for mt_i in mts])
# Determine summed cross section

View file

@ -16,6 +16,7 @@ from openmc.stats import Discrete, Tabular
_THERMAL_NAMES = {'al': 'c_Al27', 'al27': 'c_Al27',
'be': 'c_Be',
'beo': 'c_BeO',
'bebeo': 'c_Be_in_BeO', 'be-o': 'c_Be_in_BeO', 'be/o': 'c_Be_in_BeO',
'benz': 'c_Benzine',
'cah': 'c_Ca_in_CaH2',

View file

@ -64,7 +64,9 @@ if args.xml is not None:
directory = os.path.dirname(args.xml)
for ace_table in root.findall('ace_table'):
ace_libraries.append(os.path.join(directory, ace_table.attrib['path']))
path = os.path.join(directory, ace_table.attrib['path'])
if path not in ace_libraries:
ace_libraries.append(path)
elif args.xsdir is not None:
# Find 'directory' section
@ -116,8 +118,12 @@ for filename in ace_libraries:
for table in lib.tables:
if table.name.endswith('c'):
# Continuous-energy neutron data
neutron = openmc.data.IncidentNeutron.from_ace(
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
print('Converting {} (ACE) to {} (HDF5)'.format(table.name, neutron.name))
# Determine filename