mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Pre-PR cleanup and addition of ability to read MT in types
This commit is contained in:
parent
240028d13d
commit
2a50aff588
3 changed files with 13 additions and 37 deletions
|
|
@ -400,20 +400,6 @@ class Element(object):
|
|||
if cross_sections is not None:
|
||||
cv.check_type('cross_sections', cross_sections, str)
|
||||
cv.check_iterable_type('types', types, str)
|
||||
|
||||
# Parse the types
|
||||
mts = []
|
||||
ops = []
|
||||
yields = []
|
||||
for line in types:
|
||||
if line in PLOT_TYPES:
|
||||
mts.append(PLOT_TYPES_MT[line])
|
||||
yields.append(PLOT_TYPES_YIELD[line])
|
||||
ops.append(PLOT_TYPES_OP[line])
|
||||
else:
|
||||
# Not a built-in type, we have to parse it ourselves
|
||||
raise NotImplementedError()
|
||||
|
||||
cv.check_type('temperature', temperature, Real)
|
||||
|
||||
# If cross_sections is None, get the cross sections from the
|
||||
|
|
@ -462,8 +448,8 @@ class Element(object):
|
|||
unionE = np.union1d(unionE, E[n])
|
||||
|
||||
# Now we can combine all the nuclidic data
|
||||
data = np.zeros((len(mts), len(unionE)))
|
||||
for l in range(len(mts)):
|
||||
data = np.zeros((len(types), len(unionE)))
|
||||
for l in range(len(types)):
|
||||
if types[l] == 'unity':
|
||||
data[l, :] = 1.
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -834,21 +834,6 @@ class Material(object):
|
|||
# Check types
|
||||
if cross_sections is not None:
|
||||
cv.check_type('cross_sections', cross_sections, str)
|
||||
cv.check_iterable_type('types', types, str)
|
||||
|
||||
# Parse the types
|
||||
mts = []
|
||||
ops = []
|
||||
yields = []
|
||||
for line in types:
|
||||
if line in PLOT_TYPES:
|
||||
mts.append(PLOT_TYPES_MT[line])
|
||||
yields.append(PLOT_TYPES_YIELD[line])
|
||||
ops.append(PLOT_TYPES_OP[line])
|
||||
else:
|
||||
# Not a built-in type, we have to parse it ourselves
|
||||
raise NotImplementedError()
|
||||
|
||||
if self.temperature is not None:
|
||||
T = self.temperature
|
||||
else:
|
||||
|
|
@ -901,8 +886,8 @@ class Material(object):
|
|||
unionE = np.union1d(unionE, E[n])
|
||||
|
||||
# Now we can combine all the nuclidic data
|
||||
data = np.zeros((len(mts), len(unionE)))
|
||||
for l in range(len(mts)):
|
||||
data = np.zeros((len(types), len(unionE)))
|
||||
for l in range(len(types)):
|
||||
if types[l] == 'unity':
|
||||
data[l, :] = 1.
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -200,8 +200,10 @@ class Nuclide(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
types : Iterable of values of PLOT_TYPES
|
||||
The type of cross sections to calculate
|
||||
types : Iterable of str or Integral
|
||||
The type of cross sections to calculate; values can either be those
|
||||
in openmc.PLOT_TYPES or integers which correspond to reaction
|
||||
channel (MT) numbers.
|
||||
temperature : float, optional
|
||||
Temperature in Kelvin to plot. If not specified, a default
|
||||
temperature of 294K will be plotted. Note that the nearest
|
||||
|
|
@ -224,7 +226,6 @@ class Nuclide(object):
|
|||
# Check types
|
||||
if cross_sections is not None:
|
||||
cv.check_type('cross_sections', cross_sections, str)
|
||||
cv.check_iterable_type('types', types, str)
|
||||
if sab_name:
|
||||
cv.check_type('sab_name', sab_name, str)
|
||||
|
||||
|
|
@ -239,7 +240,11 @@ class Nuclide(object):
|
|||
ops.append(PLOT_TYPES_OP[line])
|
||||
else:
|
||||
# Not a built-in type, we have to parse it ourselves
|
||||
raise NotImplementedError()
|
||||
cv.check_type('MT in types', line, Integral)
|
||||
cv.check_greater_than('MT in types', line, 0)
|
||||
mts.append((line,))
|
||||
yields.append((False,))
|
||||
ops.append(())
|
||||
|
||||
# If cross_sections is None, get the cross sections from the
|
||||
# OPENMC_CROSS_SECTIONS environment variable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue