diff --git a/docs/source/io_formats/nuclear_data.rst b/docs/source/io_formats/nuclear_data.rst index 18d36528fa..39fcdfd325 100644 --- a/docs/source/io_formats/nuclear_data.rst +++ b/docs/source/io_formats/nuclear_data.rst @@ -16,18 +16,17 @@ Incident Neutron Data - **metastable** (*int*) -- Metastable state (0=ground, 1=first excited, etc.) - **atomic_weight_ratio** (*double*) -- Mass in units of neutron masses - - **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 **//kTs/** - is the temperature in Kelvin, rounded to the nearest integer, of the +K 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: - **** (*double[]*) -- kT values (in MeV) for each Temperature +:Datasets: - **K** (*double*) -- kT values (in MeV) for each Temperature TTT (in Kelvin) **//reactions/reaction_/** @@ -39,9 +38,9 @@ temperature-dependent data set. For example, the data set corresponding to scattering is center-of-mass (1) or laboratory (0) - **n_product** (*int*) -- Number of reaction products -**//reactions/reaction_//** +**//reactions/reaction_/K/** - is the temperature in Kelvin, rounded to the nearest integer, of the +K 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`. @@ -116,9 +115,9 @@ Thermal Neutron Scattering Data outgoing angle-energy distributions are represented ('equal', 'skewed', or 'continuous'). -**//elastic//** +**//elastic/K/** - is the temperature in Kelvin, rounded to the nearest integer, of the +K 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`. @@ -128,9 +127,9 @@ temperature-dependent data set. For example, the data set corresponding to and angles for coherent elastic scattering for temperature TTT (in Kelvin) -**//inelastic//** +**//inelastic/K/** - is the temperature in Kelvin, rounded to the nearest integer, of the +K 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`. diff --git a/openmc/data/data.py b/openmc/data/data.py index 4eb7860c23..574ae541aa 100644 --- a/openmc/data/data.py +++ b/openmc/data/data.py @@ -219,6 +219,7 @@ def atomic_mass(isotope): return _ATOMIC_MASS.get(isotope.lower()) -def kT_to_K(kT): - K = kT / 8.6173324e-11 - return K \ No newline at end of file +# The value of the Boltzman constant in units of MeV / K +# Values here are from the Committee on Data for Science and Technology +# (CODATA) 2010 recommendation (doi:10.1103/RevModPhys.84.1527). +K_BOLTZMANN = 8.6173324E-11 diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index bf8020b72a..dbf2da23ca 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -7,7 +7,7 @@ from warnings import warn import numpy as np import h5py -from .data import ATOMIC_SYMBOL, SUM_RULES, kT_to_K +from .data import ATOMIC_SYMBOL, SUM_RULES, K_BOLTZMANN from .ace import Table, get_table from .fission_energy import FissionEnergyRelease from .function import Tabulated1D, Sum @@ -40,6 +40,16 @@ def _get_metadata(zaid, metastable_scheme='nndc'): Returns ------- + name : str + Name of the table + element : str + The atomic symbol of the isotope in the table; e.g., Zr. + Z : int + Number of protons in the nucleus + mass_number : int + Number of nucleons in the nucleus + metastable : int + Metastable state of the nucleus. A value of zero indicates ground state. """ @@ -98,7 +108,7 @@ class IncidentNeutron(EqualityMixin): Metastable state of the nucleus. A value of zero indicates ground state. atomic_weight_ratio : float Atomic mass ratio of the target nuclide. - kTs : Iterable float + kTs : Iterable of float List of temperatures of the target nuclide in the data set. The temperatures have units of MeV. @@ -112,7 +122,7 @@ class IncidentNeutron(EqualityMixin): Atomic weight ratio of the target nuclide. energy : dict of numpy.ndarray The energy values (MeV) at which reaction cross-sections are tabulated. - They keys of the dict are the temperature string ('296.3K') for each + They keys of the dict are the temperature string ('294K') for each set of energies fission_energy : None or openmc.data.FissionEnergyRelease The energy released by fission, tabulated by component (e.g. prompt @@ -122,7 +132,7 @@ class IncidentNeutron(EqualityMixin): metastable : int Metastable state of the nucleus. A value of zero indicates ground state. name : str - ZAID identifier of the table, e.g. 92235.70c. + ZAID identifier of the table, e.g. 92235. reactions : collections.OrderedDict Contains the cross sections, secondary angle and energy distributions, and other associated data for each reaction. The keys are the MT values @@ -132,8 +142,8 @@ class IncidentNeutron(EqualityMixin): are the MT values and the values are Reaction objects. temperatures : Iterable of str List of string representations the temperatures of the target nuclide - in the data set. The temperatures are strings with 1 decimal place, - i.e., '293.6K' + in the data set. The temperatures are strings of the temperature, + rounded to the nearest integer; e.g., '294K' kTs : Iterable of float List of temperatures of the target nuclide in the data set. The temperatures have units of MeV. @@ -150,7 +160,8 @@ class IncidentNeutron(EqualityMixin): self.metastable = metastable self.atomic_weight_ratio = atomic_weight_ratio self.kTs = kTs - self.temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] + self.temperatures = [str(int(round(kT / K_BOLTZMANN))) + "K" + for kT in kTs] self.energy = {} self._fission_energy = None self.reactions = OrderedDict() @@ -300,7 +311,7 @@ class IncidentNeutron(EqualityMixin): if ace.temperature not in self.kTs: if name == self.name: # Add temperature and kTs - strT = str(int(round(kT_to_K(ace.temperature)))) + "K" + strT = str(int(round(ace.temperature / K_BOLTZMANN))) + "K" self.temperatures.append(strT) self.kTs.append(ace.temperature) # Read energy grid @@ -463,7 +474,7 @@ class IncidentNeutron(EqualityMixin): kTs = [] for temp in kTg: kTs.append(kTg[temp].value) - temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] + temperatures = [str(int(round(kT / K_BOLTZMANN))) + "K" for kT in kTs] data = cls(name, atomic_number, mass_number, metastable, atomic_weight_ratio, kTs) @@ -550,7 +561,7 @@ class IncidentNeutron(EqualityMixin): # Assign temperature to the running list kTs = [ace.temperature] - temperatures = [str(int(round(kT_to_K(ace.temperature)))) + "K"] + temperatures = [str(int(round(ace.temperature / K_BOLTZMANN))) + "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 5d3b8daf59..9dc0d26a4d 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -12,7 +12,7 @@ from openmc.stats import Uniform from .angle_distribution import AngleDistribution from .angle_energy import AngleEnergy from .function import Tabulated1D, Polynomial -from .data import REACTION_NAME, kT_to_K +from .data import REACTION_NAME, K_BOLTZMANN from .product import Product from .uncorrelated import UncorrelatedAngleEnergy @@ -444,8 +444,10 @@ class Reaction(EqualityMixin): HDF5 group to write to energy : Iterable of float Array of energies at which cross sections are tabulated at - temperatures : Iterable of float - Array of temperatures at which to obtain the cross sections + temperatures : Iterable of str + List of string representations the temperatures of the target + nuclide in the data set. The temperatures are strings of the + temperature, rounded to the nearest integer; e.g., '294K' Returns ------- @@ -488,7 +490,7 @@ class Reaction(EqualityMixin): # Convert data temperature to a "300.0K" number for indexing # temperature data - strT = str(int(round(kT_to_K(ace.temperature)))) + "K" + strT = str(int(round(ace.temperature / K_BOLTZMANN))) + "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 8e4ab8ea57..21edab6868 100644 --- a/openmc/data/thermal.py +++ b/openmc/data/thermal.py @@ -8,7 +8,7 @@ import h5py import openmc.checkvalue as cv from openmc.mixin import EqualityMixin -from .data import kT_to_K +from .data import K_BOLTZMANN from .ace import Table, get_table from .angle_energy import AngleEnergy from .function import Tabulated1D @@ -177,8 +177,8 @@ class ThermalScattering(EqualityMixin): Name of the table, e.g. lwtr.20t. temperatures : Iterable of str List of string representations the temperatures of the target nuclide - in the data set. The temperatures are strings with 1 decimal place, - i.e., '293.6K' + in the data set. The temperatures are strings of the temperature, + rounded to the nearest integer; e.g., '294K' kTs : Iterable of float List of temperatures of the target nuclide in the data set. The temperatures have units of MeV. @@ -191,7 +191,8 @@ class ThermalScattering(EqualityMixin): self.name = name self.atomic_weight_ratio = atomic_weight_ratio self.kTs = kTs - self.temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] + self.temperatures = [str(int(round(kT / K_BOLTZMANN))) + "K" + for kT in kTs] self.elastic_xs = {} self.elastic_mu_out = {} self.inelastic_xs = {} @@ -304,7 +305,7 @@ class ThermalScattering(EqualityMixin): if ace.temperature not in self.kTs: if name == self.name: # Add temperature and kTs - strT = str(int(round(kT_to_K(ace.temperature)))) + "K" + strT = str(int(round(ace.temperature / K_BOLTZMANN))) + "K" self.temperatures.append(strT) self.kTs.append(ace.temperature) @@ -442,7 +443,7 @@ class ThermalScattering(EqualityMixin): kTs = [] for temp in kTg: kTs.append(kTg[temp].value) - temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs] + temperatures = [str(int(round(kT / K_BOLTZMANN))) + "K" for kT in kTs] table = cls(name, atomic_weight_ratio, kTs) table.zaids = group.attrs['zaids'] @@ -530,7 +531,7 @@ class ThermalScattering(EqualityMixin): # Assign temperature to the running list kTs = [ace.temperature] - temperatures = [str(int(round(kT_to_K(ace.temperature)))) + "K"] + temperatures = [str(int(round(ace.temperature / K_BOLTZMANN))) + "K"] table = cls(name, ace.atomic_weight_ratio, kTs)