diff --git a/openmc/macroscopic.py b/openmc/macroscopic.py index e47baf9fba..a1ca62c9ab 100644 --- a/openmc/macroscopic.py +++ b/openmc/macroscopic.py @@ -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) diff --git a/openmc/material.py b/openmc/material.py index 15c0451872..2b52995738 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -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): diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 9e5dba310c..4b68952a67 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -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) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 8e48131932..1cb0dc0fd4 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -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 diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 5b66a09bc2..5b3dd31fe5 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -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 & diff --git a/src/sab_header.F90 b/src/sab_header.F90 index d12b75a32b..59e336a38d 100644 --- a/src/sab_header.F90 +++ b/src/sab_header.F90 @@ -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) diff --git a/tests/1d_mgxs.xml b/tests/1d_mgxs.xml index 33b20464b6..8704b49ad4 100644 --- a/tests/1d_mgxs.xml +++ b/tests/1d_mgxs.xml @@ -4,8 +4,8 @@ 0.0000000E+00 2.0000000E+01 - uo2_iso.71c - uo2_iso.71c + uo2_iso + uo2_iso 2.5300000E-08 5 true @@ -44,8 +44,8 @@ - clad_iso.71c - clad_iso.71c + clad_iso + clad_iso 2.5300000E-08 5 false @@ -75,8 +75,8 @@ - lwtr_iso.71c - lwtr_iso.71c + lwtr_iso + lwtr_iso 2.5300000E-08 5 false @@ -106,8 +106,8 @@ - uo2_iso_mu.71c - uo2_iso_mu.71c + uo2_iso_mu + uo2_iso_mu 2.5300000E-08 32 true @@ -199,8 +199,8 @@ - clad_iso_mu.71c - clad_iso_mu.71c + clad_iso_mu + clad_iso_mu 2.5300000E-08 32 false @@ -283,8 +283,8 @@ - lwtr_iso_mu.71c - lwtr_iso_mu.71c + lwtr_iso_mu + lwtr_iso_mu 2.5300000E-08 32 false @@ -367,8 +367,8 @@ - uo2_ang.71c - uo2_ang.71c + uo2_ang + uo2_ang 2.5300000E-08 5 true @@ -1246,8 +1246,8 @@ - clad_ang.71c - clad_ang.71c + clad_ang + clad_ang 2.5300000E-08 5 false @@ -1930,8 +1930,8 @@ - lwtr_ang.71c - lwtr_ang.71c + lwtr_ang + lwtr_ang 2.5300000E-08 5 false @@ -2614,8 +2614,8 @@ - uo2_ang_mu.71c - uo2_ang_mu.71c + uo2_ang_mu + uo2_ang_mu 2.5300000E-08 32 true @@ -5158,8 +5158,8 @@ - clad_ang_mu.71c - clad_ang_mu.71c + clad_ang_mu + clad_ang_mu 2.5300000E-08 32 false @@ -7507,8 +7507,8 @@ - lwtr_ang_mu.71c - lwtr_ang_mu.71c + lwtr_ang_mu + lwtr_ang_mu 2.5300000E-08 32 false diff --git a/tests/input_set.py b/tests/input_set.py index ae2876480a..e409fba58f 100644 --- a/tests/input_set.py +++ b/tests/input_set.py @@ -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) diff --git a/tests/test_mg_basic/inputs_true.dat b/tests/test_mg_basic/inputs_true.dat index 3f83de7600..bfb0cc09e9 100644 --- a/tests/test_mg_basic/inputs_true.dat +++ b/tests/test_mg_basic/inputs_true.dat @@ -1 +1 @@ -2fdba76bad058eec6e43657692ef759de79c934076067d4ec5c9f2bdb131877e001f67e16b16bb14889e5e0a1ba84c780979b9d6772573aa6f82d979774c2af8 \ No newline at end of file +d90692c6bf8db3672d70103ded682326d7f14d416e79e18ec055bdeafe1dbc1dbe642e8410cad95bf247f27c907b10b1567127bd2868d466ce2586aacff0411f \ No newline at end of file diff --git a/tests/test_mg_max_order/inputs_true.dat b/tests/test_mg_max_order/inputs_true.dat index 63bdaab03e..d827cfaa49 100644 --- a/tests/test_mg_max_order/inputs_true.dat +++ b/tests/test_mg_max_order/inputs_true.dat @@ -1 +1 @@ -60a35864ad71646309d7f1687ba0826d4d53a5b2e8babf73614362645205484bad3c0e7bf605ec0b11cadf58474b2e3d0a97bf2d9297f9118682c37ff0269afd \ No newline at end of file +7d508b1f3a2661566b8e8cb76fee61aecb96e8b60d633b06f13c4600bd854ea3366cdebd033c0a71ffb8adb90a9aeb64fe5ac0ef3235260921f5689c93e54305 \ No newline at end of file diff --git a/tests/test_mg_max_order/test_mg_max_order.py b/tests/test_mg_max_order/test_mg_max_order.py index 088f6914ba..da699316ca 100644 --- a/tests/test_mg_max_order/test_mg_max_order.py +++ b/tests/test_mg_max_order/test_mg_max_order.py @@ -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. diff --git a/tests/test_mg_tallies/inputs_true.dat b/tests/test_mg_tallies/inputs_true.dat index 41bbd2136e..c74d7759f7 100644 --- a/tests/test_mg_tallies/inputs_true.dat +++ b/tests/test_mg_tallies/inputs_true.dat @@ -1 +1 @@ -6c437c3f9281c52a80a9b166971aa0f5db7ff8b6cf65c79b6d7bf294fad30cc7044f6a665cd9059f8580441bcbb581f7152ff5bccbc21fbcc407847ea6fe3306 \ No newline at end of file +707285b77a091904a69720e78bf87a6779f2223c0fa2a3725353d00ca30f2624c7d53af016d78c7ad30b70a24bb53eda7dea2f592499b098f541591825b67143 \ No newline at end of file diff --git a/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py b/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py index 0f7cba4a87..baa54b018b 100644 --- a/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py +++ b/tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py @@ -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):