resolving first round of @paulromano comments

This commit is contained in:
Adam Nelson 2016-08-24 19:57:16 -04:00
parent 262554d53d
commit 0351ed96f0
5 changed files with 47 additions and 33 deletions

View file

@ -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
**/<nuclide name>/kTs/**
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
<TTT>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: - **<TTTK>** (*double[]*) -- kT values (in MeV) for each Temperature
:Datasets: - **<TTT>K** (*double*) -- kT values (in MeV) for each Temperature
TTT (in Kelvin)
**/<nuclide name>/reactions/reaction_<mt>/**
@ -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
**/<nuclide name>/reactions/reaction_<mt>/<TTTK>/**
**/<nuclide name>/reactions/reaction_<mt>/<TTT>K/**
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
<TTT>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').
**/<thermal name>/elastic/<TTTK>/**
**/<thermal name>/elastic/<TTT>K/**
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
<TTT>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)
**/<thermal name>/inelastic/<TTTK>/**
**/<thermal name>/inelastic/<TTT>K/**
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
<TTT>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`.

View file

@ -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
# 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

View file

@ -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('.')

View file

@ -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])

View file

@ -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)