diff --git a/docs/source/io_formats/nuclear_data.rst b/docs/source/io_formats/nuclear_data.rst index 7ad80b2fc..bb87bd5b9 100644 --- a/docs/source/io_formats/nuclear_data.rst +++ b/docs/source/io_formats/nuclear_data.rst @@ -16,7 +16,7 @@ Incident Neutron Data - **metastable** (*int*) -- Metastable state (0=ground, 1=first excited, etc.) - **atomic_weight_ratio** (*double*) -- Mass in units of neutron masses - - **temperature** (*double*) -- Temperature in MeV + - **kTs** (*double[]*) -- Temperatures (in MeV) contained in the library - **n_reaction** (*int*) -- Number of reactions :Datasets: - **energy** (*double[]*) -- Energy points at which cross sections are tabulated @@ -26,13 +26,20 @@ Incident Neutron Data :Attributes: - **mt** (*int*) -- ENDF MT reaction number - **label** (*char[]*) -- Name of the reaction - **Q_value** (*double*) -- Q value in MeV - - **threshold_idx** (*int*) -- Index on the energy grid that the - reaction threshold corresponds to - **center_of_mass** (*int*) -- Whether the reference frame for scattering is center-of-mass (1) or laboratory (0) - **n_product** (*int*) -- Number of reaction products -:Datasets: - **xs** (*double[]*) -- Cross section values tabulated against the nuclide energy grid +**//reactions/reaction_//** + + is the temperature in Kelvin, rounded to the nearest integer, of the +temperature-dependent data set. For example, the data set corresponding to +300 Kelvin would be located at `300K`. + +:Attributes: - **threshold_idx** (*int*) -- Index on the energy grid that the + reaction threshold corresponds to for temperature TTT (in Kelvin) + +:Datasets: - **xs** (*double[]*) -- Cross section values tabulated against the nuclide energy grid for temperature TTT (in Kelvin) **//reactions/reaction_/product_/** @@ -92,32 +99,39 @@ Thermal Neutron Scattering Data **//** :Attributes: - **atomic_weight_ratio** (*double*) -- Mass in units of neutron masses - - **temperature** (*double*) -- Temperature in MeV + - **kTs** (*double[]*) -- Temperatures (in MeV) contained in the library - **zaids** (*int[]*) -- ZAID identifiers for which the thermal scattering data applies to - -**//elastic/** - -:Datasets: - **xs** (:ref:`tabulated <1d_tabulated>`) -- Thermal inelastic - scattering cross section - - **mu_out** (*double[][]*) -- Distribution of outgoing energies - and angles for coherent elastic scattering - -**//inelastic/** - -:Attributes: - **secondary_mode** (*char[]*) -- Indicates how the inelastic outgoing angle-energy distributions are represented ('equal', 'skewed', or 'continuous'). +**//elastic//** + + is the temperature in Kelvin, rounded to the nearest integer, of the +temperature-dependent data set. For example, the data set corresponding to +300 Kelvin would be located at `300K`. + :Datasets: - **xs** (:ref:`tabulated <1d_tabulated>`) -- Thermal inelastic - scattering cross section + scattering cross section for temperature TTT (in Kelvin) + - **mu_out** (*double[][]*) -- Distribution of outgoing energies + and angles for coherent elastic scattering for temperature TTT + (in Kelvin) + +**//inelastic//** + + is the temperature in Kelvin, rounded to the nearest integer, of the +temperature-dependent data set. For example, the data set corresponding to +300 Kelvin would be located at `300K`. + +:Datasets: - **xs** (:ref:`tabulated <1d_tabulated>`) -- Thermal inelastic + scattering cross section for temperature TTT (in Kelvin) - **energy_out** (*double[][]*) -- Distribution of outgoing - energies for each incoming energy. Only present if secondary mode - is not continuous. + energies for each incoming energy for temperature TTT (in Kelvin). + Only present if secondary mode is not continuous. - **mu_out** (*double[][][]*) -- Distribution of scattering cosines - for each pair of incoming and outgoing energies. Only present if - secondary mode is not continuous. + for each pair of incoming and outgoing energies. for temperature + TTT (in Kelvin). Only present if secondary mode is not continuous. If the secondary mode is continuous, the outgoing energy-angle distribution is given as a :ref:`correlated angle-energy distribution diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index 8ea8e38e3..041978742 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -150,7 +150,7 @@ class IncidentNeutron(EqualityMixin): self.metastable = metastable self.atomic_weight_ratio = atomic_weight_ratio self.kTs = kTs - self.temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs] + self.temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] self.energy = {} self._fission_energy = None self.reactions = OrderedDict() @@ -300,7 +300,7 @@ class IncidentNeutron(EqualityMixin): if ace.temperature not in self.kTs: if name == self.name: # Add temperature and kTs - strT = "{0:.1f}K".format(kT_to_K(ace.temperature)) + strT = str(int(round(kT_to_K(ace.temperature)))) + "K" self.temperatures.append(strT) self.kTs.append(ace.temperature) # Read energy grid @@ -458,7 +458,7 @@ class IncidentNeutron(EqualityMixin): metastable = group.attrs['metastable'] atomic_weight_ratio = group.attrs['atomic_weight_ratio'] kTs = group.attrs['kTs'].tolist() - temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs] + temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] data = cls(name, atomic_number, mass_number, metastable, atomic_weight_ratio, kTs) @@ -544,7 +544,8 @@ class IncidentNeutron(EqualityMixin): # Assign temperature to the running list kTs = [ace.temperature] - temperatures = ["{0:.1f}K".format(kT_to_K(ace.temperature))] + + temperatures = [str(int(round(kT_to_K(ace.temperature)))) + "K"] # If mass number hasn't been specified, make an educated guess zaid, xs = ace.name.split('.') diff --git a/openmc/data/reaction.py b/openmc/data/reaction.py index 741822bf0..5d3b8daf5 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -488,7 +488,7 @@ class Reaction(EqualityMixin): # Convert data temperature to a "300.0K" number for indexing # temperature data - strT = "{0:.1f}K".format(kT_to_K(ace.temperature)) + strT = str(int(round(kT_to_K(ace.temperature)))) + "K" if i_reaction > 0: mt = int(ace.xss[ace.jxs[3] + i_reaction - 1]) diff --git a/openmc/data/thermal.py b/openmc/data/thermal.py index 27c61e924..a28dcb504 100644 --- a/openmc/data/thermal.py +++ b/openmc/data/thermal.py @@ -92,7 +92,6 @@ class CoherentElastic(EqualityMixin): idx = np.searchsorted(self.bragg_edges, E) return self.factors[idx] / E - def __len__(self): return len(self.bragg_edges) @@ -192,7 +191,7 @@ class ThermalScattering(EqualityMixin): self.name = name self.atomic_weight_ratio = atomic_weight_ratio self.kTs = kTs - self.temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs] + self.temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] self.elastic_xs = {} self.elastic_mu_out = {} self.inelastic_xs = {} @@ -303,7 +302,7 @@ class ThermalScattering(EqualityMixin): if ace.temperature not in self.kTs: if name == self.name: # Add temperature and kTs - strT = "{0:.1f}K".format(kT_to_K(ace.temperature)) + strT = str(int(round(kT_to_K(ace.temperature)))) + "K" self.temperatures.append(strT) self.kTs.append(ace.temperature) @@ -438,7 +437,7 @@ class ThermalScattering(EqualityMixin): name = group.name[1:] atomic_weight_ratio = group.attrs['atomic_weight_ratio'] kTs = group.attrs['kTs'].tolist() - temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs] + temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] table = cls(name, atomic_weight_ratio, kTs) table.zaids = group.attrs['zaids'] @@ -526,7 +525,7 @@ class ThermalScattering(EqualityMixin): # Assign temperature to the running list kTs = [ace.temperature] - temperatures = ["{0:.1f}K".format(kT_to_K(ace.temperature))] + temperatures = [str(int(round(kT_to_K(ace.temperature)))) + "K"] table = cls(name, ace.atomic_weight_ratio, kTs) diff --git a/scripts/openmc-ace-to-hdf5 b/scripts/openmc-ace-to-hdf5 index a21fc9001..9a55ca749 100755 --- a/scripts/openmc-ace-to-hdf5 +++ b/scripts/openmc-ace-to-hdf5 @@ -130,14 +130,12 @@ for filename in ace_libraries: if xs.endswith('c'): # Continuous-energy neutron data if name not in nuclides: - neutron = openmc.data.IncidentNeutron.from_ace( + try: + 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 + 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: @@ -172,7 +170,11 @@ for filename in ace_libraries: elif xs.endswith('t'): # Thermal scattering data if name not in nuclides: - thermal = openmc.data.ThermalScattering.from_ace(table) + try: + thermal = openmc.data.ThermalScattering.from_ace(table) + except Exception as e: + print('Failed to convert {}: {}'.format(table.name, e)) + continue print('Converting {} (ACE) to {} (HDF5)'.format(table.name, thermal.name))