Convert ACE data from MeV to eV

This commit is contained in:
Paul Romano 2016-10-24 18:44:51 -05:00
parent b50a9db628
commit 6da9f16d29
44 changed files with 219 additions and 212 deletions

View file

@ -43,7 +43,7 @@ install: true
before_script:
- if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then
wget https://anl.box.com/shared/static/fouwc8lh9he2wc97kzq65u4rp8zt9sgq.xz -O - | tar -C $HOME -xvJ;
wget https://anl.box.com/shared/static/1ow880up90hgwynvh91twwfteameuwre.xz -O - | tar -C $HOME -xvJ;
fi
- export OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml

View file

@ -30,7 +30,7 @@ MGXS Library Specification
:Attributes: - **groups** (*int*) -- Number of energy groups
- **group structure** (*double[]*) -- Monotonically increasing
list of group boundaries, in units of MeV. The length of this
list of group boundaries, in units of eV. The length of this
array should be the number of groups plus 1.
**/<library name>/**
@ -77,8 +77,8 @@ data for the nuclide or material that it represents.
**/<library name>/kTs/**
:Datasets:
- **<TTT>K** (*double*) -- kT values (in MeV) for each Temperature
:Datasets:
- **<TTT>K** (*double*) -- kT values (in eV) for each temperature
TTT (in Kelvin), rounded to the nearest integer
**/<library name>/<TTT>K/**
@ -161,4 +161,4 @@ Data specific to neutron scattering for the temperature <TTT>K
1.0) will be assumed.
The pre-flattened array is shapes consistent with `scatter_matrix`
except the "[Order]" dimension in `scatter_shape` is ignored since
this data is assumed isotropic.
this data is assumed isotropic.

View file

@ -27,14 +27,14 @@ temperature-dependent data set. For example, the data set corresponding to
300 Kelvin would be located at `300K`.
:Datasets:
- **<TTT>K** (*double*) -- kT values (in MeV) for each Temperature
- **<TTT>K** (*double*) -- kT values (in eV) for each temperature
TTT (in Kelvin)
**/<nuclide name>/reactions/reaction_<mt>/**
:Attributes: - **mt** (*int*) -- ENDF MT reaction number
- **label** (*char[]*) -- Name of the reaction
- **Q_value** (*double*) -- Q value in MeV
- **Q_value** (*double*) -- Q value in eV
- **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
@ -129,7 +129,7 @@ temperature-dependent data set. For example, the data set corresponding to
300 Kelvin would be located at `300K`.
:Datasets:
- **<TTT>K** (*double*) -- kT values (in MeV) for each Temperature
- **<TTT>K** (*double*) -- kT values (in eV) for each temperature
TTT (in Kelvin)
**/<thermal name>/elastic/<TTT>K/**
@ -333,7 +333,7 @@ N-Body Phase Space
- **n_particles** (*int*) -- Number of product particles
- **atomic_weight_ratio** (*double*) -- Atomic weight ratio of the
target nuclide in neutron masses
- **q_value** (*double*) -- Q value for the reaction in MeV
- **q_value** (*double*) -- Q value for the reaction in eV
.. _energy_distribution:
@ -346,7 +346,7 @@ Maxwell
:Object type: Group
:Attributes: - **type** (*char[]*) -- 'maxwell'
- **u** (*double*) -- Restriction energy in MeV
- **u** (*double*) -- Restriction energy in eV
:Datasets:
- **theta** (:ref:`tabulated <1d_tabulated>`) -- Maxwellian
temperature as a function of energy
@ -356,7 +356,7 @@ Evaporation
:Object type: Group
:Attributes: - **type** (*char[]*) -- 'evaporation'
- **u** (*double*) -- Restriction energy in MeV
- **u** (*double*) -- Restriction energy in eV
:Datasets:
- **theta** (:ref:`tabulated <1d_tabulated>`) -- Evaporation
temperature as a function of energy
@ -366,7 +366,7 @@ Watt Fission Spectrum
:Object type: Group
:Attributes: - **type** (*char[]*) -- 'watt'
- **u** (*double*) -- Restriction energy in MeV
- **u** (*double*) -- Restriction energy in eV
:Datasets: - **a** (:ref:`tabulated <1d_tabulated>`) -- Watt parameter :math:`a`
as a function of incident energy
- **b** (:ref:`tabulated <1d_tabulated>`) -- Watt parameter :math:`b`
@ -386,7 +386,7 @@ Discrete Photon
:Object type: Group
:Attributes: - **type** (*char[]*) -- 'discrete_photon'
- **primary_flag** (*int*) -- Whether photon is a primary
- **energy** (*double*) -- Photon energy in MeV
- **energy** (*double*) -- Photon energy in eV
- **atomic_weight_ratio** (*double*) -- Atomic weight ratio of
target nuclide in neutron masses
@ -396,7 +396,7 @@ Level Inelastic
:Object type: Group
:Attributes: - **type** (*char[]*) -- 'level'
- **threshold** (*double*) -- Energy threshold in the laboratory
system in MeV
system in eV
- **mass_ratio** (*double*) -- :math:`(A/(A + 1))^2`
Continuous Tabular

View file

@ -46,7 +46,7 @@ The current revision of the particle restart file format is 1.
**/energy** (*double*)
Energy of the particle in MeV for continuous-energy mode, or the energy
Energy of the particle in eV for continuous-energy mode, or the energy
group of the particle for multi-group mode.
**/xyz** (*double[3]*)

View file

@ -1520,7 +1520,7 @@ The ``<tally>`` element accepts the following sub-elements:
.. code-block:: xml
<filter type="energy" bins="0.0 1.0 20.0" />
<filter type="energy" bins="0.0 1.0e6 20.0e6" />
then two energy bins will be created, one with energies between 0 and
1 MeV and the other with energies between 1 and 20 MeV.
@ -1535,7 +1535,7 @@ The ``<tally>`` element accepts the following sub-elements:
.. code-block:: xml
<filter type="energyout" bins="0.0 1.0 20.0" />
<filter type="energyout" bins="0.0 1.0e6 20.0e6" />
then two post-collision energy bins will be created, one with
energies between 0 and 1 MeV and the other with energies between
@ -1854,7 +1854,7 @@ The ``<tally>`` element accepts the following sub-elements:
| |particles. The neutrino energy does not contribute |
| |to this response. The prompt and delayed |
| |:math:`\gamma`-rays are assumed to deposit their |
| |energy locally. Units are MeV per source particle. |
| |energy locally. Units are eV per source particle. |
+----------------------+---------------------------------------------------+
|fission-q-prompt |The prompt fission energy production rate. This |
| |energy comes in the form of fission fragment |
@ -1863,7 +1863,7 @@ The ``<tally>`` element accepts the following sub-elements:
| |incident energy and it requires that the nuclear |
| |data library contains the optional fission energy |
| |release data. Energy is assumed to be deposited |
| |locally. Units are MeV per source particle. |
| |locally. Units are eV per source particle. |
+----------------------+---------------------------------------------------+
|fission-q-recoverable |The recoverable fission energy production rate. |
| |This energy comes in the form of fission fragment |
@ -1874,7 +1874,7 @@ The ``<tally>`` element accepts the following sub-elements:
| |incident neutron energy and it requires that the |
| |nuclear data library contains the optional fission |
| |energy release data. Energy is assumed to be |
| |deposited locally. Units are MeV per source |
| |deposited locally. Units are eV per source |
| |paticle. |
+----------------------+---------------------------------------------------+
|decay-rate |The delayed-nu-fission-weighted decay rate where |
@ -2256,7 +2256,7 @@ attributes/sub-elements:
The width of mesh cells in each direction.
:energy:
Energy bins [in MeV], listed in ascending order (e.g. 0.0 0.625e-7 20.0)
Energy bins [in eV], listed in ascending order (e.g. 0.0 0.625 20.0e6)
for CMFD tallies and acceleration. If no energy bins are listed, OpenMC
automatically assumes a one energy group calculation over the entire
energy range.

View file

@ -101,8 +101,8 @@ settings_file.export_to_xml()
# Instantiate some tally Filters
cell_filter = openmc.CellFilter(100)
energy_filter = openmc.EnergyFilter([0., 20.])
energyout_filter = openmc.EnergyoutFilter([0., 20.])
energy_filter = openmc.EnergyFilter([0., 20.e6])
energyout_filter = openmc.EnergyoutFilter([0., 20.e6])
# Instantiate the first Tally
first_tally = openmc.Tally(tally_id=1, name='first tally')

View file

@ -181,7 +181,7 @@ mesh.lower_left = [-0.62992, -0.62992, -1.e50]
mesh.upper_right = [0.62992, 0.62992, 1.e50]
# Instantiate some tally Filters
energy_filter = openmc.EnergyFilter([0., 4.e-6, 20.])
energy_filter = openmc.EnergyFilter([0., 4., 20.e6])
mesh_filter = openmc.MeshFilter(mesh)
# Instantiate the Tally

View file

@ -15,8 +15,8 @@ particles = 1000
###############################################################################
# Instantiate the energy group data
groups = openmc.mgxs.EnergyGroups(group_edges=[1E-11, 0.0635E-6, 10.0E-6,
1.0E-4, 1.0E-3, 0.5, 1.0, 20.0])
groups = openmc.mgxs.EnergyGroups(group_edges=[
1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6, 1.0e6, 20.0e6])
# Instantiate the 7-group (C5G7) cross section data
uo2_xsdata = openmc.XSdata('UO2', groups)
@ -156,8 +156,8 @@ mesh.lower_left = [-0.63, -0.63, -1.e50]
mesh.upper_right = [0.63, 0.63, 1.e50]
# Instantiate some tally Filters
energy_filter = openmc.EnergyFilter([1E-11, 0.0635E-6, 10.0E-6, 1.0E-4, 1.0E-3,
0.5, 1.0, 20.0])
energy_filter = openmc.EnergyFilter([1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6,
1.0e6, 20.0e6])
mesh_filter = openmc.MeshFilter(mesh)
# Instantiate the Tally

View file

@ -8,14 +8,14 @@
<tally id="2">
<filter type="cell" bins="100" />
<filter type="energy" bins="0 20.0" />
<filter type="energy" bins="0 20.0e6" />
<scores>total scatter nu-scatter absorption fission nu-fission</scores>
</tally>
<tally id="3">
<filter type="cell" bins="100" />
<filter type="energy" bins="0 20.0" />
<filter type="energyout" bins="0 20.0" />
<filter type="energy" bins="0 20.0e6" />
<filter type="energyout" bins="0 20.0e6" />
<scores>scatter nu-scatter nu-fission</scores>
</tally>

View file

@ -9,7 +9,7 @@
<tally id="1">
<filter type="mesh" bins="1" />
<filter type="energy" bins="0. 4.e-6 20.0" />
<filter type="energy" bins="0. 4. 20.0e6" />
<scores>flux fission nu-fission</scores>
</tally>

View file

@ -39,8 +39,8 @@ class CMFDMesh(object):
width : Iterable of float
The width of mesh cells in each direction.
energy : Iterable of float
Energy bins in MeV, listed in ascending order (e.g. [0.0, 0.625e-7,
20.0]) for CMFD tallies and acceleration. If no energy bins are listed,
Energy bins in eV, listed in ascending order (e.g. [0.0, 0.625e-1,
20.0e6]) for CMFD tallies and acceleration. If no energy bins are listed,
OpenMC automatically assumes a one energy group calculation over the
entire energy range.
albedo : Iterable of float

View file

@ -9,6 +9,7 @@ import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from openmc.stats import Univariate, Tabular, Uniform, Legendre
from .function import INTERPOLATION_SCHEME
from .data import EV_PER_MEV
from .endf import get_head_record, get_cont_record, get_tab1_record, \
get_list_record, get_tab2_record
@ -19,14 +20,14 @@ class AngleDistribution(EqualityMixin):
Parameters
----------
energy : Iterable of float
Incoming energies at which distributions exist
Incoming energies in eV at which distributions exist
mu : Iterable of openmc.stats.Univariate
Distribution of scattering cosines corresponding to each incoming energy
Attributes
----------
energy : Iterable of float
Incoming energies at which distributions exist
Incoming energies in eV at which distributions exist
mu : Iterable of openmc.stats.Univariate
Distribution of scattering cosines corresponding to each incoming energy
@ -167,7 +168,7 @@ class AngleDistribution(EqualityMixin):
idx += 1
# Incoming energy grid
energy = ace.xss[idx:idx + n_energies]
energy = ace.xss[idx:idx + n_energies]*EV_PER_MEV
idx += n_energies
# Read locations for angular distributions

View file

@ -9,6 +9,7 @@ from openmc.stats import Tabular, Univariate, Discrete, Mixture, \
Uniform, Legendre
from .function import INTERPOLATION_SCHEME
from .angle_energy import AngleEnergy
from .data import EV_PER_MEV
from .endf import get_list_record, get_tab2_record
@ -328,7 +329,7 @@ class CorrelatedAngleEnergy(AngleEnergy):
# Incoming energies at which distributions exist
idx += 2*n_regions + 1
energy = ace.xss[idx:idx + n_energy_in]
energy = ace.xss[idx:idx + n_energy_in]*EV_PER_MEV
# Location of distributions
idx += n_energy_in
@ -353,12 +354,13 @@ class CorrelatedAngleEnergy(AngleEnergy):
# Secondary energy distribution
n_energy_out = int(ace.xss[idx + 1])
data = ace.xss[idx + 2:idx + 2 + 4*n_energy_out]
data = ace.xss[idx + 2:idx + 2 + 4*n_energy_out].copy()
data.shape = (4, n_energy_out)
data[0,:] *= EV_PER_MEV
# Create continuous distribution
eout_continuous = Tabular(data[0][n_discrete_lines:],
data[1][n_discrete_lines:],
data[1][n_discrete_lines:]/EV_PER_MEV,
INTERPOLATION_SCHEME[intt],
ignore_negative=True)
eout_continuous.c = data[2][n_discrete_lines:]

View file

@ -165,7 +165,10 @@ def atomic_mass(isotope):
return _ATOMIC_MASS.get(isotope.lower())
# The value of the Boltzman constant in units of MeV / K
# The value of the Boltzman constant in units of eV / 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
K_BOLTZMANN = 8.6173324e-5
# Used for converting units in ACE data
EV_PER_MEV = 1.0e6

View file

@ -10,6 +10,7 @@ from .function import Tabulated1D, INTERPOLATION_SCHEME
from openmc.stats.univariate import Univariate, Tabular, Discrete, Mixture
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from .data import EV_PER_MEV
from .endf import get_tab1_record, get_tab2_record
@ -318,13 +319,14 @@ class MaxwellEnergy(EnergyDistribution):
Maxwell distribution
"""
# Read nuclear temperature
# Read nuclear temperature -- since units are MeV, convert to eV
theta = Tabulated1D.from_ace(ace, idx)
theta.y *= EV_PER_MEV
# Restriction energy
nr = int(ace.xss[idx])
ne = int(ace.xss[idx + 1 + 2*nr])
u = ace.xss[idx + 2 + 2*nr + 2*ne]
u = ace.xss[idx + 2 + 2*nr + 2*ne]*EV_PER_MEV
return cls(theta, u)
@ -450,13 +452,14 @@ class Evaporation(EnergyDistribution):
Evaporation spectrum
"""
# Read nuclear temperature
# Read nuclear temperature -- since units are MeV, convert to eV
theta = Tabulated1D.from_ace(ace, idx)
theta.y *= EV_PER_MEV
# Restriction energy
nr = int(ace.xss[idx])
ne = int(ace.xss[idx + 1 + 2*nr])
u = ace.xss[idx + 2 + 2*nr + 2*ne]
u = ace.xss[idx + 2 + 2*nr + 2*ne]*EV_PER_MEV
return cls(theta, u)
@ -597,16 +600,18 @@ class WattEnergy(EnergyDistribution):
Watt fission spectrum
"""
# Energy-dependent a parameter
# Energy-dependent a parameter -- units are MeV, convert to eV
a = Tabulated1D.from_ace(ace, idx)
a.y *= EV_PER_MEV
# Advance index
nr = int(ace.xss[idx])
ne = int(ace.xss[idx + 1 + 2*nr])
idx += 2 + 2*nr + 2*ne
# Energy-dependent b parameter
# Energy-dependent b parameter -- units are MeV^-1
b = Tabulated1D.from_ace(ace, idx)
b.y /= EV_PER_MEV
# Advance index
nr = int(ace.xss[idx])
@ -614,7 +619,7 @@ class WattEnergy(EnergyDistribution):
idx += 2 + 2*nr + 2*ne
# Restriction energy
u = ace.xss[idx]
u = ace.xss[idx]*EV_PER_MEV
return cls(a, b, u)
@ -887,7 +892,7 @@ class DiscretePhoton(EnergyDistribution):
"""
primary_flag = int(ace.xss[idx])
energy = ace.xss[idx + 1]
energy = ace.xss[idx + 1]*EV_PER_MEV
return cls(primary_flag, energy, ace.atomic_weight_ratio)
@ -983,7 +988,8 @@ class LevelInelastic(EnergyDistribution):
Level inelastic scattering distribution
"""
threshold, mass_ratio = ace.xss[idx:idx + 2]
threshold = ace.xss[idx]*EV_PER_MEV
mass_ratio = ace.xss[idx + 1]
return cls(threshold, mass_ratio)
@ -1221,7 +1227,7 @@ class ContinuousTabular(EnergyDistribution):
# Incoming energies at which distributions exist
idx += 2*n_regions + 1
energy = ace.xss[idx:idx + n_energy_in]
energy = ace.xss[idx:idx + n_energy_in]*EV_PER_MEV
# Location of distributions
idx += n_energy_in
@ -1244,12 +1250,13 @@ class ContinuousTabular(EnergyDistribution):
intt = 2
n_energy_out = int(ace.xss[idx + 1])
data = ace.xss[idx + 2:idx + 2 + 3*n_energy_out]
data = ace.xss[idx + 2:idx + 2 + 3*n_energy_out].copy()
data.shape = (3, n_energy_out)
data[0,:] *= EV_PER_MEV
# Create continuous distribution
eout_continuous = Tabular(data[0][n_discrete_lines:],
data[1][n_discrete_lines:],
data[1][n_discrete_lines:]/EV_PER_MEV,
INTERPOLATION_SCHEME[intt])
eout_continuous.c = data[2][n_discrete_lines:]

View file

@ -6,22 +6,20 @@ import sys
import h5py
import numpy as np
from .data import ATOMIC_SYMBOL
from .data import ATOMIC_SYMBOL, EV_PER_MEV
from .endf import get_cont_record, get_list_record, Evaluation
from .function import Function1D, Tabulated1D, Polynomial, Sum
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
def _extract_458_data(ev, units='eV'):
def _extract_458_data(ev):
"""Read an ENDF file and extract the MF=1, MT=458 values.
Parameters
----------
ev : openmc.data.Evaluation
ENDF evaluation
units : {'eV', 'MeV'}
The units that are used in values returned.
Returns
-------
@ -38,7 +36,6 @@ def _extract_458_data(ev, units='eV'):
"""
cv.check_type('evaluation', ev, Evaluation)
cv.check_value('energy units', units, ('eV', 'MeV'))
if not ev.target['fissionable']:
# This nuclide isn't fissionable.
@ -84,17 +81,10 @@ def _extract_458_data(ev, units='eV'):
# If we found the error, reduce all 2nd-order coeffs by 10**6.
if error_present:
for coeffs in value.values(): coeffs[2] *= 1e-6
for coeffs in uncertainty.values(): coeffs[2] *= 1e-6
# Convert eV to MeV.
if units == 'MeV':
for coeffs in value.values():
for i in range(len(coeffs)):
coeffs[i] *= 10**(-6 + 6*i)
for coeffs in uncertainty.values():
for i in range(len(coeffs)):
coeffs[i] *= 10**(-6 + 6*i)
for coeffs in value.values():
coeffs[2] /= EV_PER_MEV
for coeffs in uncertainty.values():
coeffs[2] /= EV_PER_MEV
return value, uncertainty
@ -161,7 +151,7 @@ def write_compact_458_library(endf_files, output_name='fission_Q_data.h5',
continue
# Get the important bits.
data = _extract_458_data(ev, 'MeV')
data = _extract_458_data(ev)
if data is None: continue
value, uncertainty = data
@ -356,7 +346,7 @@ class FissionEnergyRelease(EqualityMixin):
self._neutrinos = energy_release
@classmethod
def _from_dictionary(cls, energy_release, incident_neutron, units='eV'):
def _from_dictionary(cls, energy_release, incident_neutron):
"""Generate fission energy release data from a dictionary.
Parameters
@ -368,8 +358,6 @@ class FissionEnergyRelease(EqualityMixin):
data, more for polynomial data.
incident_neutron : openmc.data.IncidentNeutron
Corresponding incident neutron dataset
units : {'eV', 'MeV'}
The energy units used in the returned object.
Returns
-------
@ -377,8 +365,6 @@ class FissionEnergyRelease(EqualityMixin):
Fission energy release data
"""
cv.check_value('energy units', units, ('eV', 'MeV'))
out = cls()
# How many coefficients are given for each component? If we only find
@ -429,28 +415,24 @@ class FissionEnergyRelease(EqualityMixin):
raise ValueError('Ambiguous prompt/total nu value.')
nu = nu[0]
if units == 'eV':
nu_const = 8.07e6
else:
nu_const = 8.07
if isinstance(nu, Tabulated1D):
ENP = deepcopy(nu)
ENP.y = (energy_release['ENP'] + 1.307 * nu.x
- nu_const * (nu.y - nu.y[0]))
- 8.07e6 * (nu.y - nu.y[0]))
elif isinstance(nu, Polynomial):
if len(nu) == 1:
ENP = Polynomial([energy_release['ENP'][0], 1.307])
else:
ENP = Polynomial(
[energy_release['ENP'][0], 1.307 - nu_const*nu.coef[1]]
+ [-nu_const*c for c in nu.coef[2:]])
[energy_release['ENP'][0], 1.307 - 8.07e6*nu.coef[1]]
+ [-8.07e6*c for c in nu.coef[2:]])
out.prompt_neutrons = ENP
return out
@classmethod
def from_endf(cls, ev, incident_neutron, units='eV'):
def from_endf(cls, ev, incident_neutron):
"""Generate fission energy release data from an ENDF file.
Parameters
@ -459,8 +441,6 @@ class FissionEnergyRelease(EqualityMixin):
ENDF evaluation
incident_neutron : openmc.data.IncidentNeutron
Corresponding incident neutron dataset
units : {'eV', 'MeV'}
The energy units used in the returned object.
Returns
-------
@ -484,10 +464,10 @@ class FissionEnergyRelease(EqualityMixin):
raise ValueError('The ENDF evaluation is not fissionable.')
# Read the 458 data from the ENDF file.
value, uncertainty = _extract_458_data(ev, units)
value, uncertainty = _extract_458_data(ev)
# Build the object.
return cls._from_dictionary(value, incident_neutron, units)
return cls._from_dictionary(value, incident_neutron)
@classmethod
def from_hdf5(cls, group):

View file

@ -8,6 +8,7 @@ import numpy as np
import openmc.data
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from .data import EV_PER_MEV
INTERPOLATION_SCHEME = {1: 'histogram', 2: 'linear-linear', 3: 'linear-log',
4: 'log-linear', 5: 'log-log'}
@ -315,7 +316,7 @@ class Tabulated1D(Function1D):
return cls(x, y, breakpoints, interpolation)
@classmethod
def from_ace(cls, ace, idx=0):
def from_ace(cls, ace, idx=0, convert_units=True):
"""Create a Tabulated1D object from an ACE table.
Parameters
@ -324,6 +325,9 @@ class Tabulated1D(Function1D):
An ACE table
idx : int
Offset to read from in XSS array (default of zero)
convert_units : bool
If the abscissa represents energy, indicate whether to convert MeV
to eV.
Returns
-------
@ -348,8 +352,11 @@ class Tabulated1D(Function1D):
# Get (x,y) pairs
idx += 2*n_regions + 1
x = ace.xss[idx:idx + n_pairs]
y = ace.xss[idx + n_pairs:idx + 2*n_pairs]
x = ace.xss[idx:idx + n_pairs].copy()
y = ace.xss[idx + n_pairs:idx + 2*n_pairs].copy()
if convert_units:
x *= EV_PER_MEV
return Tabulated1D(x, y, breakpoints, interpolation)

View file

@ -8,6 +8,7 @@ import openmc.checkvalue as cv
from openmc.stats import Tabular, Univariate, Discrete, Mixture
from .function import Tabulated1D, INTERPOLATION_SCHEME
from .angle_energy import AngleEnergy
from .data import EV_PER_MEV
from .endf import get_list_record, get_tab2_record
@ -290,7 +291,7 @@ class KalbachMann(AngleEnergy):
# Incoming energies at which distributions exist
idx += 2*n_regions + 1
energy = ace.xss[idx:idx + n_energy_in]
energy = ace.xss[idx:idx + n_energy_in]*EV_PER_MEV
# Location of distributions
idx += n_energy_in
@ -315,12 +316,13 @@ class KalbachMann(AngleEnergy):
intt = 2
n_energy_out = int(ace.xss[idx + 1])
data = ace.xss[idx + 2:idx + 2 + 5*n_energy_out]
data = ace.xss[idx + 2:idx + 2 + 5*n_energy_out].copy()
data.shape = (5, n_energy_out)
data[0,:] *= EV_PER_MEV
# Create continuous distribution
eout_continuous = Tabular(data[0][n_discrete_lines:],
data[1][n_discrete_lines:],
data[1][n_discrete_lines:]/EV_PER_MEV,
INTERPOLATION_SCHEME[intt],
ignore_negative=True)
eout_continuous.c = data[2][n_discrete_lines:]

View file

@ -18,7 +18,7 @@ class NBodyPhaseSpace(AngleEnergy):
atomic_weight_ratio : float
Atomic weight ratio of target nuclide
q_value : float
Q value for reaction in MeV or eV, depending on the data source.
Q value for reaction in eV
Attributes
----------
@ -29,7 +29,7 @@ class NBodyPhaseSpace(AngleEnergy):
atomic_weight_ratio : float
Atomic weight ratio of target nuclide
q_value : float
Q value for reaction in MeV or eV, depending on the data source.
Q value for reaction in eV
"""
@ -130,7 +130,7 @@ class NBodyPhaseSpace(AngleEnergy):
Index in XSS array of the start of the energy distribution data
(LDIS + LOCC - 1)
q_value : float
Q-value for reaction in MeV
Q-value for reaction in eV
Returns
-------

View file

@ -10,7 +10,7 @@ import numpy as np
import h5py
from .ace import Table, get_table
from .data import ATOMIC_SYMBOL, K_BOLTZMANN
from .data import ATOMIC_SYMBOL, K_BOLTZMANN, EV_PER_MEV
from .fission_energy import FissionEnergyRelease
from .function import Tabulated1D, Sum, ResonancesWithBackground
from .endf import Evaluation, SUM_RULES
@ -110,7 +110,7 @@ class IncidentNeutron(EqualityMixin):
Atomic mass ratio of the target nuclide.
kTs : Iterable of float
List of temperatures of the target nuclide in the data set.
The temperatures have units of MeV.
The temperatures have units of eV.
Attributes
----------
@ -121,7 +121,7 @@ class IncidentNeutron(EqualityMixin):
atomic_weight_ratio : float
Atomic weight ratio of the target nuclide.
energy : dict of numpy.ndarray
The energy values (MeV) at which reaction cross-sections are tabulated.
The energy values (eV) at which reaction cross-sections are tabulated.
They keys of the dict are the temperature string ('294K') for each
set of energies
fission_energy : None or openmc.data.FissionEnergyRelease
@ -148,7 +148,7 @@ class IncidentNeutron(EqualityMixin):
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.
The temperatures have units of eV.
urr : dict
Dictionary whose keys are temperatures (e.g., '294K') and values are
unresolved resonance region probability tables.
@ -546,7 +546,7 @@ class IncidentNeutron(EqualityMixin):
_get_metadata(int(zaid), metastable_scheme)
# Assign temperature to the running list
kTs = [ace.temperature]
kTs = [ace.temperature*EV_PER_MEV]
data = cls(name, Z, mass_number, metastable,
ace.atomic_weight_ratio, kTs)
@ -556,7 +556,7 @@ class IncidentNeutron(EqualityMixin):
# Read energy grid
n_energy = ace.nxs[3]
energy = ace.xss[ace.jxs[1]:ace.jxs[1] + n_energy]
energy = ace.xss[ace.jxs[1]:ace.jxs[1] + n_energy]*EV_PER_MEV
data.energy[strT] = energy
total_xs = ace.xss[ace.jxs[1] + n_energy:ace.jxs[1] + 2 * n_energy]
absorption_xs = ace.xss[ace.jxs[1] + 2 * n_energy:ace.jxs[1] +

View file

@ -14,7 +14,7 @@ from openmc.stats import Uniform, Tabular, Legendre
from .angle_distribution import AngleDistribution
from .angle_energy import AngleEnergy
from .correlated import CorrelatedAngleEnergy
from .data import ATOMIC_SYMBOL, K_BOLTZMANN
from .data import ATOMIC_SYMBOL, K_BOLTZMANN, EV_PER_MEV
from .endf import get_head_record, get_tab1_record, get_list_record, \
get_tab2_record, get_cont_record
from .energy_distribution import EnergyDistribution, LevelInelastic, \
@ -222,7 +222,9 @@ def _get_fission_products_ace(ace):
if LNU == 1:
# Polynomial function form of nu
NC = int(ace.xss[idx+1])
coefficients = ace.xss[idx+2 : idx+2+NC]
coefficients = ace.xss[idx+2 : idx+2+NC].copy()
for i in range(coefficients.size):
coefficients[i] *= EV_PER_MEV**(-i)
neutron.yield_ = Polynomial(coefficients)
elif LNU == 2:
# Tabular data form of nu
@ -241,7 +243,9 @@ def _get_fission_products_ace(ace):
if LNU == 1:
# Polynomial function form of nu
NC = int(ace.xss[idx+1])
coefficients = ace.xss[idx+2 : idx+2+NC]
coefficients = ace.xss[idx+2 : idx+2+NC].copy()
for i in range(coefficients.size):
coefficients[i] *= EV_PER_MEV**(-i)
prompt_neutron.yield_ = Polynomial(coefficients)
elif LNU == 2:
# Tabular data form of nu
@ -257,7 +261,9 @@ def _get_fission_products_ace(ace):
if LNU == 1:
# Polynomial function form of nu
NC = int(ace.xss[idx+1])
coefficients = ace.xss[idx+2 : idx+2+NC]
coefficients = ace.xss[idx+2 : idx+2+NC].copy()
for i in range(coefficients.size):
coefficients[i] *= EV_PER_MEV**(-i)
total_neutron.yield_ = Polynomial(coefficients)
elif LNU == 2:
# Tabular data form of nu
@ -521,7 +527,7 @@ def _get_photon_products_ace(ace, rx):
threshold_idx = int(ace.xss[idx]) - 1
n_energy = int(ace.xss[idx + 1])
energy = ace.xss[ace.jxs[1] + threshold_idx:
ace.jxs[1] + threshold_idx + n_energy]
ace.jxs[1] + threshold_idx + n_energy]*EV_PER_MEV
# Get photon production cross section
photon_prod_xs = ace.xss[idx + 2:idx + 2 + n_energy]
@ -697,7 +703,7 @@ class Reaction(EqualityMixin):
mt : int
The ENDF MT number for this reaction.
q_value : float
The Q-value of this reaction in MeV or eV, depending on the data source.
The Q-value of this reaction in eV.
xs : dict of str to openmc.data.Function1D
Microscopic cross section for this reaction as a function of incident
energy; these cross sections are provided in a dictionary where the key
@ -861,18 +867,18 @@ class Reaction(EqualityMixin):
def from_ace(cls, ace, i_reaction):
# Get nuclide energy grid
n_grid = ace.nxs[3]
grid = ace.xss[ace.jxs[1]:ace.jxs[1] + n_grid]
grid = ace.xss[ace.jxs[1]:ace.jxs[1] + n_grid]*EV_PER_MEV
# Convert data temperature to a "300.0K" number for indexing
# temperature data
strT = str(int(round(ace.temperature / K_BOLTZMANN))) + "K"
strT = str(int(round(ace.temperature*EV_PER_MEV / K_BOLTZMANN))) + "K"
if i_reaction > 0:
mt = int(ace.xss[ace.jxs[3] + i_reaction - 1])
rx = cls(mt)
# Get Q-value of reaction
rx.q_value = ace.xss[ace.jxs[4] + i_reaction - 1]
rx.q_value = ace.xss[ace.jxs[4] + i_reaction - 1]*EV_PER_MEV
# ==================================================================
# CROSS SECTION

View file

@ -8,7 +8,7 @@ import h5py
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from .data import K_BOLTZMANN, ATOMIC_SYMBOL
from .data import K_BOLTZMANN, ATOMIC_SYMBOL, EV_PER_MEV
from .ace import Table, get_table
from .angle_energy import AngleEnergy
from .function import Tabulated1D
@ -69,14 +69,14 @@ class CoherentElastic(EqualityMixin):
Parameters
----------
bragg_edges : Iterable of float
Bragg edge energies in MeV
Bragg edge energies in eV
factors : Iterable of float
Partial sum of structure factors, :math:`\sum\limits_{i=1}^{E_i<E} S_i`
Attributes
----------
bragg_edges : Iterable of float
Bragg edge energies in MeV
Bragg edge energies in eV
factors : Iterable of float
Partial sum of structure factors, :math:`\sum\limits_{i=1}^{E_i<E} S_i`
@ -161,7 +161,7 @@ class ThermalScattering(EqualityMixin):
Atomic mass ratio of the target nuclide.
kTs : Iterable of float
List of temperatures of the target nuclide in the data set.
The temperatures have units of MeV.
The temperatures have units of eV.
Attributes
----------
@ -181,7 +181,7 @@ class ThermalScattering(EqualityMixin):
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.
The temperatures have units of eV.
nuclides : Iterable of str
Nuclide names that the thermal scattering data applies to
@ -426,15 +426,16 @@ class ThermalScattering(EqualityMixin):
'Assigning a name of {}.'.format(ace.name, name))
# Assign temperature to the running list
kTs = [ace.temperature]
temperatures = [str(int(round(ace.temperature / K_BOLTZMANN))) + "K"]
kTs = [ace.temperature*EV_PER_MEV]
temperatures = [str(int(round(ace.temperature*EV_PER_MEV
/ K_BOLTZMANN))) + "K"]
table = cls(name, ace.atomic_weight_ratio, kTs)
# Incoherent inelastic scattering cross section
idx = ace.jxs[1]
n_energy = int(ace.xss[idx])
energy = ace.xss[idx+1 : idx+1+n_energy]
energy = ace.xss[idx+1 : idx+1+n_energy]*EV_PER_MEV
xs = ace.xss[idx+1+n_energy : idx+1+2*n_energy]
table.inelastic_xs[temperatures[0]] = Tabulated1D(energy, xs)
@ -451,7 +452,7 @@ class ThermalScattering(EqualityMixin):
idx = ace.jxs[3]
table.inelastic_e_out[temperatures[0]] = \
ace.xss[idx:idx + n_energy * n_energy_out * (n_mu + 2):
n_mu + 2]
n_mu + 2]*EV_PER_MEV
table.inelastic_e_out[temperatures[0]].shape = \
(n_energy, n_energy_out)
@ -474,9 +475,9 @@ class ThermalScattering(EqualityMixin):
# Outgoing energy distribution for incoming energy i
e = ace.xss[idx + 1:idx + 1 + n_energy_out[i]*(n_mu + 3):
n_mu + 3]
n_mu + 3]*EV_PER_MEV
p = ace.xss[idx + 2:idx + 2 + n_energy_out[i]*(n_mu + 3):
n_mu + 3]
n_mu + 3]/EV_PER_MEV
c = ace.xss[idx + 3:idx + 3 + n_energy_out[i]*(n_mu + 3):
n_mu + 3]
eout_i = Tabular(e, p, 'linear-linear', ignore_negative=True)
@ -507,11 +508,12 @@ class ThermalScattering(EqualityMixin):
idx = ace.jxs[4]
if idx != 0:
n_energy = int(ace.xss[idx])
energy = ace.xss[idx + 1: idx + 1 + n_energy]
energy = ace.xss[idx + 1: idx + 1 + n_energy]*EV_PER_MEV
P = ace.xss[idx + 1 + n_energy: idx + 1 + 2 * n_energy]
if ace.nxs[5] == 4:
table.elastic_xs[temperatures[0]] = CoherentElastic(energy, P)
table.elastic_xs[temperatures[0]] = CoherentElastic(
energy, P*EV_PER_MEV)
else:
table.elastic_xs[temperatures[0]] = Tabulated1D(energy, P)

View file

@ -5,6 +5,7 @@ import numpy as np
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from .data import EV_PER_MEV
class ProbabilityTables(EqualityMixin):
@ -13,7 +14,7 @@ class ProbabilityTables(EqualityMixin):
Parameters
----------
energy : Iterable of float
Energies in MeV at which probability tables exist
Energies in eV at which probability tables exist
table : numpy.ndarray
Probability tables for each energy. This array is of shape (N, 6, M)
where N is the number of energies and M is the number of bands. The
@ -40,7 +41,7 @@ class ProbabilityTables(EqualityMixin):
Attributes
----------
energy : Iterable of float
Energies in MeV at which probability tables exist
Energies in eV at which probability tables exist
table : numpy.ndarray
Probability tables for each energy. This array is of shape (N, 6, M)
where N is the number of energies and M is the number of bands. The
@ -200,12 +201,15 @@ class ProbabilityTables(EqualityMixin):
idx += 6
# Get energies at which tables exist
energy = ace.xss[idx : idx+N]
energy = ace.xss[idx : idx+N]*EV_PER_MEV
idx += N
# Get probability tables
table = ace.xss[idx : idx+N*6*M]
table = ace.xss[idx : idx+N*6*M].copy()
table.shape = (N, 6, M)
# Convert units on heating numbers
table[:,5,:] *= EV_PER_MEV
return cls(energy, table, interpolation, inelastic_flag,
absorption_flag, multiply_smooth)

View file

@ -780,12 +780,12 @@ class EnergyFilter(Filter):
Parameters
----------
bins : Iterable of Real
A grid of energy values (in MeV).
A grid of energy values in eV.
Attributes
----------
bins : Iterable of Real
A grid of energy values (in MeV).
A grid of energy values in eV.
num_bins : Integral
The number of filter bins
stride : Integral
@ -930,8 +930,8 @@ class EnergyFilter(Filter):
hi_bins = np.tile(hi_bins, tile_factor)
# Add the new energy columns to the DataFrame.
df.loc[:, self.short_name.lower() + ' low [MeV]'] = lo_bins
df.loc[:, self.short_name.lower() + ' high [MeV]'] = hi_bins
df.loc[:, self.short_name.lower() + ' low [eV]'] = lo_bins
df.loc[:, self.short_name.lower() + ' high [eV]'] = hi_bins
return df
@ -942,12 +942,12 @@ class EnergyoutFilter(EnergyFilter):
Parameters
----------
bins : Iterable of Real
A grid of energy values (in MeV).
A grid of energy values in eV.
Attributes
----------
bins : Iterable of Real
A grid of energy values (in MeV).
A grid of energy values in eV.
num_bins : Integral
The number of filter bins
stride : Integral

View file

@ -14,12 +14,12 @@ class EnergyGroups(object):
Parameters
----------
group_edges : Iterable of Real
The energy group boundaries [MeV]
The energy group boundaries [eV]
Attributes
----------
group_edges : Iterable of Real
The energy group boundaries [MeV]
The energy group boundaries [eV]
num_groups : int
The number of energy groups
@ -83,7 +83,7 @@ class EnergyGroups(object):
Parameters
----------
energy : float
The energy of interest in MeV
The energy of interest in eV
Returns
-------
@ -98,7 +98,7 @@ class EnergyGroups(object):
"""
if self.group_edges is None:
msg = 'Unable to get energy group for energy "{0}" MeV since ' \
msg = 'Unable to get energy group for energy "{0}" eV since ' \
'the group edges have not yet been set'.format(energy)
raise ValueError(msg)
@ -117,7 +117,7 @@ class EnergyGroups(object):
Returns
-------
2-tuple
The low and high energy bounds for the group in MeV
The low and high energy bounds for the group in eV
Raises
------

View file

@ -599,7 +599,7 @@ class MDGXS(MGXS):
string += template.format('', delayed_group)
string += '\n'
template = '{0: <12}Group {1} [{2: <10} - {3: <10}MeV]:\t'
template = '{0: <12}Group {1} [{2: <10} - {3: <10}eV]:\t'
# Loop over energy groups ranges
for group in range(1, self.num_groups+1):
@ -784,36 +784,36 @@ class MDGXS(MGXS):
# Override energy groups bounds with indices
all_groups = np.arange(self.num_groups, 0, -1, dtype=np.int)
all_groups = np.repeat(all_groups, len(query_nuclides))
if 'energy low [MeV]' in df and 'energyout low [MeV]' in df:
df.rename(columns={'energy low [MeV]': 'group in'},
if 'energy low [eV]' in df and 'energyout low [eV]' in df:
df.rename(columns={'energy low [eV]': 'group in'},
inplace=True)
in_groups = np.tile(all_groups, int(self.num_subdomains *
self.num_delayed_groups))
in_groups = np.repeat(in_groups, int(df.shape[0] / in_groups.size))
df['group in'] = in_groups
del df['energy high [MeV]']
del df['energy high [eV]']
df.rename(columns={'energyout low [MeV]': 'group out'},
df.rename(columns={'energyout low [eV]': 'group out'},
inplace=True)
out_groups = np.repeat(all_groups, self.xs_tally.num_scores)
out_groups = np.tile(out_groups, int(df.shape[0] / out_groups.size))
df['group out'] = out_groups
del df['energyout high [MeV]']
del df['energyout high [eV]']
columns = ['group in', 'group out']
elif 'energyout low [MeV]' in df:
df.rename(columns={'energyout low [MeV]': 'group out'},
elif 'energyout low [eV]' in df:
df.rename(columns={'energyout low [eV]': 'group out'},
inplace=True)
in_groups = np.tile(all_groups, int(df.shape[0] / all_groups.size))
df['group out'] = in_groups
del df['energyout high [MeV]']
del df['energyout high [eV]']
columns = ['group out']
elif 'energy low [MeV]' in df:
df.rename(columns={'energy low [MeV]': 'group in'}, inplace=True)
elif 'energy low [eV]' in df:
df.rename(columns={'energy low [eV]': 'group in'}, inplace=True)
in_groups = np.tile(all_groups, int(df.shape[0] / all_groups.size))
df['group in'] = in_groups
del df['energy high [MeV]']
del df['energy high [eV]']
columns = ['group in']
# Select out those groups the user requested

View file

@ -1214,7 +1214,7 @@ class MGXS(object):
# Build header for cross section type
string += '{0: <16}\n'.format(xs_header)
template = '{0: <12}Group {1} [{2: <10} - {3: <10}MeV]:\t'
template = '{0: <12}Group {1} [{2: <10} - {3: <10}eV]:\t'
# Loop over energy groups ranges
for group in range(1, self.num_groups+1):
@ -1526,35 +1526,35 @@ class MGXS(object):
# Override energy groups bounds with indices
all_groups = np.arange(self.num_groups, 0, -1, dtype=np.int)
all_groups = np.repeat(all_groups, len(query_nuclides))
if 'energy low [MeV]' in df and 'energyout low [MeV]' in df:
df.rename(columns={'energy low [MeV]': 'group in'},
if 'energy low [eV]' in df and 'energyout low [eV]' in df:
df.rename(columns={'energy low [eV]': 'group in'},
inplace=True)
in_groups = np.tile(all_groups, int(self.num_subdomains))
in_groups = np.repeat(in_groups, int(df.shape[0] / in_groups.size))
df['group in'] = in_groups
del df['energy high [MeV]']
del df['energy high [eV]']
df.rename(columns={'energyout low [MeV]': 'group out'},
df.rename(columns={'energyout low [eV]': 'group out'},
inplace=True)
out_groups = np.repeat(all_groups, self.xs_tally.num_scores)
out_groups = np.tile(out_groups, int(df.shape[0] / out_groups.size))
df['group out'] = out_groups
del df['energyout high [MeV]']
del df['energyout high [eV]']
columns = ['group in', 'group out']
elif 'energyout low [MeV]' in df:
df.rename(columns={'energyout low [MeV]': 'group out'},
elif 'energyout low [eV]' in df:
df.rename(columns={'energyout low [eV]': 'group out'},
inplace=True)
in_groups = np.tile(all_groups, int(df.shape[0] / all_groups.size))
df['group out'] = in_groups
del df['energyout high [MeV]']
del df['energyout high [eV]']
columns = ['group out']
elif 'energy low [MeV]' in df:
df.rename(columns={'energy low [MeV]': 'group in'}, inplace=True)
elif 'energy low [eV]' in df:
df.rename(columns={'energy low [eV]': 'group in'}, inplace=True)
in_groups = np.tile(all_groups, int(df.shape[0] / all_groups.size))
df['group in'] = in_groups
del df['energy high [MeV]']
del df['energy high [eV]']
columns = ['group in']
# Select out those groups the user requested
@ -1978,7 +1978,7 @@ class MatrixMGXS(MGXS):
return
string += '{0: <16}\n'.format('\tEnergy Groups:')
template = '{0: <12}Group {1} [{2: <10} - {3: <10}MeV]\n'
template = '{0: <12}Group {1} [{2: <10} - {3: <10}eV]\n'
# Loop over energy groups ranges
for group in range(1, self.num_groups + 1):
@ -3844,7 +3844,7 @@ class ScatterMatrixXS(MatrixMGXS):
return
string += '{0: <16}\n'.format('\tEnergy Groups:')
template = '{0: <12}Group {1} [{2: <10} - {3: <10}MeV]\n'
template = '{0: <12}Group {1} [{2: <10} - {3: <10}eV]\n'
# Loop over energy groups ranges
for group in range(1, self.num_groups + 1):

View file

@ -24,7 +24,7 @@ class Particle(object):
weight : float
Weight of the particle
energy : float
Energy of the particle in MeV
Energy of the particle in eV
xyz : list of float
Position of the particle
uvw : list of float

View file

@ -93,7 +93,7 @@ class Settings(object):
should be a float indicating weight cutoff below which particle undergo
Russian roulette. Value for 'weight_avg' should be a float indicating
weight assigned to particles that are not killed after Russian
roulette. Value of energy should be a float indicating energy in MeV
roulette. Value of energy should be a float indicating energy in eV
below which particle will be killed.
entropy_dimension : tuple or list
Number of Shannon entropy mesh cells in the x, y, and z directions,

View file

@ -121,7 +121,7 @@ contains
end if
else
if(.not.allocated(cmfd % egrid)) allocate(cmfd % egrid(2))
cmfd % egrid = [ ZERO, 20.0_8 ]
cmfd % egrid = [ ZERO, energy_max_neutron ]
cmfd % indices(4) = 1 ! one energy group
end if

View file

@ -67,12 +67,12 @@ module constants
PI = 3.1415926535898_8, & ! pi
SQRT_PI = 1.7724538509055_8, & ! square root of pi
MASS_NEUTRON = 1.008664916_8, & ! mass of a neutron in amu
MASS_NEUTRON_MEV = 939.565379_8, & ! mass of a neutron in MeV/c^2
MASS_NEUTRON_EV = 939.565379e6_8, & ! mass of a neutron in eV/c^2
MASS_PROTON = 1.007276466812_8, & ! mass of a proton in amu
AMU = 1.660538921e-27_8, & ! 1 amu in kg
C_LIGHT = 2.99792458e8_8, & ! speed of light in m/s
N_AVOGADRO = 0.602214129_8, & ! Avogadro's number in 10^24/mol
K_BOLTZMANN = 8.6173324e-11_8, & ! Boltzmann constant in MeV/K
K_BOLTZMANN = 8.6173324e-5_8, & ! Boltzmann constant in eV/K
INFINITY = huge(0.0_8), & ! positive infinity
ZERO = 0.0_8, &
HALF = 0.5_8, &

View file

@ -147,15 +147,15 @@ contains
integer :: i_low ! lower logarithmic mapping index
integer :: i_high ! upper logarithmic mapping index
real(8) :: f ! interp factor on nuclide energy grid
real(8) :: kT ! temperature in MeV
real(8) :: kT ! temperature in eV
real(8) :: sigT, sigA, sigF ! Intermediate multipole variables
associate (nuc => nuclides(i_nuclide))
! Check to see if there is multipole data present at this energy
use_mp = .false.
if (nuc % mp_present) then
if (E >= nuc % multipole % start_E/1.0e6_8 .and. &
E <= nuc % multipole % end_E/1.0e6_8) then
if (E >= nuc % multipole % start_E .and. &
E <= nuc % multipole % end_E) then
use_mp = .true.
end if
end if
@ -585,14 +585,13 @@ contains
! sections in the resolved resonance regions
!===============================================================================
subroutine multipole_eval(multipole, Emev, sqrtkT_, sigT, sigA, sigF)
subroutine multipole_eval(multipole, E, sqrtkT, sigT, sigA, sigF)
type(MultipoleArray), intent(in) :: multipole ! The windowed multipole
! object to process.
real(8), intent(in) :: Emev ! The energy at which to
real(8), intent(in) :: E ! The energy at which to
! evaluate the cross section
! in MeV
real(8), intent(in) :: sqrtkT_ ! The temperature in the form
! sqrt(kT (in MeV)), at which
real(8), intent(in) :: sqrtkT ! The temperature in the form
! sqrt(kT), at which
! to evaluate the XS.
real(8), intent(out) :: sigT ! Total cross section
real(8), intent(out) :: sigA ! Absorption cross section
@ -608,8 +607,6 @@ contains
real(8) :: invE ! 1/E, eV
real(8) :: dopp ! sqrt(atomic weight ratio / kT) = 1 / (2 sqrt(xi))
real(8) :: temp ! real temporary value
real(8) :: E ! energy, eV
real(8) :: sqrtkT ! sqrt(kT (in eV))
integer :: i_pole ! index of pole
integer :: i_poly ! index of curvefit
integer :: i_window ! index of window
@ -619,10 +616,6 @@ contains
! ==========================================================================
! Bookkeeping
! Convert to eV.
E = Emev * 1.0e6_8
sqrtkT = sqrtkT_ * 1.0e3_8
! Define some frequently used variables.
sqrtE = sqrt(E)
invE = ONE / E

View file

@ -41,7 +41,7 @@ contains
real(8) :: a, b ! values of x(k)-y and x(k+1)-y
real(8) :: sigma ! broadened cross section at one point
! Determine alpha parameter -- have to convert k to MeV/K
! Determine alpha parameter -- have to convert k to eV/K
alpha = A_target/(K_BOLTZMANN * T)
! Allocate memory for x and assign values

View file

@ -144,7 +144,7 @@ module geometry_header
integer :: distribcell_index ! Index corresponding to this cell in
! distribcell arrays
real(8), allocatable :: sqrtkT(:) ! Square root of k_Boltzmann *
! temperature in MeV. Multiple for
! temperature in eV. Multiple for
! distribcell
! Rotation matrix and translation vector

View file

@ -612,8 +612,8 @@ contains
allocate(Watt :: external_source(i)%energy)
select type(energy => external_source(i)%energy)
type is (Watt)
energy%a = 0.988_8
energy%b = 2.249_8
energy%a = 0.988e6_8
energy%b = 2.249e-6_8
end select
end if
end if
@ -4994,7 +4994,7 @@ contains
if (nuclides(i) % grid(1) % energy(size(nuclides(i) % grid(1) % energy)) &
== energy_max_neutron) then
call write_message("Maximum neutron transport energy: " // &
trim(to_str(energy_max_neutron)) // " MeV for " // &
trim(to_str(energy_max_neutron)) // " eV for " // &
trim(adjustl(nuclides(i) % name)), 6)
exit
end if

View file

@ -200,7 +200,7 @@ contains
end subroutine create_macro_xs
!===============================================================================
! GET_MAT_kTs returns a list of temperatures (in MeV) that each
! GET_MAT_kTs returns a list of temperatures (in eV) that each
! material appears at in the model.
!===============================================================================
@ -209,7 +209,7 @@ contains
integer :: i, j
integer :: i_material ! Index in materials array
real(8) :: kT ! temperature in MeV
real(8) :: kT ! temperature in eV
allocate(kTs(size(materials)))

View file

@ -53,7 +53,7 @@ module mgxs_header
type, abstract :: Mgxs
character(len=MAX_WORD_LEN) :: name ! name of dataset, e.g. UO2
real(8) :: awr ! Atomic Weight Ratio
real(8), allocatable :: kTs(:) ! temperature in MeV (k*T)
real(8), allocatable :: kTs(:) ! temperature in eV (k*T)
! Fission information
logical :: fissionable ! mgxs object is fissionable?
@ -242,7 +242,7 @@ module mgxs_header
do i = 1, size(dset_names)
! Read temperature value
call read_dataset(temps_available(i), kT_group, trim(dset_names(i)))
! Convert MeV to Kelvin
! Convert eV to Kelvin
temps_available(i) = temps_available(i) / K_BOLTZMANN
end do
call sort(temps_available)
@ -1239,7 +1239,7 @@ module mgxs_header
subroutine mgxsiso_combine(this, temps, mat, nuclides, groups, max_order, &
tolerance, method)
class(MgxsIso), intent(inout) :: this ! The Mgxs to initialize
type(VectorReal), intent(in) :: temps ! Temperatures to obtain [MeV]
type(VectorReal), intent(in) :: temps ! Temperatures to obtain [eV]
type(Material), pointer, intent(in) :: mat ! base material
type(MgxsContainer), intent(in) :: nuclides(:) ! List of nuclides to harvest from
integer, intent(in) :: groups ! Number of E groups
@ -2079,12 +2079,12 @@ module mgxs_header
!===============================================================================
! MGXS_FIND_TEMPERATURE sets the temperature index for the given
! sqrt(temperature), (with temperature in units of MeV)
! sqrt(temperature), (with temperature in units of eV)
!===============================================================================
subroutine mgxs_find_temperature(this, sqrtkT)
class(Mgxs), intent(inout) :: this
real(8), intent(in) :: sqrtkT ! Temperature (in units of of MeV)
real(8), intent(in) :: sqrtkT ! Temperature (in units of eV)
this % index_temp = minloc(abs(this % kTs - (sqrtkT * sqrtkT)), dim=1)

View file

@ -53,7 +53,7 @@ module nuclide_header
integer :: A ! mass number
integer :: metastable ! metastable state
real(8) :: awr ! Atomic Weight Ratio
real(8), allocatable :: kTs(:) ! temperature in MeV (k*T)
real(8), allocatable :: kTs(:) ! temperature in eV (k*T)
! Fission information
logical :: fissionable = .false. ! nuclide is fissionable?
@ -115,8 +115,8 @@ module nuclide_header
type Nuclide0K
character(10) :: nuclide ! name of nuclide, e.g. U238
character(16) :: scheme = 'ares' ! target velocity sampling scheme
real(8) :: E_min = 0.01e-6_8 ! lower cutoff energy for res scattering
real(8) :: E_max = 1000.0e-6_8 ! upper cutoff energy for res scattering
real(8) :: E_min = 0.01_8 ! lower cutoff energy for res scattering
real(8) :: E_max = 1000.0_8 ! upper cutoff energy for res scattering
end type Nuclide0K
!===============================================================================
@ -146,7 +146,7 @@ module nuclide_header
! Information for Doppler broadening
real(8) :: last_sqrtkT = ZERO ! Last temperature in sqrt(Boltzmann
! constant * temperature (MeV))
! constant * temperature (eV))
end type NuclideMicroXS
!===============================================================================

View file

@ -87,7 +87,7 @@ module particle_header
integer :: last_material ! index for last material
! Temperature of the current cell
real(8) :: sqrtkT ! sqrt(k_Boltzmann * temperature) in MeV
real(8) :: sqrtkT ! sqrt(k_Boltzmann * temperature) in eV
real(8) :: last_sqrtKT ! last temperature
! Statistical data

View file

@ -47,7 +47,7 @@ contains
if (verbosity >= 10 .or. trace) then
call write_message(" " // trim(reaction_name(p % event_MT)) &
&// " with " // trim(adjustl(nuclides(p % event_nuclide) % name)) &
&// ". Energy = " // trim(to_str(p % E * 1e6_8)) // " eV.")
&// ". Energy = " // trim(to_str(p % E)) // " eV.")
end if
! check for very low energy
@ -230,8 +230,8 @@ contains
! Check to see if we are in a windowed multipole range. WMP only supports
! the first fission reaction.
if (nuc % mp_present) then
if (E >= nuc % multipole % start_E/1.0e6_8 .and. &
E <= nuc % multipole % end_E/1.0e6_8) then
if (E >= nuc % multipole % start_E .and. &
E <= nuc % multipole % end_E) then
i_reaction = nuc % index_fission(1)
return
end if
@ -322,7 +322,7 @@ contains
real(8) :: uvw_new(3) ! outgoing uvw for iso-in-lab scattering
real(8) :: uvw_old(3) ! incoming uvw for iso-in-lab scattering
real(8) :: phi ! azimuthal angle for iso-in-lab scattering
real(8) :: kT ! temperature in MeV
real(8) :: kT ! temperature in eV
type(Nuclide), pointer :: nuc
! copy incoming direction
@ -436,7 +436,7 @@ contains
subroutine elastic_scatter(i_nuclide, rxn, kT, E, uvw, mu_lab, wgt)
integer, intent(in) :: i_nuclide
type(Reaction), intent(in) :: rxn
real(8), intent(in) :: kT ! temperature in MeV
real(8), intent(in) :: kT ! temperature in eV
real(8), intent(inout) :: E
real(8), intent(inout) :: uvw(3)
real(8), intent(out) :: mu_lab
@ -785,7 +785,7 @@ contains
real(8), intent(in) :: v_neut(3) ! neutron velocity
real(8), intent(inout) :: wgt ! particle weight
real(8), intent(in) :: xs_eff ! effective elastic xs at temperature T
real(8), intent(in) :: kT ! equilibrium temperature of target in MeV
real(8), intent(in) :: kT ! equilibrium temperature of target in eV
real(8) :: awr ! target/neutron mass ratio
real(8) :: E_rel ! trial relative energy
@ -1026,7 +1026,7 @@ contains
real(8), intent(out) :: v_target(3)
real(8), intent(in) :: E
real(8), intent(in) :: uvw(3)
real(8), intent(in) :: kT ! equilibrium temperature of target in MeV
real(8), intent(in) :: kT ! equilibrium temperature of target in eV
real(8) :: awr ! target/neutron mass ratio
real(8) :: alpha ! probability of sampling f2 over f1

View file

@ -68,7 +68,7 @@ module sab_header
type SAlphaBeta
character(150) :: name ! name of table, e.g. lwtr.10t
real(8) :: awr ! weight of nucleus in neutron masses
real(8), allocatable :: kTs(:) ! temperatures in MeV (k*T)
real(8), allocatable :: kTs(:) ! temperatures in eV (k*T)
character(10), allocatable :: nuclides(:) ! List of valid nuclides
integer :: secondary_mode ! secondary mode (equal/skewed/continuous)

View file

@ -186,12 +186,12 @@ contains
! Score the flux weighted inverse velocity with velocity in units of
! cm/s
score = score / material_xs % total &
/ (sqrt(TWO * E / (MASS_NEUTRON_MEV)) * C_LIGHT * 100.0_8) * flux
/ (sqrt(TWO * E / MASS_NEUTRON_EV) * C_LIGHT * 100.0_8) * flux
else
! For inverse velocity, we don't need a cross section. The velocity is
! in units of cm/s.
score = flux / (sqrt(TWO * E / (MASS_NEUTRON_MEV)) * C_LIGHT * 100.0_8)
score = flux / (sqrt(TWO * E / MASS_NEUTRON_EV) * C_LIGHT * 100.0_8)
end if