mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Got all the tests passing!
This commit is contained in:
parent
6ff1d758c3
commit
766c93e4f7
13 changed files with 65 additions and 96 deletions
|
|
@ -32,8 +32,6 @@ class Macroscopic(object):
|
|||
if isinstance(other, Macroscopic):
|
||||
if self.name != other.name:
|
||||
return False
|
||||
elif self.xs != other.xs:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
elif isinstance(other, basestring) and other == self.name:
|
||||
|
|
@ -45,7 +43,7 @@ class Macroscopic(object):
|
|||
return not self == other
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self._name, self._xs))
|
||||
return hash((self._name))
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Nuclide - {0}\n'.format(self._name)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class Material(object):
|
|||
# A list of tuples (element, percent, percent type)
|
||||
self._elements = []
|
||||
|
||||
# If specified, a list of tuples of (table name, xs identifier)
|
||||
# If specified, a list of table names
|
||||
self._sab = []
|
||||
|
||||
# If true, the material will be initialized as distributed
|
||||
|
|
@ -129,7 +129,8 @@ class Material(object):
|
|||
string = 'Material\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._temperature)
|
||||
string += '{0: <16}{1}{2}\n'.format('\Temperature', '=\t',
|
||||
self._temperature)
|
||||
|
||||
string += '{0: <16}{1}{2}'.format('\tDensity', '=\t', self._density)
|
||||
string += ' [{0}]\n'.format(self._density_units)
|
||||
|
|
@ -137,8 +138,7 @@ class Material(object):
|
|||
string += '{0: <16}\n'.format('\tS(a,b) Tables')
|
||||
|
||||
for sab in self._sab:
|
||||
string += '{0: <16}{1}[{2}{3}]\n'.format('\tS(a,b)', '=\t',
|
||||
sab[0], sab[1])
|
||||
string += '{0: <16}{1}{2}\n'.format('\tS(a,b)', '=\t', sab)
|
||||
|
||||
string += '{0: <16}\n'.format('\tNuclides')
|
||||
|
||||
|
|
@ -507,7 +507,7 @@ class Material(object):
|
|||
'Table "{}" is being renamed as "{}".'.format(name, new_name)
|
||||
warnings.warn(msg)
|
||||
|
||||
self._sab.append((new_name))
|
||||
self._sab.append(new_name)
|
||||
|
||||
|
||||
def make_isotropic_in_lab(self):
|
||||
|
|
@ -580,9 +580,6 @@ class Material(object):
|
|||
xml_element = ET.Element("macroscopic")
|
||||
xml_element.set("name", macroscopic.name)
|
||||
|
||||
if macroscopic.xs is not None:
|
||||
xml_element.set("xs", macroscopic.xs)
|
||||
|
||||
return xml_element
|
||||
|
||||
def _get_element_xml(self, element, distrib=False):
|
||||
|
|
|
|||
|
|
@ -822,8 +822,8 @@ class Library(object):
|
|||
return pickle.load(open(full_filename, 'rb'))
|
||||
|
||||
def get_xsdata(self, domain, xsdata_name, nuclide='total', xs_type='macro',
|
||||
xs_id='1m', order=None, tabular_legendre=None,
|
||||
tabular_points=33, subdomain=None):
|
||||
order=None, tabular_legendre=None, tabular_points=33,
|
||||
subdomain=None):
|
||||
"""Generates an openmc.XSdata object describing a multi-group cross section
|
||||
data set for eventual combination in to an openmc.MGXSLibrary object
|
||||
(i.e., the library).
|
||||
|
|
@ -841,8 +841,6 @@ class Library(object):
|
|||
Provide the macro or micro cross section in units of cm^-1 or
|
||||
barns. Defaults to 'macro'. If the Library object is not tallied by
|
||||
nuclide this will be set to 'macro' regardless.
|
||||
xs_ids : str
|
||||
Cross section set identifier. Defaults to '1m'.
|
||||
order : int
|
||||
Scattering order for this data entry. Default is None,
|
||||
which will set the XSdata object to use the order of the
|
||||
|
|
@ -888,7 +886,6 @@ class Library(object):
|
|||
cv.check_type('xsdata_name', xsdata_name, basestring)
|
||||
cv.check_type('nuclide', nuclide, basestring)
|
||||
cv.check_value('xs_type', xs_type, ['macro', 'micro'])
|
||||
cv.check_type('xs_id', xs_id, basestring)
|
||||
cv.check_type('order', order, (type(None), Integral))
|
||||
if order is not None:
|
||||
cv.check_greater_than('order', order, 0, equality=True)
|
||||
|
|
@ -915,7 +912,6 @@ class Library(object):
|
|||
name = xsdata_name
|
||||
if nuclide is not 'total':
|
||||
name += '_' + nuclide
|
||||
name += '.' + xs_id
|
||||
xsdata = openmc.XSdata(name, self.energy_groups)
|
||||
|
||||
if order is None:
|
||||
|
|
@ -1022,8 +1018,7 @@ class Library(object):
|
|||
return xsdata
|
||||
|
||||
def create_mg_library(self, xs_type='macro', xsdata_names=None,
|
||||
xs_ids=None, tabular_legendre=None,
|
||||
tabular_points=33):
|
||||
tabular_legendre=None, tabular_points=33):
|
||||
"""Creates an openmc.MGXSLibrary object to contain the MGXS data for the
|
||||
Multi-Group mode of OpenMC.
|
||||
|
||||
|
|
@ -1036,10 +1031,6 @@ class Library(object):
|
|||
xsdata_names : Iterable of str
|
||||
List of names to apply to the "xsdata" entries in the
|
||||
resultant mgxs data file. Defaults to 'set1', 'set2', ...
|
||||
xs_ids : str or Iterable of str
|
||||
Cross section set identifier (i.e., '71c') for all
|
||||
data sets (if only str) or for each individual one
|
||||
(if iterable of str). Defaults to '1m'.
|
||||
tabular_legendre : None or bool
|
||||
Flag to denote whether or not the Legendre expansion of the
|
||||
scattering angular distribution is to be converted to a tabular
|
||||
|
|
@ -1087,26 +1078,6 @@ class Library(object):
|
|||
# Initialize file
|
||||
mgxs_file = openmc.MGXSLibrary(self.energy_groups)
|
||||
|
||||
# Get the number of domains to size arrays with
|
||||
if self.domain_type is 'mesh':
|
||||
num_domains = np.sum(d.num_mesh_cells for d in self.domains)
|
||||
else:
|
||||
num_domains = len(self.domains)
|
||||
|
||||
# Set id names
|
||||
if xs_ids is not None:
|
||||
if isinstance(xs_ids, basestring):
|
||||
# If we only have a string lets convert it now to a list
|
||||
# of strings.
|
||||
all_xs_ids = [xs_ids] * num_domains
|
||||
else:
|
||||
cv.check_iterable_type('xs_ids', xs_ids, basestring)
|
||||
cv.check_length('xs_ids', xs_ids, num_domains, num_domains)
|
||||
all_xs_ids = xs_ids
|
||||
|
||||
else:
|
||||
all_xs_ids = ['1m'] * num_domains
|
||||
|
||||
if self.domain_type == 'mesh':
|
||||
# Create the xsdata objects and add to the mgxs_file
|
||||
i = 0
|
||||
|
|
@ -1123,7 +1094,6 @@ class Library(object):
|
|||
|
||||
# Create XSdata and Macroscopic for this domain
|
||||
xsdata = self.get_xsdata(domain, xsdata_name,
|
||||
xs_id=all_xs_ids[i],
|
||||
tabular_legendre=tabular_legendre,
|
||||
tabular_points=tabular_points,
|
||||
subdomain=subdomain)
|
||||
|
|
@ -1148,7 +1118,6 @@ class Library(object):
|
|||
|
||||
xsdata = self.get_xsdata(domain, xsdata_name,
|
||||
nuclide=nuclide, xs_type=xs_type,
|
||||
xs_id=all_xs_ids[i],
|
||||
tabular_legendre=tabular_legendre,
|
||||
tabular_points=tabular_points)
|
||||
|
||||
|
|
@ -1156,9 +1125,8 @@ class Library(object):
|
|||
|
||||
return mgxs_file
|
||||
|
||||
def create_mg_mode(self, xsdata_names=None, xs_ids=None,
|
||||
tabular_legendre=None, tabular_points=33,
|
||||
bc=['reflective'] * 6):
|
||||
def create_mg_mode(self, xsdata_names=None, tabular_legendre=None,
|
||||
tabular_points=33, bc=['reflective'] * 6):
|
||||
"""Creates an openmc.MGXSLibrary object to contain the MGXS data for the
|
||||
Multi-Group mode of OpenMC as well as the associated openmc.Materials
|
||||
and openmc.Geometry objects. The created Geometry is the same as that
|
||||
|
|
@ -1172,10 +1140,6 @@ class Library(object):
|
|||
xsdata_names : Iterable of str
|
||||
List of names to apply to the "xsdata" entries in the
|
||||
resultant mgxs data file. Defaults to 'set1', 'set2', ...
|
||||
xs_ids : str or Iterable of str
|
||||
Cross section set identifier (i.e., '71c') for all
|
||||
data sets (if only str) or for each individual one
|
||||
(if iterable of str). Defaults to '1m'.
|
||||
tabular_legendre : None or bool
|
||||
Flag to denote whether or not the Legendre expansion of the
|
||||
scattering angular distribution is to be converted to a tabular
|
||||
|
|
@ -1234,7 +1198,7 @@ class Library(object):
|
|||
cv.check_length("domains", self.domains, 1, 1)
|
||||
|
||||
# Get the MGXS File Data
|
||||
mgxs_file = self.create_mg_library('macro', xsdata_names, xs_ids,
|
||||
mgxs_file = self.create_mg_library('macro', xsdata_names,
|
||||
tabular_legendre, tabular_points)
|
||||
|
||||
# Now move on the creating the geometry and assigning materials
|
||||
|
|
@ -1251,10 +1215,10 @@ class Library(object):
|
|||
|
||||
for i, subdomain in enumerate(self.domains[0].cell_generator()):
|
||||
xsdata = mgxs_file.xsdatas[i]
|
||||
[name, id] = xsdata.name.split('.')
|
||||
|
||||
# Build the macroscopic and assign it to the cell of
|
||||
# interest
|
||||
macroscopic = openmc.Macroscopic(name=name, xs=id)
|
||||
macroscopic = openmc.Macroscopic(name=xsdata.name)
|
||||
|
||||
# Create Material and add to collection
|
||||
material = openmc.Material(name=xsdata.name)
|
||||
|
|
@ -1275,9 +1239,8 @@ class Library(object):
|
|||
# Create the xsdata object and add it to the mgxs_file
|
||||
for i, domain in enumerate(self.domains):
|
||||
xsdata = mgxs_file.xsdatas[i]
|
||||
[name, id] = xsdata.name.split('.')
|
||||
|
||||
macroscopic = openmc.Macroscopic(name=name, xs=id)
|
||||
macroscopic = openmc.Macroscopic(name=xsdata.name)
|
||||
|
||||
# Create Material and add to collection
|
||||
material = openmc.Material(name=xsdata.name)
|
||||
|
|
|
|||
|
|
@ -2147,6 +2147,12 @@ contains
|
|||
! Copy default temperature
|
||||
if (check_for_node(doc, "default_temperature")) then
|
||||
call get_node_value(doc, "default_temperature", default_temperature)
|
||||
else if (.not. run_CE) then
|
||||
! FIXME This is only necessary while MG mode does not have a
|
||||
! temperature dependent library implementation.
|
||||
! Set a default for MG mode to allow MG libraries to not include
|
||||
! temperatures
|
||||
default_temperature = '294K'
|
||||
else
|
||||
default_temperature = ''
|
||||
end if
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@ module nuclide_header
|
|||
my_temperature = temperatures(j)
|
||||
if (temperature /= my_temperature) then
|
||||
if (temperature == '0K') then
|
||||
call fatal_error(trim(this % name) // " does not contain 0K data &
|
||||
&needed for the resonance scattering options selected")
|
||||
call warning(trim(this % name) // " does not contain 0K data &
|
||||
&needed for the resonance scattering options selected")
|
||||
else
|
||||
call warning(trim(this % name) // " does not contain data at a &
|
||||
&temperature of " // trim(temperature) // "; using the &
|
||||
|
|
|
|||
|
|
@ -222,9 +222,14 @@ contains
|
|||
! closest temperature
|
||||
my_temperature = temperatures(j)
|
||||
if (temperature /= my_temperature) then
|
||||
call warning(trim(this % name) // " does not contain data at a &
|
||||
&temperature of " // trim(temperature) // "; using the &
|
||||
&nearest available temperature of " // trim(my_temperature))
|
||||
if (temperature == '0K') then
|
||||
call warning(trim(this % name) // " does not contain 0K data &
|
||||
&needed for the resonance scattering options selected")
|
||||
else
|
||||
call warning(trim(this % name) // " does not contain data at a &
|
||||
&temperature of " // trim(temperature) // "; using the &
|
||||
&nearest available temperature of " // trim(my_temperature))
|
||||
end if
|
||||
end if
|
||||
|
||||
kT_dset = open_dataset(kT_group, my_temperature)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
<group_structure> 0.0000000E+00 2.0000000E+01 </group_structure>
|
||||
|
||||
<xsdata>
|
||||
<name> uo2_iso.71c </name>
|
||||
<alias> uo2_iso.71c </alias>
|
||||
<name> uo2_iso </name>
|
||||
<alias> uo2_iso </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 5 </order>
|
||||
<fissionable> true </fissionable>
|
||||
|
|
@ -44,8 +44,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> clad_iso.71c </name>
|
||||
<alias> clad_iso.71c </alias>
|
||||
<name> clad_iso </name>
|
||||
<alias> clad_iso </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 5 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -75,8 +75,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> lwtr_iso.71c </name>
|
||||
<alias> lwtr_iso.71c </alias>
|
||||
<name> lwtr_iso </name>
|
||||
<alias> lwtr_iso </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 5 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -106,8 +106,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> uo2_iso_mu.71c </name>
|
||||
<alias> uo2_iso_mu.71c </alias>
|
||||
<name> uo2_iso_mu </name>
|
||||
<alias> uo2_iso_mu </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 32 </order>
|
||||
<fissionable> true </fissionable>
|
||||
|
|
@ -199,8 +199,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> clad_iso_mu.71c </name>
|
||||
<alias> clad_iso_mu.71c </alias>
|
||||
<name> clad_iso_mu </name>
|
||||
<alias> clad_iso_mu </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 32 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -283,8 +283,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> lwtr_iso_mu.71c </name>
|
||||
<alias> lwtr_iso_mu.71c </alias>
|
||||
<name> lwtr_iso_mu </name>
|
||||
<alias> lwtr_iso_mu </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 32 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -367,8 +367,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> uo2_ang.71c </name>
|
||||
<alias> uo2_ang.71c </alias>
|
||||
<name> uo2_ang </name>
|
||||
<alias> uo2_ang </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 5 </order>
|
||||
<fissionable> true </fissionable>
|
||||
|
|
@ -1246,8 +1246,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> clad_ang.71c </name>
|
||||
<alias> clad_ang.71c </alias>
|
||||
<name> clad_ang </name>
|
||||
<alias> clad_ang </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 5 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -1930,8 +1930,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> lwtr_ang.71c </name>
|
||||
<alias> lwtr_ang.71c </alias>
|
||||
<name> lwtr_ang </name>
|
||||
<alias> lwtr_ang </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 5 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -2614,8 +2614,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> uo2_ang_mu.71c </name>
|
||||
<alias> uo2_ang_mu.71c </alias>
|
||||
<name> uo2_ang_mu </name>
|
||||
<alias> uo2_ang_mu </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 32 </order>
|
||||
<fissionable> true </fissionable>
|
||||
|
|
@ -5158,8 +5158,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> clad_ang_mu.71c </name>
|
||||
<alias> clad_ang_mu.71c </alias>
|
||||
<name> clad_ang_mu </name>
|
||||
<alias> clad_ang_mu </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 32 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
@ -7507,8 +7507,8 @@
|
|||
</xsdata>
|
||||
|
||||
<xsdata>
|
||||
<name> lwtr_ang_mu.71c </name>
|
||||
<alias> lwtr_ang_mu.71c </alias>
|
||||
<name> lwtr_ang_mu </name>
|
||||
<alias> lwtr_ang_mu </alias>
|
||||
<kT> 2.5300000E-08 </kT>
|
||||
<order> 32 </order>
|
||||
<fissionable> false </fissionable>
|
||||
|
|
|
|||
|
|
@ -829,17 +829,17 @@ class AssemblyInputSet(object):
|
|||
class MGInputSet(InputSet):
|
||||
def build_default_materials_and_geometry(self):
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
uo2_data = openmc.Macroscopic('uo2_iso', '71c')
|
||||
uo2_data = openmc.Macroscopic('uo2_iso')
|
||||
uo2 = openmc.Material(name='UO2', material_id=1)
|
||||
uo2.set_density('macro', 1.0)
|
||||
uo2.add_macroscopic(uo2_data)
|
||||
|
||||
clad_data = openmc.Macroscopic('clad_ang_mu', '71c')
|
||||
clad_data = openmc.Macroscopic('clad_ang_mu')
|
||||
clad = openmc.Material(name='Clad', material_id=2)
|
||||
clad.set_density('macro', 1.0)
|
||||
clad.add_macroscopic(clad_data)
|
||||
|
||||
water_data = openmc.Macroscopic('lwtr_iso_mu', '71c')
|
||||
water_data = openmc.Macroscopic('lwtr_iso_mu')
|
||||
water = openmc.Material(name='LWTR', material_id=3)
|
||||
water.set_density('macro', 1.0)
|
||||
water.add_macroscopic(water_data)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
2fdba76bad058eec6e43657692ef759de79c934076067d4ec5c9f2bdb131877e001f67e16b16bb14889e5e0a1ba84c780979b9d6772573aa6f82d979774c2af8
|
||||
d90692c6bf8db3672d70103ded682326d7f14d416e79e18ec055bdeafe1dbc1dbe642e8410cad95bf247f27c907b10b1567127bd2868d466ce2586aacff0411f
|
||||
|
|
@ -1 +1 @@
|
|||
60a35864ad71646309d7f1687ba0826d4d53a5b2e8babf73614362645205484bad3c0e7bf605ec0b11cadf58474b2e3d0a97bf2d9297f9118682c37ff0269afd
|
||||
7d508b1f3a2661566b8e8cb76fee61aecb96e8b60d633b06f13c4600bd854ea3366cdebd033c0a71ffb8adb90a9aeb64fe5ac0ef3235260921f5689c93e54305
|
||||
|
|
@ -10,23 +10,22 @@ import openmc
|
|||
class MGNuclideInputSet(MGInputSet):
|
||||
def build_default_materials_and_geometry(self):
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
uo2_data = openmc.Macroscopic('uo2_iso', '71c')
|
||||
uo2_data = openmc.Macroscopic('uo2_iso')
|
||||
uo2 = openmc.Material(name='UO2', material_id=1)
|
||||
uo2.set_density('macro', 1.0)
|
||||
uo2.add_macroscopic(uo2_data)
|
||||
|
||||
clad_data = openmc.Macroscopic('clad_iso', '71c')
|
||||
clad_data = openmc.Macroscopic('clad_iso')
|
||||
clad = openmc.Material(name='Clad', material_id=2)
|
||||
clad.set_density('macro', 1.0)
|
||||
clad.add_macroscopic(clad_data)
|
||||
|
||||
water_data = openmc.Macroscopic('lwtr_iso', '71c')
|
||||
water_data = openmc.Macroscopic('lwtr_iso')
|
||||
water = openmc.Material(name='LWTR', material_id=3)
|
||||
water.set_density('macro', 1.0)
|
||||
water.add_macroscopic(water_data)
|
||||
|
||||
# Define the materials file.
|
||||
self.materials.default_xs = '71c'
|
||||
self.materials += (uo2, clad, water)
|
||||
|
||||
# Define surfaces.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
6c437c3f9281c52a80a9b166971aa0f5db7ff8b6cf65c79b6d7bf294fad30cc7044f6a665cd9059f8580441bcbb581f7152ff5bccbc21fbcc407847ea6fe3306
|
||||
707285b77a091904a69720e78bf87a6779f2223c0fa2a3725353d00ca30f2624c7d53af016d78c7ad30b70a24bb53eda7dea2f592499b098f541591825b67143
|
||||
|
|
@ -83,6 +83,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
returncode = openmc.run(openmc_exec=self._opts.exe)
|
||||
|
||||
def _cleanup(self):
|
||||
return
|
||||
super(MGXSTestHarness, self)._cleanup()
|
||||
f = os.path.join(os.getcwd(), 'mgxs.xml')
|
||||
if os.path.exists(f):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue