2017-01-28 11:34:29 -05:00
|
|
|
import copy
|
2015-11-15 15:03:23 -05:00
|
|
|
from numbers import Real, Integral
|
|
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
import h5py
|
2020-04-06 15:16:09 -05:00
|
|
|
import numpy as np
|
2024-06-11 21:56:31 -05:00
|
|
|
import scipy.integrate
|
2020-04-06 15:16:09 -05:00
|
|
|
from scipy.interpolate import interp1d
|
2017-06-02 06:41:20 -05:00
|
|
|
from scipy.special import eval_legendre
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
import openmc
|
2016-04-30 16:08:47 -04:00
|
|
|
import openmc.mgxs
|
2020-04-01 10:48:03 -05:00
|
|
|
from openmc.mgxs import SCATTER_TABULAR, SCATTER_LEGENDRE, SCATTER_HISTOGRAM
|
2020-04-06 15:16:09 -05:00
|
|
|
from .checkvalue import check_type, check_value, check_greater_than, \
|
2025-10-20 18:45:14 +02:00
|
|
|
check_iterable_type, check_less_than, check_filetype_version, PathLike
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
ROOM_TEMPERATURE_KELVIN = 294.0
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2016-01-09 05:43:28 -05:00
|
|
|
# Supported incoming particle MGXS angular treatment representations
|
2020-03-23 14:56:14 -05:00
|
|
|
REPRESENTATION_ISOTROPIC = 'isotropic'
|
|
|
|
|
REPRESENTATION_ANGLE = 'angle'
|
2024-06-19 15:48:34 +01:00
|
|
|
_REPRESENTATIONS = {
|
2020-03-23 14:56:14 -05:00
|
|
|
REPRESENTATION_ISOTROPIC,
|
|
|
|
|
REPRESENTATION_ANGLE
|
2024-06-19 15:48:34 +01:00
|
|
|
}
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2017-01-29 15:25:00 -05:00
|
|
|
# Supported scattering angular distribution representations
|
2024-06-19 15:48:34 +01:00
|
|
|
_SCATTER_TYPES = {
|
2020-03-23 14:56:14 -05:00
|
|
|
SCATTER_TABULAR,
|
|
|
|
|
SCATTER_LEGENDRE,
|
|
|
|
|
SCATTER_HISTOGRAM
|
2024-06-19 15:48:34 +01:00
|
|
|
}
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2017-01-29 15:25:00 -05:00
|
|
|
# Number of mu points for conversion between scattering formats
|
|
|
|
|
_NMU = 257
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2017-03-18 10:13:16 -04:00
|
|
|
# Filetype name of the MGXS Library
|
|
|
|
|
_FILETYPE_MGXS_LIBRARY = 'mgxs'
|
|
|
|
|
|
|
|
|
|
# Current version of the MGXS Library Format
|
|
|
|
|
_VERSION_MGXS_LIBRARY = 1
|
|
|
|
|
|
2016-09-10 11:28:08 -04:00
|
|
|
|
2020-03-19 15:21:15 -05:00
|
|
|
class XSdata:
|
2016-01-07 20:20:55 -05:00
|
|
|
"""A multi-group cross section data set providing all the
|
2015-11-15 15:03:23 -05:00
|
|
|
multi-group data necessary for a multi-group OpenMC calculation.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-03 13:09:55 -04:00
|
|
|
name : str
|
2015-11-15 15:03:23 -05:00
|
|
|
Name of the mgxs data set.
|
2016-03-25 13:17:49 -05:00
|
|
|
energy_groups : openmc.mgxs.EnergyGroups
|
2016-09-19 20:44:06 -04:00
|
|
|
Energy group structure
|
2020-03-25 07:10:35 -05:00
|
|
|
representation : {'isotropic', 'angle'}, optional
|
2015-11-15 15:03:23 -05:00
|
|
|
Method used in generating the MGXS (isotropic or angle-dependent flux
|
|
|
|
|
weighting). Defaults to 'isotropic'
|
2016-10-10 15:19:47 -04:00
|
|
|
temperatures : Iterable of float
|
2016-09-03 13:09:55 -04:00
|
|
|
Temperatures (in units of Kelvin) of the provided datasets. Defaults
|
2016-09-04 15:40:02 -04:00
|
|
|
to a single temperature at 294K.
|
2016-10-18 23:11:17 -04:00
|
|
|
num_delayed_groups : int
|
2016-10-13 14:38:06 -04:00
|
|
|
Number of delayed groups
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
Attributes
|
|
|
|
|
----------
|
|
|
|
|
name : str
|
|
|
|
|
Unique identifier for the xsdata object
|
2016-11-29 18:46:09 -05:00
|
|
|
atomic_weight_ratio : float
|
2016-05-15 14:56:00 -04:00
|
|
|
Atomic weight ratio of an isotope. That is, the ratio of the mass
|
2016-05-10 04:45:02 -04:00
|
|
|
of the isotope to the mass of a single neutron.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperatures : numpy.ndarray
|
|
|
|
|
Temperatures (in units of Kelvin) of the provided datasets. Defaults
|
2016-09-04 15:40:02 -04:00
|
|
|
to a single temperature at 294K.
|
2016-03-25 13:17:49 -05:00
|
|
|
energy_groups : openmc.mgxs.EnergyGroups
|
2015-11-15 15:03:23 -05:00
|
|
|
Energy group structure
|
2016-10-18 23:11:17 -04:00
|
|
|
num_delayed_groups : int
|
2016-10-13 14:38:06 -04:00
|
|
|
Num delayed groups
|
2016-03-25 13:17:49 -05:00
|
|
|
fissionable : bool
|
2015-11-15 15:03:23 -05:00
|
|
|
Whether or not this is a fissionable data set.
|
2016-09-19 20:44:06 -04:00
|
|
|
scatter_format : {'legendre', 'histogram', or 'tabular'}
|
2015-11-15 15:03:23 -05:00
|
|
|
Angular distribution representation (legendre, histogram, or tabular)
|
|
|
|
|
order : int
|
|
|
|
|
Either the Legendre order, number of bins, or number of points used to
|
|
|
|
|
describe the angular distribution associated with each group-to-group
|
|
|
|
|
transfer probability.
|
2020-03-25 07:10:35 -05:00
|
|
|
representation : {'isotropic', 'angle'}
|
2016-05-11 21:19:30 -04:00
|
|
|
Method used in generating the MGXS (isotropic or angle-dependent flux
|
|
|
|
|
weighting).
|
2016-03-25 13:17:49 -05:00
|
|
|
num_azimuthal : int
|
|
|
|
|
Number of equal width angular bins that the azimuthal angular domain is
|
2016-10-10 15:19:47 -04:00
|
|
|
subdivided into. This only applies when :attr:`XSdata.representation`
|
|
|
|
|
is "angle".
|
2016-03-25 13:17:49 -05:00
|
|
|
num_polar : int
|
|
|
|
|
Number of equal width angular bins that the polar angular domain is
|
2016-10-10 15:19:47 -04:00
|
|
|
subdivided into. This only applies when :attr:`XSdata.representation`
|
|
|
|
|
is "angle".
|
2016-11-30 19:48:30 -05:00
|
|
|
total : list of numpy.ndarray
|
2016-09-19 20:44:06 -04:00
|
|
|
Group-wise total cross section.
|
2016-11-30 19:48:30 -05:00
|
|
|
absorption : list of numpy.ndarray
|
2016-09-19 20:44:06 -04:00
|
|
|
Group-wise absorption cross section.
|
2016-11-30 19:48:30 -05:00
|
|
|
scatter_matrix : list of numpy.ndarray
|
2016-03-25 13:17:49 -05:00
|
|
|
Scattering moment matrices presented with the columns representing
|
|
|
|
|
incoming group and rows representing the outgoing group. That is,
|
2016-09-19 20:44:06 -04:00
|
|
|
down-scatter will be above the diagonal of the resultant matrix.
|
2016-11-30 19:48:30 -05:00
|
|
|
multiplicity_matrix : list of numpy.ndarray
|
2016-03-25 13:17:49 -05:00
|
|
|
Ratio of neutrons produced in scattering collisions to the neutrons
|
|
|
|
|
which undergo scattering collisions; that is, the multiplicity provides
|
2016-04-30 16:08:47 -04:00
|
|
|
the code with a scaling factor to account for neutrons produced in
|
2016-09-19 20:44:06 -04:00
|
|
|
(n,xn) reactions.
|
2016-11-30 19:48:30 -05:00
|
|
|
fission : list of numpy.ndarray
|
2016-09-19 20:44:06 -04:00
|
|
|
Group-wise fission cross section.
|
2016-11-30 19:48:30 -05:00
|
|
|
kappa_fission : list of numpy.ndarray
|
2016-10-14 14:26:33 -04:00
|
|
|
Group-wise kappa_fission cross section.
|
2016-11-30 19:48:30 -05:00
|
|
|
chi : list of numpy.ndarray
|
2016-04-30 16:08:47 -04:00
|
|
|
Group-wise fission spectra ordered by increasing group index (i.e.,
|
2016-09-19 20:44:06 -04:00
|
|
|
fast to thermal). This attribute should be used if making the common
|
2016-03-25 13:17:49 -05:00
|
|
|
approximation that the fission spectra does not depend on incoming
|
2016-09-19 20:44:06 -04:00
|
|
|
energy. If the user does not wish to make this approximation, then
|
2016-04-30 16:08:47 -04:00
|
|
|
this should not be provided and this information included in the
|
2016-10-10 15:19:47 -04:00
|
|
|
:attr:`XSdata.nu_fission` attribute instead.
|
2016-11-30 19:48:30 -05:00
|
|
|
chi_prompt : list of numpy.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Group-wise prompt fission spectra ordered by increasing group index
|
|
|
|
|
(i.e., fast to thermal). This attribute should be used if chi from
|
|
|
|
|
prompt and delayed neutrons is being set separately.
|
2016-11-30 19:48:30 -05:00
|
|
|
chi_delayed : list of numpy.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Group-wise delayed fission spectra ordered by increasing group index
|
|
|
|
|
(i.e., fast to thermal). This attribute should be used if chi from
|
|
|
|
|
prompt and delayed neutrons is being set separately.
|
2016-11-30 19:48:30 -05:00
|
|
|
nu_fission : list of numpy.ndarray
|
2016-03-25 13:17:49 -05:00
|
|
|
Group-wise fission production cross section vector (i.e., if ``chi`` is
|
2016-09-19 20:44:06 -04:00
|
|
|
provided), or is the group-wise fission production matrix.
|
2016-11-30 19:48:30 -05:00
|
|
|
prompt_nu_fission : list of numpy.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Group-wise prompt fission production cross section vector.
|
2016-11-30 19:48:30 -05:00
|
|
|
delayed_nu_fission : list of numpy.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Group-wise delayed fission production cross section vector.
|
2016-11-30 19:48:30 -05:00
|
|
|
beta : list of numpy.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Delayed-group-wise delayed neutron fraction cross section vector.
|
2016-11-30 19:48:30 -05:00
|
|
|
decay_rate : list of numpy.ndarray
|
2016-10-19 10:54:48 -04:00
|
|
|
Delayed-group-wise decay rate vector.
|
2016-11-30 19:48:30 -05:00
|
|
|
inverse_velocity : list of numpy.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Inverse of velocity, in units of sec/cm.
|
2016-10-19 10:45:57 -04:00
|
|
|
xs_shapes : dict of iterable of int
|
|
|
|
|
Dictionary with keys of _XS_SHAPES and iterable of int values with the
|
|
|
|
|
corresponding shapes where "Order" corresponds to the pn scattering
|
|
|
|
|
order, "G" corresponds to incoming energy group, "G'" corresponds to
|
|
|
|
|
outgoing energy group, and "DG" corresponds to delayed group.
|
2016-09-19 20:44:06 -04:00
|
|
|
|
|
|
|
|
Notes
|
|
|
|
|
-----
|
|
|
|
|
The parameters containing cross section data have dimensionalities which
|
2016-10-10 15:19:47 -04:00
|
|
|
depend upon the value of :attr:`XSdata.representation` as well as the
|
|
|
|
|
number of Legendre or other angular dimensions as described by
|
2016-10-19 10:45:57 -04:00
|
|
|
:attr:`XSdata.order`. The :attr:`XSdata.xs_shapes` are provided to obtain
|
|
|
|
|
the dimensionality of the data for each temperature.
|
2016-09-19 20:44:06 -04:00
|
|
|
|
2016-10-19 10:45:57 -04:00
|
|
|
The following are cross sections which should use each of the properties.
|
|
|
|
|
Note that some cross sections can be input in more than one shape so they
|
|
|
|
|
are listed multiple times:
|
2016-09-19 20:44:06 -04:00
|
|
|
|
2016-11-13 13:29:45 -05:00
|
|
|
[G][G'][Order]: scatter_matrix
|
2016-10-19 10:45:57 -04:00
|
|
|
|
|
|
|
|
[G]: total, absorption, fission, kappa_fission, nu_fission,
|
2016-11-07 08:07:58 -05:00
|
|
|
prompt_nu_fission, delayed_nu_fission, inverse_velocity
|
2016-10-19 10:45:57 -04:00
|
|
|
|
|
|
|
|
[G']: chi, chi_prompt, chi_delayed
|
|
|
|
|
|
2016-10-24 10:44:45 -04:00
|
|
|
[G][G']: multiplicity_matrix, nu_fission, prompt_nu_fission
|
2016-10-19 10:45:57 -04:00
|
|
|
|
|
|
|
|
[DG]: beta, decay_rate
|
|
|
|
|
|
2016-12-15 20:23:07 +00:00
|
|
|
[DG][G]: delayed_nu_fission, beta, decay_rate
|
2016-10-19 10:45:57 -04:00
|
|
|
|
2016-12-15 20:23:07 +00:00
|
|
|
[DG][G']: chi_delayed
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-12-15 20:23:07 +00:00
|
|
|
[DG][G][G']: delayed_nu_fission
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
"""
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def __init__(self, name, energy_groups, temperatures=[ROOM_TEMPERATURE_KELVIN],
|
|
|
|
|
representation=REPRESENTATION_ISOTROPIC, num_delayed_groups=0):
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
# Initialize class attributes
|
2016-09-03 13:09:55 -04:00
|
|
|
self.name = name
|
|
|
|
|
self.energy_groups = energy_groups
|
2016-10-18 23:11:17 -04:00
|
|
|
self.num_delayed_groups = num_delayed_groups
|
2016-09-03 13:09:55 -04:00
|
|
|
self.temperatures = temperatures
|
|
|
|
|
self.representation = representation
|
2016-10-10 15:19:47 -04:00
|
|
|
self._atomic_weight_ratio = None
|
2015-11-15 15:03:23 -05:00
|
|
|
self._fissionable = False
|
2020-03-23 14:56:14 -05:00
|
|
|
self._scatter_format = SCATTER_LEGENDRE
|
2015-11-15 15:03:23 -05:00
|
|
|
self._order = None
|
|
|
|
|
self._num_polar = None
|
|
|
|
|
self._num_azimuthal = None
|
2016-09-03 13:09:55 -04:00
|
|
|
self._total = len(temperatures) * [None]
|
|
|
|
|
self._absorption = len(temperatures) * [None]
|
|
|
|
|
self._scatter_matrix = len(temperatures) * [None]
|
|
|
|
|
self._multiplicity_matrix = len(temperatures) * [None]
|
|
|
|
|
self._fission = len(temperatures) * [None]
|
|
|
|
|
self._nu_fission = len(temperatures) * [None]
|
2016-10-13 14:38:06 -04:00
|
|
|
self._prompt_nu_fission = len(temperatures) * [None]
|
|
|
|
|
self._delayed_nu_fission = len(temperatures) * [None]
|
2016-09-03 13:09:55 -04:00
|
|
|
self._kappa_fission = len(temperatures) * [None]
|
|
|
|
|
self._chi = len(temperatures) * [None]
|
2016-10-13 14:38:06 -04:00
|
|
|
self._chi_prompt = len(temperatures) * [None]
|
|
|
|
|
self._chi_delayed = len(temperatures) * [None]
|
|
|
|
|
self._beta = len(temperatures) * [None]
|
|
|
|
|
self._decay_rate = len(temperatures) * [None]
|
|
|
|
|
self._inverse_velocity = len(temperatures) * [None]
|
2016-10-19 10:45:57 -04:00
|
|
|
self._xs_shapes = None
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
def __deepcopy__(self, memo):
|
|
|
|
|
existing = memo.get(id(self))
|
|
|
|
|
|
|
|
|
|
# If this is the first time we have tried to copy this object, copy it
|
|
|
|
|
if existing is None:
|
|
|
|
|
clone = type(self).__new__(type(self))
|
|
|
|
|
clone._name = self.name
|
|
|
|
|
clone._energy_groups = copy.deepcopy(self.energy_groups, memo)
|
|
|
|
|
clone._num_delayed_groups = self.num_delayed_groups
|
|
|
|
|
clone._temperatures = copy.deepcopy(self.temperatures, memo)
|
2017-01-29 15:25:00 -05:00
|
|
|
clone._representation = self.representation
|
2017-01-28 11:34:29 -05:00
|
|
|
clone._atomic_weight_ratio = self._atomic_weight_ratio
|
|
|
|
|
clone._fissionable = self._fissionable
|
|
|
|
|
clone._scatter_format = self._scatter_format
|
|
|
|
|
clone._order = self._order
|
|
|
|
|
clone._num_polar = self._num_polar
|
|
|
|
|
clone._num_azimuthal = self._num_azimuthal
|
|
|
|
|
clone._total = copy.deepcopy(self._total, memo)
|
|
|
|
|
clone._absorption = copy.deepcopy(self._absorption, memo)
|
|
|
|
|
clone._scatter_matrix = copy.deepcopy(self._scatter_matrix, memo)
|
|
|
|
|
clone._multiplicity_matrix = \
|
|
|
|
|
copy.deepcopy(self._multiplicity_matrix, memo)
|
|
|
|
|
clone._fission = copy.deepcopy(self._fission, memo)
|
|
|
|
|
clone._nu_fission = copy.deepcopy(self._nu_fission, memo)
|
|
|
|
|
clone._prompt_nu_fission = \
|
|
|
|
|
copy.deepcopy(self._prompt_nu_fission, memo)
|
|
|
|
|
clone._delayed_nu_fission = \
|
|
|
|
|
copy.deepcopy(self._delayed_nu_fission, memo)
|
|
|
|
|
clone._kappa_fission = copy.deepcopy(self._kappa_fission, memo)
|
|
|
|
|
clone._chi = copy.deepcopy(self._chi, memo)
|
|
|
|
|
clone._chi_prompt = copy.deepcopy(self._chi_prompt, memo)
|
|
|
|
|
clone._chi_delayed = copy.deepcopy(self._chi_delayed, memo)
|
|
|
|
|
clone._beta = copy.deepcopy(self._beta, memo)
|
|
|
|
|
clone._decay_rate = copy.deepcopy(self._decay_rate, memo)
|
|
|
|
|
clone._inverse_velocity = \
|
|
|
|
|
copy.deepcopy(self._inverse_velocity, memo)
|
|
|
|
|
clone._xs_shapes = copy.deepcopy(self._xs_shapes, memo)
|
|
|
|
|
|
|
|
|
|
memo[id(self)] = clone
|
|
|
|
|
|
|
|
|
|
return clone
|
|
|
|
|
|
|
|
|
|
# If this object has been copied before, return the first copy made
|
|
|
|
|
else:
|
|
|
|
|
return existing
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def name(self):
|
|
|
|
|
return self._name
|
|
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@name.setter
|
|
|
|
|
def name(self, name):
|
|
|
|
|
|
|
|
|
|
check_type('name for XSdata', name, str)
|
|
|
|
|
self._name = name
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def energy_groups(self):
|
|
|
|
|
return self._energy_groups
|
|
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@energy_groups.setter
|
|
|
|
|
def energy_groups(self, energy_groups):
|
|
|
|
|
|
|
|
|
|
check_type('energy_groups', energy_groups, openmc.mgxs.EnergyGroups)
|
|
|
|
|
if energy_groups.group_edges is None:
|
|
|
|
|
msg = 'Unable to assign an EnergyGroups object ' \
|
|
|
|
|
'with uninitialized group edges'
|
|
|
|
|
raise ValueError(msg)
|
|
|
|
|
|
|
|
|
|
self._energy_groups = energy_groups
|
|
|
|
|
|
2016-10-13 14:38:06 -04:00
|
|
|
@property
|
2016-10-18 23:11:17 -04:00
|
|
|
def num_delayed_groups(self):
|
|
|
|
|
return self._num_delayed_groups
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@num_delayed_groups.setter
|
|
|
|
|
def num_delayed_groups(self, num_delayed_groups):
|
|
|
|
|
|
|
|
|
|
check_type('num_delayed_groups', num_delayed_groups, Integral)
|
|
|
|
|
check_less_than('num_delayed_groups', num_delayed_groups,
|
|
|
|
|
openmc.mgxs.MAX_DELAYED_GROUPS, equality=True)
|
|
|
|
|
check_greater_than('num_delayed_groups', num_delayed_groups, 0,
|
|
|
|
|
equality=True)
|
|
|
|
|
self._num_delayed_groups = num_delayed_groups
|
|
|
|
|
|
2015-11-16 05:31:16 -05:00
|
|
|
@property
|
|
|
|
|
def representation(self):
|
|
|
|
|
return self._representation
|
|
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@representation.setter
|
|
|
|
|
def representation(self, representation):
|
|
|
|
|
|
|
|
|
|
check_value('representation', representation, _REPRESENTATIONS)
|
|
|
|
|
self._representation = representation
|
|
|
|
|
|
2016-05-03 04:40:59 -04:00
|
|
|
@property
|
2016-10-10 15:19:47 -04:00
|
|
|
def atomic_weight_ratio(self):
|
|
|
|
|
return self._atomic_weight_ratio
|
2016-05-03 04:40:59 -04:00
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@atomic_weight_ratio.setter
|
|
|
|
|
def atomic_weight_ratio(self, atomic_weight_ratio):
|
|
|
|
|
|
|
|
|
|
check_type('atomic_weight_ratio', atomic_weight_ratio, Real)
|
|
|
|
|
check_greater_than('atomic_weight_ratio', atomic_weight_ratio, 0.0)
|
|
|
|
|
self._atomic_weight_ratio = atomic_weight_ratio
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
2016-09-03 13:09:55 -04:00
|
|
|
def fissionable(self):
|
|
|
|
|
return self._fissionable
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
@property
|
2016-09-03 13:09:55 -04:00
|
|
|
def temperatures(self):
|
|
|
|
|
return self._temperatures
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@temperatures.setter
|
|
|
|
|
def temperatures(self, temperatures):
|
|
|
|
|
|
|
|
|
|
check_iterable_type('temperatures', temperatures, Real)
|
|
|
|
|
self._temperatures = np.array(temperatures)
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
2016-09-19 20:44:06 -04:00
|
|
|
def scatter_format(self):
|
|
|
|
|
return self._scatter_format
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@scatter_format.setter
|
|
|
|
|
def scatter_format(self, scatter_format):
|
|
|
|
|
|
|
|
|
|
check_value('scatter_format', scatter_format, _SCATTER_TYPES)
|
|
|
|
|
self._scatter_format = scatter_format
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
2016-09-03 13:09:55 -04:00
|
|
|
def order(self):
|
|
|
|
|
return self._order
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@order.setter
|
|
|
|
|
def order(self, order):
|
|
|
|
|
|
|
|
|
|
check_type('order', order, Integral)
|
|
|
|
|
check_greater_than('order', order, 0, equality=True)
|
|
|
|
|
self._order = order
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def num_polar(self):
|
|
|
|
|
return self._num_polar
|
|
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@num_polar.setter
|
|
|
|
|
def num_polar(self, num_polar):
|
|
|
|
|
|
|
|
|
|
check_type('num_polar', num_polar, Integral)
|
|
|
|
|
check_greater_than('num_polar', num_polar, 0)
|
|
|
|
|
self._num_polar = num_polar
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def num_azimuthal(self):
|
|
|
|
|
return self._num_azimuthal
|
|
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@num_azimuthal.setter
|
|
|
|
|
def num_azimuthal(self, num_azimuthal):
|
|
|
|
|
|
|
|
|
|
check_type('num_azimuthal', num_azimuthal, Integral)
|
|
|
|
|
check_greater_than('num_azimuthal', num_azimuthal, 0)
|
|
|
|
|
self._num_azimuthal = num_azimuthal
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def total(self):
|
|
|
|
|
return self._total
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def absorption(self):
|
|
|
|
|
return self._absorption
|
|
|
|
|
|
|
|
|
|
@property
|
2016-09-03 13:09:55 -04:00
|
|
|
def scatter_matrix(self):
|
|
|
|
|
return self._scatter_matrix
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
@property
|
2016-09-03 13:09:55 -04:00
|
|
|
def multiplicity_matrix(self):
|
|
|
|
|
return self._multiplicity_matrix
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def fission(self):
|
|
|
|
|
return self._fission
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def nu_fission(self):
|
|
|
|
|
return self._nu_fission
|
|
|
|
|
|
2016-10-13 14:38:06 -04:00
|
|
|
@property
|
|
|
|
|
def prompt_nu_fission(self):
|
|
|
|
|
return self._prompt_nu_fission
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def delayed_nu_fission(self):
|
|
|
|
|
return self._delayed_nu_fission
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
2016-05-11 21:19:30 -04:00
|
|
|
def kappa_fission(self):
|
|
|
|
|
return self._kappa_fission
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def chi(self):
|
|
|
|
|
return self._chi
|
|
|
|
|
|
2016-10-13 14:38:06 -04:00
|
|
|
@property
|
|
|
|
|
def chi_prompt(self):
|
|
|
|
|
return self._chi_prompt
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def chi_delayed(self):
|
|
|
|
|
return self._chi_delayed
|
|
|
|
|
|
2020-08-25 03:23:28 +00:00
|
|
|
@property
|
|
|
|
|
def beta(self):
|
|
|
|
|
return self._beta
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def decay_rate(self):
|
|
|
|
|
return self._decay_rate
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def inverse_velocity(self):
|
|
|
|
|
return self._inverse_velocity
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def num_orders(self):
|
2020-03-23 14:56:14 -05:00
|
|
|
if self._order is None:
|
|
|
|
|
raise ValueError('Order has not been set.')
|
|
|
|
|
|
|
|
|
|
if self._scatter_format in (None, SCATTER_LEGENDRE):
|
|
|
|
|
return self._order + 1
|
|
|
|
|
else:
|
|
|
|
|
return self._order
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
@property
|
2016-10-19 10:45:57 -04:00
|
|
|
def xs_shapes(self):
|
|
|
|
|
|
|
|
|
|
if self._xs_shapes is None:
|
|
|
|
|
|
|
|
|
|
self._xs_shapes = {}
|
2016-10-24 09:59:41 -04:00
|
|
|
self._xs_shapes["[G]"] = (self.energy_groups.num_groups,)
|
|
|
|
|
self._xs_shapes["[G']"] = (self.energy_groups.num_groups,)
|
|
|
|
|
self._xs_shapes["[G][G']"] = (self.energy_groups.num_groups,
|
|
|
|
|
self.energy_groups.num_groups)
|
|
|
|
|
self._xs_shapes["[DG]"] = (self.num_delayed_groups,)
|
2016-12-19 15:42:35 -08:00
|
|
|
self._xs_shapes["[DG][G]"] = (self.num_delayed_groups,
|
|
|
|
|
self.energy_groups.num_groups)
|
2017-02-25 08:17:10 -05:00
|
|
|
self._xs_shapes["[DG][G']"] = (self.num_delayed_groups,
|
|
|
|
|
self.energy_groups.num_groups)
|
2016-12-19 15:42:35 -08:00
|
|
|
self._xs_shapes["[DG][G][G']"] = (self.num_delayed_groups,
|
2016-10-24 10:44:45 -04:00
|
|
|
self.energy_groups.num_groups,
|
2016-12-19 15:42:35 -08:00
|
|
|
self.energy_groups.num_groups)
|
2016-11-29 18:46:09 -05:00
|
|
|
|
2016-11-13 13:29:45 -05:00
|
|
|
self._xs_shapes["[G][G'][Order]"] \
|
|
|
|
|
= (self.energy_groups.num_groups,
|
|
|
|
|
self.energy_groups.num_groups, self.num_orders)
|
2016-10-24 09:59:41 -04:00
|
|
|
|
|
|
|
|
# If representation is by angle prepend num polar and num azim
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
for key, shapes in self._xs_shapes.items():
|
2016-10-24 09:59:41 -04:00
|
|
|
self._xs_shapes[key] \
|
|
|
|
|
= (self.num_polar, self.num_azimuthal) + shapes
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-10-19 10:45:57 -04:00
|
|
|
return self._xs_shapes
|
2016-05-15 14:26:54 -04:00
|
|
|
|
2016-09-05 19:42:12 -04:00
|
|
|
def add_temperature(self, temperature):
|
|
|
|
|
"""This method re-sizes the attributes of this XSdata object so that it
|
2022-02-10 00:20:58 +00:00
|
|
|
can accommodate an additional temperature. Note that the set_* methods
|
2016-09-05 19:42:12 -04:00
|
|
|
will still need to be executed.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset.
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-05 19:42:12 -04:00
|
|
|
check_type('temperature', temperature, Real)
|
|
|
|
|
|
2026-01-07 11:54:57 +01:00
|
|
|
temp_store = self.temperatures.tolist()
|
|
|
|
|
temp_store.append(temperature)
|
2016-09-05 19:42:12 -04:00
|
|
|
self.temperatures = temp_store
|
|
|
|
|
|
|
|
|
|
self._total.append(None)
|
|
|
|
|
self._absorption.append(None)
|
|
|
|
|
self._scatter_matrix.append(None)
|
|
|
|
|
self._multiplicity_matrix.append(None)
|
|
|
|
|
self._fission.append(None)
|
|
|
|
|
self._nu_fission.append(None)
|
2016-10-13 14:38:06 -04:00
|
|
|
self._prompt_nu_fission.append(None)
|
|
|
|
|
self._delayed_nu_fission.append(None)
|
2016-09-05 19:42:12 -04:00
|
|
|
self._kappa_fission.append(None)
|
|
|
|
|
self._chi.append(None)
|
2016-10-13 14:38:06 -04:00
|
|
|
self._chi_prompt.append(None)
|
|
|
|
|
self._chi_delayed.append(None)
|
|
|
|
|
self._beta.append(None)
|
|
|
|
|
self._decay_rate.append(None)
|
|
|
|
|
self._inverse_velocity.append(None)
|
2016-09-05 19:42:12 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def _check_temperature(self, temperature):
|
|
|
|
|
check_type('temperature', temperature, Real)
|
|
|
|
|
check_value('temperature', temperature, self.temperatures)
|
|
|
|
|
|
|
|
|
|
def _temperature_index(self, temperature):
|
|
|
|
|
return np.where(self.temperatures == temperature)[0][0]
|
|
|
|
|
|
|
|
|
|
def _set_fissionable(self, array):
|
|
|
|
|
if np.sum(array) > 0:
|
|
|
|
|
self._fissionable = True
|
|
|
|
|
|
2026-02-09 16:54:59 -06:00
|
|
|
def add_temperature_data(self, other):
|
|
|
|
|
"""This method adds temperature-dependent cross section
|
|
|
|
|
values from another XSdata object to this XSdata object.
|
|
|
|
|
Note: if a temperature datapoint from 'other' already exists in this
|
|
|
|
|
object, it will be overridden.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
other: openmc.XSdata
|
|
|
|
|
The other XSdata object to fetch data from
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Sanity check to make sure they have the same name, energy group structure,
|
|
|
|
|
# and delayed group structure
|
|
|
|
|
check_value('name', other.name, self.name)
|
|
|
|
|
check_value('energy_groups', other.energy_groups, [self.energy_groups])
|
|
|
|
|
check_value('delayed_groups', other.num_delayed_groups, [self.num_delayed_groups])
|
|
|
|
|
|
|
|
|
|
# Add the temperature data.
|
|
|
|
|
for temp in other.temperatures:
|
|
|
|
|
if temp not in self.temperatures:
|
|
|
|
|
self.add_temperature(temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.absorption[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_absorption(other.absorption[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.beta[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_beta(other.beta[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.chi[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_chi(other.chi[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.chi_delayed[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_chi_delayed(other.chi_delayed[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.chi_prompt[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_chi_prompt(other.chi_prompt[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.decay_rate[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_decay_rate(other.decay_rate[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.delayed_nu_fission[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_delayed_nu_fission(other.delayed_nu_fission[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.fission[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_fission(other.fission[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.inverse_velocity[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_inverse_velocity(other.inverse_velocity[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.kappa_fission[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_kappa_fission(other.kappa_fission[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.multiplicity_matrix[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_multiplicity_matrix(other.multiplicity_matrix[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.nu_fission[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_nu_fission(other.nu_fission[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.prompt_nu_fission[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_prompt_nu_fission(other.prompt_nu_fission[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.scatter_matrix[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_scatter_matrix(other.scatter_matrix[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
if np.all(other.fission[other._temperature_index(temp)] != None):
|
|
|
|
|
self.set_total(other.total[other._temperature_index(temp)], temp)
|
|
|
|
|
|
|
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_total(self, total, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
total: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Total Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-09-03 13:09:55 -04:00
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_total_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
total = np.asarray(total)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('total shape', total.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._total[i] = total
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_absorption(self, absorption, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
absorption: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Absorption Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_absorption_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
absorption = np.asarray(absorption)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('absorption shape', absorption.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._absorption[i] = absorption
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_fission(self, fission, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
fission: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Fission Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-09-03 13:09:55 -04:00
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_fission_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
fission = np.asarray(fission)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('fission shape', fission.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._fission[i] = fission
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(fission)
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_kappa_fission(self, kappa_fission, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
kappa_fission: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Kappa-Fission Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-09-03 13:09:55 -04:00
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_kappa_fission_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
kappa_fission = np.asarray(kappa_fission)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('kappa fission shape', kappa_fission.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._kappa_fission[i] = kappa_fission
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(kappa_fission)
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_chi(self, chi, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
chi: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Fission Spectrum
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-09-03 13:09:55 -04:00
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_chi_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2016-10-13 14:38:06 -04:00
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G']"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
chi = np.asarray(chi)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('chi shape', chi.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._chi[i] = chi
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_chi_prompt(self, chi_prompt, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
chi_prompt : np.ndarray
|
|
|
|
|
Prompt fission Spectrum
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_chi_prompt_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G']"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-14 09:04:59 -04:00
|
|
|
chi_prompt = np.asarray(chi_prompt)
|
|
|
|
|
check_value('chi prompt shape', chi_prompt.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._chi_prompt[i] = chi_prompt
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_chi_delayed(self, chi_delayed, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
chi_delayed : np.ndarray
|
|
|
|
|
Delayed fission Spectrum
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_chi_delayed_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2016-10-19 10:45:57 -04:00
|
|
|
# Get the accepted shapes for this xs
|
2016-12-15 20:23:07 +00:00
|
|
|
shapes = [self.xs_shapes["[G']"], self.xs_shapes["[DG][G']"]]
|
2016-10-19 10:45:57 -04:00
|
|
|
|
2016-10-13 14:38:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-14 09:04:59 -04:00
|
|
|
chi_delayed = np.asarray(chi_delayed)
|
|
|
|
|
check_value('chi delayed shape', chi_delayed.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
check_type('temperature', temperature, Real)
|
|
|
|
|
check_value('temperature', temperature, self.temperatures)
|
|
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._chi_delayed[i] = chi_delayed
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_beta(self, beta, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
beta : np.ndarray
|
|
|
|
|
Delayed fission spectrum
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_beta_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-12-15 20:23:07 +00:00
|
|
|
shapes = [self.xs_shapes["[DG]"], self.xs_shapes["[DG][G]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-14 09:04:59 -04:00
|
|
|
beta = np.asarray(beta)
|
|
|
|
|
check_value('beta shape', beta.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._beta[i] = beta
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_decay_rate(self, decay_rate, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
decay_rate : np.ndarray
|
|
|
|
|
Delayed neutron precursor decay rate
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_decay_rate_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2021-01-14 17:59:26 +00:00
|
|
|
shapes = [self.xs_shapes["[DG]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-14 09:04:59 -04:00
|
|
|
decay_rate = np.asarray(decay_rate)
|
|
|
|
|
check_value('decay rate shape', decay_rate.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._decay_rate[i] = decay_rate
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_scatter_matrix(self, scatter, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
scatter: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Scattering Matrix Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-09-03 13:09:55 -04:00
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_scatter_matrix_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-11-13 13:29:45 -05:00
|
|
|
shapes = [self.xs_shapes["[G][G'][Order]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
scatter = np.asarray(scatter)
|
|
|
|
|
check_iterable_type('scatter', scatter, Real,
|
|
|
|
|
max_depth=len(scatter.shape))
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('scatter shape', scatter.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._scatter_matrix[i] = scatter
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_multiplicity_matrix(self, multiplicity, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
multiplicity: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Multiplicity Matrix Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_multiplicity_matrix_mgxs()
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G][G']"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
multiplicity = np.asarray(multiplicity)
|
|
|
|
|
check_iterable_type('multiplicity', multiplicity, Real,
|
|
|
|
|
max_depth=len(multiplicity.shape))
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('multiplicity shape', multiplicity.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._multiplicity_matrix[i] = multiplicity
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_nu_fission(self, nu_fission, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-09-03 13:09:55 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-09-19 20:44:06 -04:00
|
|
|
nu_fission: np.ndarray
|
2016-09-03 13:09:55 -04:00
|
|
|
Nu-fission Cross Section
|
|
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_nu_fission_mgxs()
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"], self.xs_shapes["[G][G']"]]
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
nu_fission = np.asarray(nu_fission)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('nu_fission shape', nu_fission.shape, shapes)
|
2016-10-10 16:23:38 -04:00
|
|
|
check_iterable_type('nu_fission', nu_fission, Real,
|
|
|
|
|
max_depth=len(nu_fission.shape))
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-10 16:23:38 -04:00
|
|
|
self._nu_fission[i] = nu_fission
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(nu_fission)
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_prompt_nu_fission(self, prompt_nu_fission, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
prompt_nu_fission: np.ndarray
|
|
|
|
|
Prompt-nu-fission Cross Section
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_prompt_nu_fission_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2016-10-19 10:45:57 -04:00
|
|
|
# Get the accepted shapes for this xs
|
2016-10-24 10:44:45 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"], self.xs_shapes["[G][G']"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-14 09:04:59 -04:00
|
|
|
prompt_nu_fission = np.asarray(prompt_nu_fission)
|
|
|
|
|
check_value('prompt_nu_fission shape', prompt_nu_fission.shape, shapes)
|
|
|
|
|
check_iterable_type('prompt_nu_fission', prompt_nu_fission, Real,
|
|
|
|
|
max_depth=len(prompt_nu_fission.shape))
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._prompt_nu_fission[i] = prompt_nu_fission
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(prompt_nu_fission)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_delayed_nu_fission(self, delayed_nu_fission, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the cross section for this XSdata object at the
|
|
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
delayed_nu_fission: np.ndarray
|
|
|
|
|
Delayed-nu-fission Cross Section
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs_library.set_delayed_nu_fission_mgxs()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2016-10-19 10:45:57 -04:00
|
|
|
# Get the accepted shapes for this xs
|
2016-12-19 15:42:35 -08:00
|
|
|
shapes = [self.xs_shapes["[DG][G]"], self.xs_shapes["[DG][G][G']"]]
|
2016-10-19 10:45:57 -04:00
|
|
|
|
2016-10-13 14:38:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-14 09:04:59 -04:00
|
|
|
delayed_nu_fission = np.asarray(delayed_nu_fission)
|
|
|
|
|
check_value('delayed_nu_fission shape', delayed_nu_fission.shape,
|
2016-10-13 14:38:06 -04:00
|
|
|
shapes)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_iterable_type('delayed_nu_fission', delayed_nu_fission, Real,
|
|
|
|
|
max_depth=len(delayed_nu_fission.shape))
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._delayed_nu_fission[i] = delayed_nu_fission
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(delayed_nu_fission)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_inverse_velocity(self, inv_vel, temperature=ROOM_TEMPERATURE_KELVIN):
|
2016-10-13 14:38:06 -04:00
|
|
|
"""This method sets the inverse velocity for this XSdata object at the
|
2016-09-19 20:44:06 -04:00
|
|
|
provided temperature.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
inv_vel: np.ndarray
|
2016-10-13 14:38:06 -04:00
|
|
|
Inverse velocity in units of sec/cm.
|
2016-09-19 20:44:06 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-09-19 20:44:06 -04:00
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
# Get the accepted shapes for this xs
|
2016-10-19 10:45:57 -04:00
|
|
|
shapes = [self.xs_shapes["[G]"]]
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
# Convert to a numpy array so we can easily get the shape for checking
|
2016-10-10 16:23:38 -04:00
|
|
|
inv_vel = np.asarray(inv_vel)
|
2016-10-14 09:04:59 -04:00
|
|
|
check_value('inverse_velocity shape', inv_vel.shape, shapes)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-09-19 20:44:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2016-10-14 09:04:59 -04:00
|
|
|
self._inverse_velocity[i] = inv_vel
|
2016-09-19 20:44:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_total_mgxs(self, total, temperature=ROOM_TEMPERATURE_KELVIN, nuclide='total',
|
2016-09-03 13:09:55 -04:00
|
|
|
xs_type='macro', subdomain=None):
|
2016-05-11 21:19:30 -04:00
|
|
|
"""This method allows for an openmc.mgxs.TotalXS or
|
2016-10-13 14:38:06 -04:00
|
|
|
openmc.mgxs.TransportXS to be used to set the total cross section for
|
|
|
|
|
this XSdata object.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-05-15 14:56:00 -04:00
|
|
|
total: openmc.mgxs.TotalXS or openmc.mgxs.TransportXS
|
2016-10-13 14:38:06 -04:00
|
|
|
MGXS Object containing the total, transport or nu-transport cross
|
|
|
|
|
section for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
|
|
|
|
check_type('total', total, (openmc.mgxs.TotalXS,
|
|
|
|
|
openmc.mgxs.TransportXS))
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', total.energy_groups, [self.energy_groups])
|
2016-10-18 23:11:17 -04:00
|
|
|
check_value('domain_type', total.domain_type, openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._total[i] = total.get_xs(nuclides=nuclide, xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_absorption_mgxs(self, absorption, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-09-03 13:09:55 -04:00
|
|
|
nuclide='total', xs_type='macro', subdomain=None):
|
2016-05-11 21:19:30 -04:00
|
|
|
"""This method allows for an openmc.mgxs.AbsorptionXS
|
|
|
|
|
to be used to set the absorption cross section for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
absorption: openmc.mgxs.AbsorptionXS
|
|
|
|
|
MGXS Object containing the absorption cross section
|
|
|
|
|
for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
|
|
|
|
check_type('absorption', absorption, openmc.mgxs.AbsorptionXS)
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', absorption.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', absorption.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._absorption[i] = absorption.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_fission_mgxs(self, fission, temperature=ROOM_TEMPERATURE_KELVIN, nuclide='total',
|
2016-09-03 13:09:55 -04:00
|
|
|
xs_type='macro', subdomain=None):
|
2016-05-11 21:19:30 -04:00
|
|
|
"""This method allows for an openmc.mgxs.FissionXS
|
|
|
|
|
to be used to set the fission cross section for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
fission: openmc.mgxs.FissionXS
|
|
|
|
|
MGXS Object containing the fission cross section
|
|
|
|
|
for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
|
|
|
|
check_type('fission', fission, openmc.mgxs.FissionXS)
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', fission.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', fission.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._fission[i] = fission.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_nu_fission_mgxs(self, nu_fission, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-09-03 13:09:55 -04:00
|
|
|
nuclide='total', xs_type='macro', subdomain=None):
|
2017-02-25 14:54:03 -05:00
|
|
|
"""This method allows for an openmc.mgxs.FissionXS
|
2016-05-11 21:19:30 -04:00
|
|
|
to be used to set the nu-fission cross section for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2017-02-25 14:54:03 -05:00
|
|
|
nu_fission: openmc.mgxs.FissionXS
|
2016-05-11 21:19:30 -04:00
|
|
|
MGXS Object containing the nu-fission cross section
|
|
|
|
|
for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
2017-02-25 14:54:03 -05:00
|
|
|
check_type('nu_fission', nu_fission, (openmc.mgxs.FissionXS,
|
2016-05-22 05:56:29 -04:00
|
|
|
openmc.mgxs.NuFissionMatrixXS))
|
2017-02-26 15:15:02 -05:00
|
|
|
if isinstance(nu_fission, openmc.mgxs.FissionXS):
|
|
|
|
|
check_value('nu', nu_fission.nu, [True])
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', nu_fission.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', nu_fission.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-05-01 10:23:20 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._nu_fission[i] = nu_fission.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-05-01 10:23:20 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(self._nu_fission)
|
2016-05-01 10:23:20 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_prompt_nu_fission_mgxs(self, prompt_nu_fission, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-10-13 14:38:06 -04:00
|
|
|
nuclide='total', xs_type='macro',
|
|
|
|
|
subdomain=None):
|
2016-11-11 18:29:40 -05:00
|
|
|
"""Sets the prompt-nu-fission cross section.
|
|
|
|
|
|
2017-02-26 06:26:24 -05:00
|
|
|
This method allows for an openmc.mgxs.FissionXS or
|
|
|
|
|
openmc.mgxs.NuFissionMatrixXS to be used to set the prompt-nu-fission
|
|
|
|
|
cross section for this XSdata object.
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2017-02-26 06:26:24 -05:00
|
|
|
prompt_nu_fission: openmc.mgxs.FissionXS or openmc.mgxs.NuFissionMatrixXS
|
2016-10-13 14:38:06 -04:00
|
|
|
MGXS Object containing the prompt-nu-fission cross section
|
|
|
|
|
for the domain of interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_type('prompt_nu_fission', prompt_nu_fission,
|
2017-02-26 06:26:24 -05:00
|
|
|
(openmc.mgxs.FissionXS, openmc.mgxs.NuFissionMatrixXS))
|
|
|
|
|
check_value('prompt', prompt_nu_fission.prompt, [True])
|
2016-10-13 14:38:06 -04:00
|
|
|
check_value('energy_groups', prompt_nu_fission.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', prompt_nu_fission.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._prompt_nu_fission[i] = prompt_nu_fission.get_xs(
|
|
|
|
|
nuclides=nuclide, xs_type=xs_type, subdomains=subdomain)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(self._prompt_nu_fission)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_delayed_nu_fission_mgxs(self, delayed_nu_fission, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-10-13 14:38:06 -04:00
|
|
|
nuclide='total', xs_type='macro',
|
|
|
|
|
subdomain=None):
|
2016-10-13 17:50:43 -04:00
|
|
|
"""This method allows for an openmc.mgxs.DelayedNuFissionXS or
|
|
|
|
|
openmc.mgxs.DelayedNuFissionMatrixXS to be used to set the
|
|
|
|
|
delayed-nu-fission cross section for this XSdata object.
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-10-13 17:50:43 -04:00
|
|
|
delayed_nu_fission: openmc.mgxs.DelayedNuFissionXS or openmc.mgxs.DelayedNuFissionMatrixXS
|
2016-10-13 14:38:06 -04:00
|
|
|
MGXS Object containing the delayed-nu-fission cross section
|
|
|
|
|
for the domain of interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_type('delayed_nu_fission', delayed_nu_fission,
|
2016-10-13 17:50:43 -04:00
|
|
|
(openmc.mgxs.DelayedNuFissionXS,
|
|
|
|
|
openmc.mgxs.DelayedNuFissionMatrixXS))
|
2016-10-13 14:38:06 -04:00
|
|
|
check_value('energy_groups', delayed_nu_fission.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
2016-10-18 23:11:17 -04:00
|
|
|
check_value('num_delayed_groups', delayed_nu_fission.num_delayed_groups,
|
|
|
|
|
[self.num_delayed_groups])
|
2016-10-13 14:38:06 -04:00
|
|
|
check_value('domain_type', delayed_nu_fission.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._delayed_nu_fission[i] = delayed_nu_fission.get_xs(
|
|
|
|
|
nuclides=nuclide, xs_type=xs_type, subdomains=subdomain)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
self._set_fissionable(self._delayed_nu_fission)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_kappa_fission_mgxs(self, k_fission, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-09-03 13:09:55 -04:00
|
|
|
nuclide='total', xs_type='macro',
|
|
|
|
|
subdomain=None):
|
2016-05-11 21:19:30 -04:00
|
|
|
"""This method allows for an openmc.mgxs.KappaFissionXS
|
|
|
|
|
to be used to set the kappa-fission cross section for this XSdata
|
|
|
|
|
object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
kappa_fission: openmc.mgxs.KappaFissionXS
|
|
|
|
|
MGXS Object containing the kappa-fission cross section
|
|
|
|
|
for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
2016-10-14 14:26:33 -04:00
|
|
|
check_type('kappa_fission', k_fission, openmc.mgxs.KappaFissionXS)
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', k_fission.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', k_fission.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._kappa_fission[i] = k_fission.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_chi_mgxs(self, chi, temperature=ROOM_TEMPERATURE_KELVIN, nuclide='total',
|
2016-09-03 13:09:55 -04:00
|
|
|
xs_type='macro', subdomain=None):
|
2016-05-11 21:19:30 -04:00
|
|
|
"""This method allows for an openmc.mgxs.Chi
|
|
|
|
|
to be used to set chi for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
chi: openmc.mgxs.Chi
|
|
|
|
|
MGXS Object containing chi for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
|
|
|
|
check_type('chi', chi, openmc.mgxs.Chi)
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', chi.energy_groups, [self.energy_groups])
|
2016-10-18 23:11:17 -04:00
|
|
|
check_value('domain_type', chi.domain_type, openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._chi[i] = chi.get_xs(nuclides=nuclide, xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_chi_prompt_mgxs(self, chi_prompt, temperature=ROOM_TEMPERATURE_KELVIN,
|
2017-01-10 20:29:09 -05:00
|
|
|
nuclide='total', xs_type='macro', subdomain=None):
|
2017-02-26 06:26:24 -05:00
|
|
|
"""This method allows for an openmc.mgxs.Chi to be used to set
|
|
|
|
|
chi-prompt for this XSdata object.
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2017-02-26 06:26:24 -05:00
|
|
|
chi_prompt: openmc.mgxs.Chi
|
2016-10-13 14:38:06 -04:00
|
|
|
MGXS Object containing chi-prompt for the domain of interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2017-02-26 06:26:24 -05:00
|
|
|
check_type('chi_prompt', chi_prompt, openmc.mgxs.Chi)
|
|
|
|
|
check_value('prompt', chi_prompt.prompt, [True])
|
2016-10-13 14:38:06 -04:00
|
|
|
check_value('energy_groups', chi_prompt.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', chi_prompt.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._chi_prompt[i] = chi_prompt.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_chi_delayed_mgxs(self, chi_delayed, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-10-13 14:38:06 -04:00
|
|
|
nuclide='total', xs_type='macro', subdomain=None):
|
|
|
|
|
"""This method allows for an openmc.mgxs.ChiDelayed
|
|
|
|
|
to be used to set chi-delayed for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
chi_delayed: openmc.mgxs.ChiDelayed
|
|
|
|
|
MGXS Object containing chi-delayed for the domain of interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_type('chi_delayed', chi_delayed, openmc.mgxs.ChiDelayed)
|
|
|
|
|
check_value('energy_groups', chi_delayed.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
2016-10-18 23:11:17 -04:00
|
|
|
check_value('num_delayed_groups', chi_delayed.num_delayed_groups,
|
|
|
|
|
[self.num_delayed_groups])
|
2016-10-13 14:38:06 -04:00
|
|
|
check_value('domain_type', chi_delayed.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._chi_delayed[i] = chi_delayed.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_beta_mgxs(self, beta, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-10-13 14:38:06 -04:00
|
|
|
nuclide='total', xs_type='macro', subdomain=None):
|
|
|
|
|
"""This method allows for an openmc.mgxs.Beta
|
|
|
|
|
to be used to set beta for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
beta : openmc.mgxs.Beta
|
|
|
|
|
MGXS Object containing beta for the domain of interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_type('beta', beta, openmc.mgxs.Beta)
|
2016-10-18 23:11:17 -04:00
|
|
|
check_value('num_delayed_groups', beta.num_delayed_groups,
|
|
|
|
|
[self.num_delayed_groups])
|
|
|
|
|
check_value('domain_type', beta.domain_type, openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._beta[i] = beta.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_decay_rate_mgxs(self, decay_rate, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-10-13 14:38:06 -04:00
|
|
|
nuclide='total', xs_type='macro', subdomain=None):
|
|
|
|
|
"""This method allows for an openmc.mgxs.DecayRate
|
|
|
|
|
to be used to set decay rate for this XSdata object.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
decay_rate : openmc.mgxs.DecayRate
|
|
|
|
|
MGXS Object containing decay rate for the domain of interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in units of Kelvin) of the provided dataset. Defaults
|
|
|
|
|
to 294K
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_type('decay_rate', decay_rate, openmc.mgxs.DecayRate)
|
2016-10-18 23:11:17 -04:00
|
|
|
check_value('num_delayed_groups', decay_rate.num_delayed_groups,
|
|
|
|
|
[self.num_delayed_groups])
|
2016-10-13 14:38:06 -04:00
|
|
|
check_value('domain_type', decay_rate.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._decay_rate[i] = decay_rate.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_scatter_matrix_mgxs(self, scatter, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-09-03 13:09:55 -04:00
|
|
|
nuclide='total', xs_type='macro',
|
|
|
|
|
subdomain=None):
|
2016-05-11 21:19:30 -04:00
|
|
|
"""This method allows for an openmc.mgxs.ScatterMatrixXS
|
|
|
|
|
to be used to set the scatter matrix cross section for this XSdata
|
2016-05-17 21:24:03 -04:00
|
|
|
object. If the XSdata.order attribute has not yet been set, then
|
2016-05-17 05:35:55 -04:00
|
|
|
it will be set based on the properties of scatter.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
scatter: openmc.mgxs.ScatterMatrixXS
|
|
|
|
|
MGXS Object containing the scatter matrix cross section
|
|
|
|
|
for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
|
|
|
|
check_type('scatter', scatter, openmc.mgxs.ScatterMatrixXS)
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', scatter.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', scatter.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2016-10-17 19:15:11 -04:00
|
|
|
# Set the value of scatter_format based on the same value within
|
|
|
|
|
# scatter
|
|
|
|
|
self.scatter_format = scatter.scatter_format
|
2016-05-17 05:35:55 -04:00
|
|
|
|
2016-05-17 21:24:03 -04:00
|
|
|
# If the user has not defined XSdata.order, then we will set
|
2016-05-17 05:35:55 -04:00
|
|
|
# the order based on the data within scatter.
|
2016-10-17 19:15:11 -04:00
|
|
|
# Otherwise, we will check to see that XSdata.order matches
|
2016-05-17 05:35:55 -04:00
|
|
|
# the order of scatter
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.scatter_format == SCATTER_LEGENDRE:
|
2016-10-17 19:15:11 -04:00
|
|
|
if self.order is None:
|
|
|
|
|
self.order = scatter.legendre_order
|
|
|
|
|
else:
|
|
|
|
|
check_value('legendre_order', scatter.legendre_order,
|
|
|
|
|
[self.order])
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.scatter_format == SCATTER_HISTOGRAM:
|
2016-10-17 19:15:11 -04:00
|
|
|
if self.order is None:
|
|
|
|
|
self.order = scatter.histogram_bins
|
|
|
|
|
else:
|
|
|
|
|
check_value('histogram_bins', scatter.histogram_bins,
|
|
|
|
|
[self.order])
|
2016-05-17 05:35:55 -04:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
|
|
|
|
if self.scatter_format == SCATTER_LEGENDRE:
|
2017-01-10 20:29:09 -05:00
|
|
|
self._scatter_matrix[i] = \
|
|
|
|
|
np.zeros(self.xs_shapes["[G][G'][Order]"])
|
|
|
|
|
# Get the scattering orders in the outermost dimension
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-10-17 19:15:11 -04:00
|
|
|
for moment in range(self.num_orders):
|
2016-11-13 13:29:45 -05:00
|
|
|
self._scatter_matrix[i][:, :, moment] = \
|
2016-10-17 19:15:11 -04:00
|
|
|
scatter.get_xs(nuclides=nuclide, xs_type=xs_type,
|
|
|
|
|
moment=moment, subdomains=subdomain)
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2017-01-10 20:29:09 -05:00
|
|
|
for moment in range(self.num_orders):
|
|
|
|
|
self._scatter_matrix[i][:, :, :, :, moment] = \
|
|
|
|
|
scatter.get_xs(nuclides=nuclide, xs_type=xs_type,
|
|
|
|
|
moment=moment, subdomains=subdomain)
|
|
|
|
|
else:
|
|
|
|
|
self._scatter_matrix[i] = \
|
|
|
|
|
scatter.get_xs(nuclides=nuclide, xs_type=xs_type,
|
|
|
|
|
subdomains=subdomain)
|
2016-04-30 16:08:47 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
def set_multiplicity_matrix_mgxs(self, nuscatter, scatter=None,
|
2020-03-23 14:56:14 -05:00
|
|
|
temperature=ROOM_TEMPERATURE_KELVIN, nuclide='total',
|
2016-09-03 13:09:55 -04:00
|
|
|
xs_type='macro', subdomain=None):
|
2016-05-22 15:04:04 -04:00
|
|
|
"""This method allows for either the direct use of only an
|
2017-02-28 06:28:44 -06:00
|
|
|
openmc.mgxs.MultiplicityMatrixXS or an openmc.mgxs.ScatterMatrixXS and
|
2016-05-11 21:19:30 -04:00
|
|
|
openmc.mgxs.ScatterMatrixXS to be used to set the scattering
|
2017-02-28 06:28:44 -06:00
|
|
|
multiplicity for this XSdata object. Multiplicity, in OpenMC parlance,
|
|
|
|
|
is a factor used to account for the production of neutrons introduced by
|
|
|
|
|
scattering multiplication reactions, i.e., (n,xn) events. In this sense,
|
|
|
|
|
the multiplication matrix is simply defined as the ratio of the
|
|
|
|
|
nu-scatter and scatter matrices.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2017-02-28 06:28:44 -06:00
|
|
|
nuscatter: openmc.mgxs.ScatterMatrixXS or openmc.mgxs.MultiplicityMatrixXS
|
2016-05-22 15:04:04 -04:00
|
|
|
MGXS Object containing the matrix cross section for the domain
|
|
|
|
|
of interest.
|
2016-05-11 21:19:30 -04:00
|
|
|
scatter: openmc.mgxs.ScatterMatrixXS
|
|
|
|
|
MGXS Object containing the scattering matrix cross section
|
|
|
|
|
for the domain of interest.
|
2016-09-03 13:09:55 -04:00
|
|
|
temperature : float
|
2016-10-10 16:10:39 -04:00
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
2016-05-11 21:19:30 -04:00
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
2016-08-06 06:43:25 -04:00
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
2016-08-18 19:27:32 -04:00
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
2016-05-11 21:19:30 -04:00
|
|
|
|
2016-05-15 19:13:22 -04:00
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-05-15 19:13:22 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
"""
|
2016-05-12 05:16:21 -04:00
|
|
|
|
2017-02-25 14:54:03 -05:00
|
|
|
check_type('nuscatter', nuscatter, (openmc.mgxs.ScatterMatrixXS,
|
2016-05-22 20:36:50 -04:00
|
|
|
openmc.mgxs.MultiplicityMatrixXS))
|
2016-05-11 21:19:30 -04:00
|
|
|
check_value('energy_groups', nuscatter.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', nuscatter.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2016-05-22 15:04:04 -04:00
|
|
|
if scatter is not None:
|
|
|
|
|
check_type('scatter', scatter, openmc.mgxs.ScatterMatrixXS)
|
2016-05-22 20:36:50 -04:00
|
|
|
if isinstance(nuscatter, openmc.mgxs.MultiplicityMatrixXS):
|
|
|
|
|
msg = 'Either an MultiplicityMatrixXS object must be passed ' \
|
2016-05-22 15:04:04 -04:00
|
|
|
'for "nuscatter" or the "scatter" argument must be ' \
|
|
|
|
|
'provided.'
|
|
|
|
|
raise ValueError(msg)
|
|
|
|
|
check_value('energy_groups', scatter.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', scatter.domain_type,
|
2016-10-18 23:11:17 -04:00
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
nuscatt = nuscatter.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type, moment=0,
|
|
|
|
|
subdomains=subdomain)
|
|
|
|
|
if isinstance(nuscatter, openmc.mgxs.MultiplicityMatrixXS):
|
|
|
|
|
self._multiplicity_matrix[i] = nuscatt
|
|
|
|
|
else:
|
|
|
|
|
scatt = scatter.get_xs(nuclides=nuclide,
|
|
|
|
|
xs_type=xs_type, moment=0,
|
|
|
|
|
subdomains=subdomain)
|
2020-03-23 14:56:14 -05:00
|
|
|
if scatter.scatter_format == SCATTER_HISTOGRAM:
|
2019-12-14 21:02:48 -05:00
|
|
|
scatt = np.sum(scatt, axis=2)
|
2020-03-23 14:56:14 -05:00
|
|
|
if nuscatter.scatter_format == SCATTER_HISTOGRAM:
|
2019-12-14 21:02:48 -05:00
|
|
|
nuscatt = np.sum(nuscatt, axis=2)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._multiplicity_matrix[i] = np.divide(nuscatt, scatt)
|
|
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
self._multiplicity_matrix[i] = \
|
|
|
|
|
np.nan_to_num(self._multiplicity_matrix[i])
|
|
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
def set_inverse_velocity_mgxs(self, inverse_velocity, temperature=ROOM_TEMPERATURE_KELVIN,
|
2016-12-15 20:23:07 +00:00
|
|
|
nuclide='total', xs_type='macro',
|
|
|
|
|
subdomain=None):
|
|
|
|
|
"""This method allows for an openmc.mgxs.InverseVelocity
|
2016-12-19 15:19:26 -08:00
|
|
|
to be used to set the inverse velocity for this XSdata object.
|
2016-12-15 20:23:07 +00:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
inverse_velocity : openmc.mgxs.InverseVelocity
|
2016-12-19 15:19:26 -08:00
|
|
|
MGXS object containing the inverse velocity for the domain of
|
2016-12-15 20:23:07 +00:00
|
|
|
interest.
|
|
|
|
|
temperature : float
|
|
|
|
|
Temperature (in Kelvin) of the data. Defaults to room temperature
|
|
|
|
|
(294K).
|
|
|
|
|
nuclide : str
|
|
|
|
|
Individual nuclide (or 'total' if obtaining material-wise data)
|
|
|
|
|
to gather data for. Defaults to 'total'.
|
|
|
|
|
xs_type: {'macro', 'micro'}
|
|
|
|
|
Provide the macro or micro cross section in units of cm^-1 or
|
|
|
|
|
barns. Defaults to 'macro'.
|
|
|
|
|
subdomain : iterable of int
|
|
|
|
|
If the MGXS contains a mesh domain type, the subdomain parameter
|
|
|
|
|
specifies which mesh cell (i.e., [i, j, k] index) to use.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
openmc.mgxs.Library.create_mg_library()
|
2016-12-19 15:19:26 -08:00
|
|
|
openmc.mgxs.Library.get_xsdata()
|
2016-12-15 20:23:07 +00:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
check_type('inverse_velocity', inverse_velocity,
|
|
|
|
|
openmc.mgxs.InverseVelocity)
|
2016-12-15 20:23:07 +00:00
|
|
|
check_value('energy_groups', inverse_velocity.energy_groups,
|
|
|
|
|
[self.energy_groups])
|
|
|
|
|
check_value('domain_type', inverse_velocity.domain_type,
|
|
|
|
|
openmc.mgxs.DOMAIN_TYPES)
|
2020-03-23 14:56:14 -05:00
|
|
|
self._check_temperature(temperature)
|
2016-12-15 20:23:07 +00:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
i = self._temperature_index(temperature)
|
2017-01-10 20:29:09 -05:00
|
|
|
self._inverse_velocity[i] = inverse_velocity.get_xs(
|
|
|
|
|
nuclides=nuclide, xs_type=xs_type, subdomains=subdomain)
|
2016-12-15 20:23:07 +00:00
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
def convert_representation(self, target_representation, num_polar=None,
|
|
|
|
|
num_azimuthal=None):
|
|
|
|
|
"""Produce a new XSdata object with the same data, but converted to the
|
2017-02-16 21:02:34 -05:00
|
|
|
new representation (isotropic or angle-dependent).
|
|
|
|
|
|
|
|
|
|
This method cannot be used to change the number of polar or
|
|
|
|
|
azimuthal bins of an XSdata object that already uses an angular
|
|
|
|
|
representation. Finally, this method simply uses an arithmetic mean to
|
|
|
|
|
convert from an angular to isotropic representation; no flux-weighting
|
2017-02-18 05:20:30 -05:00
|
|
|
is applied and therefore reaction rates will not be preserved.
|
2017-01-28 11:34:29 -05:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
target_representation : {'isotropic', 'angle'}
|
|
|
|
|
Representation of the MGXS (isotropic or angle-dependent flux
|
|
|
|
|
weighting).
|
|
|
|
|
num_polar : int, optional
|
2017-03-01 07:10:51 -06:00
|
|
|
Number of equal width angular bins that the polar angular domain is
|
|
|
|
|
subdivided into. This is required when `target_representation` is
|
|
|
|
|
"angle".
|
|
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
num_azimuthal : int, optional
|
2017-03-01 07:10:51 -06:00
|
|
|
Number of equal width angular bins that the azimuthal angular domain
|
|
|
|
|
is subdivided into. This is required when `target_representation` is
|
|
|
|
|
"angle".
|
2017-01-28 11:34:29 -05:00
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
openmc.XSdata
|
2017-03-01 07:10:51 -06:00
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
Multi-group cross section data with the same data as self, but
|
2017-03-01 07:10:51 -06:00
|
|
|
represented as specified in `target_representation`.
|
2017-01-28 11:34:29 -05:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_value('target_representation', target_representation,
|
|
|
|
|
_REPRESENTATIONS)
|
2020-03-23 14:56:14 -05:00
|
|
|
if target_representation == REPRESENTATION_ANGLE:
|
2017-01-28 11:34:29 -05:00
|
|
|
check_type('num_polar', num_polar, Integral)
|
|
|
|
|
check_type('num_azimuthal', num_azimuthal, Integral)
|
|
|
|
|
check_greater_than('num_polar', num_polar, 0)
|
|
|
|
|
check_greater_than('num_azimuthal', num_azimuthal, 0)
|
|
|
|
|
|
|
|
|
|
xsdata = copy.deepcopy(self)
|
2017-02-15 20:27:31 -05:00
|
|
|
|
|
|
|
|
# First handle the case where the current and requested
|
|
|
|
|
# representations are the same
|
2017-01-28 11:34:29 -05:00
|
|
|
if target_representation == self.representation:
|
|
|
|
|
# Check to make sure the num_polar and num_azimuthal values match
|
2020-03-23 14:56:14 -05:00
|
|
|
if target_representation == REPRESENTATION_ANGLE:
|
2017-01-28 11:34:29 -05:00
|
|
|
if num_polar != self.num_polar or num_azimuthal != self.num_azimuthal:
|
2017-02-16 21:02:34 -05:00
|
|
|
raise ValueError("Cannot translate between `angle`"
|
|
|
|
|
" representations with different angle"
|
|
|
|
|
" bin structures")
|
2017-02-15 20:27:31 -05:00
|
|
|
# Nothing to do as the same structure was requested
|
2017-01-28 11:34:29 -05:00
|
|
|
return xsdata
|
|
|
|
|
|
|
|
|
|
xsdata.representation = target_representation
|
|
|
|
|
# We have different actions depending on the representation conversion
|
2020-03-23 14:56:14 -05:00
|
|
|
if target_representation == REPRESENTATION_ISOTROPIC:
|
2017-01-28 13:44:38 -05:00
|
|
|
# This is not needed for the correct functionality, but these
|
|
|
|
|
# values are changed back to None for clarity
|
|
|
|
|
xsdata._num_polar = None
|
|
|
|
|
xsdata._num_azimuthal = None
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_representation == REPRESENTATION_ANGLE:
|
2017-01-28 11:34:29 -05:00
|
|
|
xsdata.num_polar = num_polar
|
|
|
|
|
xsdata.num_azimuthal = num_azimuthal
|
2017-01-28 13:44:38 -05:00
|
|
|
|
2017-02-15 20:27:31 -05:00
|
|
|
# Reset xs_shapes so it is recalculated the next time it is needed
|
2017-01-28 13:44:38 -05:00
|
|
|
xsdata._xs_shapes = None
|
|
|
|
|
|
|
|
|
|
for i, temp in enumerate(xsdata.temperatures):
|
2017-02-15 20:27:31 -05:00
|
|
|
for xs in ['total', 'absorption', 'fission', 'nu_fission',
|
|
|
|
|
'scatter_matrix', 'multiplicity_matrix',
|
|
|
|
|
'prompt_nu_fission', 'delayed_nu_fission',
|
|
|
|
|
'kappa_fission', 'chi', 'chi_prompt', 'chi_delayed',
|
|
|
|
|
'beta', 'decay_rate', 'inverse_velocity']:
|
2017-01-28 13:44:38 -05:00
|
|
|
# Get the original data
|
|
|
|
|
orig_data = getattr(self, '_' + xs)[i]
|
|
|
|
|
if orig_data is not None:
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2017-01-28 13:44:38 -05:00
|
|
|
if target_representation == 'isotropic':
|
|
|
|
|
# Since we are going from angle to isotropic, the
|
2017-02-15 20:27:31 -05:00
|
|
|
# current data is just the average over the angle bins
|
2017-01-28 13:44:38 -05:00
|
|
|
new_data = orig_data.mean(axis=(0, 1))
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_representation == REPRESENTATION_ANGLE:
|
2017-01-28 13:44:38 -05:00
|
|
|
# Since we are going from isotropic to angle, the
|
|
|
|
|
# current data is just copied for every angle bin
|
2017-01-29 15:25:00 -05:00
|
|
|
new_shape = (num_polar, num_azimuthal) + \
|
|
|
|
|
orig_data.shape
|
2017-01-28 13:44:38 -05:00
|
|
|
new_data = np.resize(orig_data, new_shape)
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
setter = getattr(xsdata, 'set_' + xs)
|
|
|
|
|
setter(new_data, temp)
|
|
|
|
|
|
|
|
|
|
return xsdata
|
|
|
|
|
|
2017-01-29 15:25:00 -05:00
|
|
|
def convert_scatter_format(self, target_format, target_order=None):
|
|
|
|
|
"""Produce a new MGXSLibrary object with the same data, but converted
|
|
|
|
|
to the new scatter format and order
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
target_format : {'tabular', 'legendre', 'histogram'}
|
|
|
|
|
Representation of the scattering angle distribution
|
|
|
|
|
target_order : int
|
|
|
|
|
Either the Legendre target_order, number of bins, or number of
|
|
|
|
|
points used to describe the angular distribution associated with
|
|
|
|
|
each group-to-group transfer probability
|
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
openmc.XSdata
|
2017-02-15 20:27:31 -05:00
|
|
|
Multi-group cross section data with the same data as in self, but
|
2017-03-01 07:10:51 -06:00
|
|
|
represented as specified in `target_format`.
|
2017-01-29 15:25:00 -05:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
check_value('target_format', target_format, _SCATTER_TYPES)
|
|
|
|
|
check_type('target_order', target_order, Integral)
|
2020-03-23 14:56:14 -05:00
|
|
|
if target_format == SCATTER_LEGENDRE:
|
2017-01-29 15:25:00 -05:00
|
|
|
check_greater_than('target_order', target_order, 0, equality=True)
|
|
|
|
|
else:
|
|
|
|
|
check_greater_than('target_order', target_order, 0)
|
|
|
|
|
|
|
|
|
|
xsdata = copy.deepcopy(self)
|
|
|
|
|
xsdata.scatter_format = target_format
|
|
|
|
|
xsdata.order = target_order
|
2017-02-15 20:27:31 -05:00
|
|
|
|
|
|
|
|
# Reset and re-generate XSdata.xs_shapes with the new scattering format
|
2017-01-29 15:25:00 -05:00
|
|
|
xsdata._xs_shapes = None
|
|
|
|
|
|
2024-06-11 21:56:31 -05:00
|
|
|
# scipy 1.11+ prefers 'simpson', whereas older versions use 'simps'
|
|
|
|
|
if hasattr(scipy.integrate, 'simpson'):
|
|
|
|
|
integrate = scipy.integrate.simpson
|
|
|
|
|
else:
|
|
|
|
|
integrate = scipy.integrate.simps
|
|
|
|
|
|
2017-01-29 15:25:00 -05:00
|
|
|
for i, temp in enumerate(xsdata.temperatures):
|
|
|
|
|
orig_data = self._scatter_matrix[i]
|
|
|
|
|
new_shape = orig_data.shape[:-1] + (xsdata.num_orders,)
|
|
|
|
|
new_data = np.zeros(new_shape)
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.scatter_format == SCATTER_LEGENDRE:
|
|
|
|
|
if target_format == SCATTER_LEGENDRE:
|
2017-01-29 15:25:00 -05:00
|
|
|
# Then we are changing orders and only need to change
|
|
|
|
|
# dimensionality of the mu data and pad/truncate as needed
|
|
|
|
|
order = min(xsdata.num_orders, self.num_orders)
|
|
|
|
|
new_data[..., :order] = orig_data[..., :order]
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_format == SCATTER_TABULAR:
|
2017-01-29 15:25:00 -05:00
|
|
|
mu = np.linspace(-1, 1, xsdata.num_orders)
|
2017-02-15 20:27:31 -05:00
|
|
|
# Evaluate the legendre on the mu grid
|
2017-02-05 15:56:23 -05:00
|
|
|
for imu in range(len(mu)):
|
2018-10-17 10:57:12 -04:00
|
|
|
for l in range(self.num_orders):
|
|
|
|
|
new_data[..., imu] += (
|
|
|
|
|
(l + 0.5) * eval_legendre(l, mu[imu]) *
|
|
|
|
|
orig_data[..., l])
|
2017-02-19 06:10:20 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_format == SCATTER_HISTOGRAM:
|
2017-02-15 20:27:31 -05:00
|
|
|
# This code uses the vectorized integration capabilities
|
|
|
|
|
# instead of having an isotropic and angle representation
|
|
|
|
|
# path.
|
|
|
|
|
# Set the histogram mu grid
|
2017-01-29 15:25:00 -05:00
|
|
|
mu = np.linspace(-1, 1, xsdata.num_orders + 1)
|
2017-02-15 20:27:31 -05:00
|
|
|
# For every bin perform simpson integration of a finely
|
|
|
|
|
# sampled orig_data
|
2017-01-29 15:25:00 -05:00
|
|
|
for h_bin in range(xsdata.num_orders):
|
2017-02-05 15:56:23 -05:00
|
|
|
mu_fine = np.linspace(mu[h_bin], mu[h_bin + 1], _NMU)
|
2017-02-15 20:27:31 -05:00
|
|
|
table_fine = np.zeros(new_data.shape[:-1] + (_NMU,))
|
2017-02-05 15:56:23 -05:00
|
|
|
for imu in range(len(mu_fine)):
|
2018-10-17 10:57:12 -04:00
|
|
|
for l in range(self.num_orders):
|
|
|
|
|
table_fine[..., imu] += ((l + 0.5)
|
|
|
|
|
* eval_legendre(l, mu_fine[imu]) *
|
|
|
|
|
orig_data[..., l])
|
2024-06-19 15:47:08 -05:00
|
|
|
new_data[..., h_bin] = integrate(table_fine, x=mu_fine)
|
2017-01-29 15:25:00 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.scatter_format == SCATTER_TABULAR:
|
2017-02-15 20:27:31 -05:00
|
|
|
# Calculate the mu points of the current data
|
2017-01-29 15:25:00 -05:00
|
|
|
mu_self = np.linspace(-1, 1, self.num_orders)
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
if target_format == SCATTER_LEGENDRE:
|
2017-02-15 20:27:31 -05:00
|
|
|
# Find the Legendre coefficients via integration. To best
|
2017-01-29 15:25:00 -05:00
|
|
|
# use the vectorized integration capabilities of scipy,
|
2017-02-15 20:27:31 -05:00
|
|
|
# this is done with fixed sample integration routines.
|
2017-01-29 15:25:00 -05:00
|
|
|
mu_fine = np.linspace(-1, 1, _NMU)
|
|
|
|
|
for l in range(xsdata.num_orders):
|
2020-03-23 14:56:14 -05:00
|
|
|
y = (interp1d(mu_self, orig_data)(mu_fine) *
|
|
|
|
|
eval_legendre(l, mu_fine))
|
2024-06-19 15:47:08 -05:00
|
|
|
new_data[..., l] = integrate(y, x=mu_fine)
|
2017-01-29 15:25:00 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_format == SCATTER_TABULAR:
|
2017-01-29 15:25:00 -05:00
|
|
|
# Simply use an interpolating function to get the new data
|
|
|
|
|
mu = np.linspace(-1, 1, xsdata.num_orders)
|
|
|
|
|
new_data[..., :] = interp1d(mu_self, orig_data)(mu)
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_format == SCATTER_HISTOGRAM:
|
2017-01-29 15:25:00 -05:00
|
|
|
# Use an interpolating function to do the bin-wise
|
|
|
|
|
# integrals
|
|
|
|
|
mu = np.linspace(-1, 1, xsdata.num_orders + 1)
|
|
|
|
|
|
|
|
|
|
# Like the tabular -> legendre path above, this code will
|
|
|
|
|
# be written to utilize the vectorized integration
|
|
|
|
|
# capabilities instead of having an isotropic and
|
|
|
|
|
# angle representation path.
|
|
|
|
|
interp = interp1d(mu_self, orig_data)
|
|
|
|
|
for h_bin in range(xsdata.num_orders):
|
|
|
|
|
mu_fine = np.linspace(mu[h_bin], mu[h_bin + 1], _NMU)
|
2024-06-19 15:47:08 -05:00
|
|
|
new_data[..., h_bin] = integrate(interp(mu_fine), x=mu_fine)
|
2017-01-29 15:25:00 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.scatter_format == SCATTER_HISTOGRAM:
|
2017-01-29 15:25:00 -05:00
|
|
|
# The histogram format does not have enough information to
|
2017-02-12 20:36:39 -05:00
|
|
|
# convert to the other forms without inducing some amount of
|
|
|
|
|
# error. We will make the assumption that the center of the bin
|
|
|
|
|
# has the value of the bin. The mu=-1 and 1 points will be
|
|
|
|
|
# extrapolated from the shape.
|
|
|
|
|
mu_midpoint = np.linspace(-1, 1, self.num_orders,
|
|
|
|
|
endpoint=False)
|
|
|
|
|
mu_midpoint += (mu_midpoint[1] - mu_midpoint[0]) * 0.5
|
|
|
|
|
interp = interp1d(mu_midpoint, orig_data,
|
|
|
|
|
fill_value='extrapolate')
|
|
|
|
|
# Now get the distribution normalization factor to take from
|
|
|
|
|
# an integral quantity to a point-wise quantity
|
|
|
|
|
norm = float(self.num_orders) / 2.0
|
|
|
|
|
|
|
|
|
|
# We now have a tabular distribution in tab_data on mu_self.
|
|
|
|
|
# We now proceed just like the tabular branch above.
|
2020-03-23 14:56:14 -05:00
|
|
|
if target_format == SCATTER_LEGENDRE:
|
2017-01-29 15:25:00 -05:00
|
|
|
# find the legendre coefficients via integration. To best
|
|
|
|
|
# use the vectorized integration capabilities of scipy,
|
|
|
|
|
# this will be done with fixed sample integration routines.
|
|
|
|
|
mu_fine = np.linspace(-1, 1, _NMU)
|
|
|
|
|
for l in range(xsdata.num_orders):
|
2020-03-23 14:56:14 -05:00
|
|
|
y = interp(mu_fine) * norm * eval_legendre(l, mu_fine)
|
2024-06-19 15:47:08 -05:00
|
|
|
new_data[..., l] = integrate(y, x=mu_fine)
|
2017-01-29 15:25:00 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_format == SCATTER_TABULAR:
|
2017-01-29 15:25:00 -05:00
|
|
|
# Simply use an interpolating function to get the new data
|
|
|
|
|
mu = np.linspace(-1, 1, xsdata.num_orders)
|
2017-02-12 20:36:39 -05:00
|
|
|
new_data[..., :] = interp(mu) * norm
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2020-03-23 14:56:14 -05:00
|
|
|
elif target_format == SCATTER_HISTOGRAM:
|
2017-01-29 15:25:00 -05:00
|
|
|
# Use an interpolating function to do the bin-wise
|
|
|
|
|
# integrals
|
|
|
|
|
mu = np.linspace(-1, 1, xsdata.num_orders + 1)
|
|
|
|
|
|
|
|
|
|
# Like the tabular -> legendre path above, this code will
|
|
|
|
|
# be written to utilize the vectorized integration
|
|
|
|
|
# capabilities instead of having an isotropic and
|
|
|
|
|
# angle representation path.
|
|
|
|
|
for h_bin in range(xsdata.num_orders):
|
|
|
|
|
mu_fine = np.linspace(mu[h_bin], mu[h_bin + 1], _NMU)
|
2017-02-12 20:36:39 -05:00
|
|
|
new_data[..., h_bin] = \
|
2024-06-19 15:47:08 -05:00
|
|
|
norm * integrate(interp(mu_fine), x=mu_fine)
|
2017-01-29 15:25:00 -05:00
|
|
|
|
2017-02-19 06:10:20 -05:00
|
|
|
# Remove small values resulting from numerical precision issues
|
|
|
|
|
new_data[..., np.abs(new_data) < 1.E-10] = 0.
|
2017-02-16 21:02:34 -05:00
|
|
|
|
2017-01-29 15:25:00 -05:00
|
|
|
xsdata.set_scatter_matrix(new_data, temp)
|
|
|
|
|
|
|
|
|
|
return xsdata
|
|
|
|
|
|
2016-10-10 15:19:47 -04:00
|
|
|
def to_hdf5(self, file):
|
|
|
|
|
"""Write XSdata to an HDF5 file
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
file : h5py.File
|
|
|
|
|
HDF5 File (a root Group) to write to
|
|
|
|
|
|
|
|
|
|
"""
|
2016-11-29 18:46:09 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
grp = file.create_group(self.name)
|
2016-10-10 15:19:47 -04:00
|
|
|
if self.atomic_weight_ratio is not None:
|
|
|
|
|
grp.attrs['atomic_weight_ratio'] = self.atomic_weight_ratio
|
2016-09-03 13:09:55 -04:00
|
|
|
if self.fissionable is not None:
|
|
|
|
|
grp.attrs['fissionable'] = self.fissionable
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
if self.representation is not None:
|
2024-03-26 11:00:06 -05:00
|
|
|
grp.attrs['representation'] = np.bytes_(self.representation)
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ANGLE:
|
2016-09-03 13:09:55 -04:00
|
|
|
if self.num_azimuthal is not None:
|
2016-10-10 15:19:47 -04:00
|
|
|
grp.attrs['num_azimuthal'] = self.num_azimuthal
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
if self.num_polar is not None:
|
2016-10-10 15:19:47 -04:00
|
|
|
grp.attrs['num_polar'] = self.num_polar
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2024-03-26 11:00:06 -05:00
|
|
|
grp.attrs['scatter_shape'] = np.bytes_("[G][G'][Order]")
|
2016-09-19 20:44:06 -04:00
|
|
|
if self.scatter_format is not None:
|
2024-03-26 11:00:06 -05:00
|
|
|
grp.attrs['scatter_format'] = np.bytes_(self.scatter_format)
|
2016-09-03 13:09:55 -04:00
|
|
|
if self.order is not None:
|
|
|
|
|
grp.attrs['order'] = self.order
|
|
|
|
|
|
2016-09-04 15:40:02 -04:00
|
|
|
ktg = grp.create_group('kTs')
|
|
|
|
|
for temperature in self.temperatures:
|
|
|
|
|
temp_label = str(int(np.round(temperature))) + "K"
|
|
|
|
|
kT = temperature * openmc.data.K_BOLTZMANN
|
|
|
|
|
ktg.create_dataset(temp_label, data=kT)
|
|
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
# Create the temperature datasets
|
|
|
|
|
for i, temperature in enumerate(self.temperatures):
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
xs_grp = grp.create_group(str(int(np.round(temperature))) + "K")
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-07 04:23:05 -04:00
|
|
|
if self._total[i] is None:
|
|
|
|
|
raise ValueError('total data must be provided when writing '
|
|
|
|
|
'the HDF5 library')
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
xs_grp.create_dataset("total", data=self._total[i])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-07 04:23:05 -04:00
|
|
|
if self._absorption[i] is None:
|
|
|
|
|
raise ValueError('absorption data must be provided when '
|
|
|
|
|
'writing the HDF5 library')
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-19 20:44:06 -04:00
|
|
|
xs_grp.create_dataset("absorption", data=self._absorption[i])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
if self.fissionable:
|
|
|
|
|
if self._fission[i] is not None:
|
2016-09-19 20:44:06 -04:00
|
|
|
xs_grp.create_dataset("fission", data=self._fission[i])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
if self._kappa_fission[i] is not None:
|
2016-09-19 20:44:06 -04:00
|
|
|
xs_grp.create_dataset("kappa-fission",
|
|
|
|
|
data=self._kappa_fission[i])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
if self._chi[i] is not None:
|
2016-09-19 20:44:06 -04:00
|
|
|
xs_grp.create_dataset("chi", data=self._chi[i])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
if self._chi_prompt[i] is not None:
|
|
|
|
|
xs_grp.create_dataset("chi-prompt",
|
|
|
|
|
data=self._chi_prompt[i])
|
|
|
|
|
|
|
|
|
|
if self._chi_delayed[i] is not None:
|
|
|
|
|
xs_grp.create_dataset("chi-delayed",
|
|
|
|
|
data=self._chi_delayed[i])
|
|
|
|
|
|
|
|
|
|
if self._nu_fission[i] is None and \
|
|
|
|
|
(self._delayed_nu_fission[i] is None or \
|
|
|
|
|
self._prompt_nu_fission[i] is None):
|
|
|
|
|
raise ValueError('nu-fission or prompt-nu-fission and '
|
2016-11-29 18:46:09 -05:00
|
|
|
'delayed-nu-fission data must be '
|
|
|
|
|
'provided when writing the HDF5 library')
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
if self._nu_fission[i] is not None:
|
2016-11-29 18:46:09 -05:00
|
|
|
xs_grp.create_dataset("nu-fission",
|
|
|
|
|
data=self._nu_fission[i])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
|
|
|
|
if self._prompt_nu_fission[i] is not None:
|
|
|
|
|
xs_grp.create_dataset("prompt-nu-fission",
|
|
|
|
|
data=self._prompt_nu_fission[i])
|
|
|
|
|
|
|
|
|
|
if self._delayed_nu_fission[i] is not None:
|
|
|
|
|
xs_grp.create_dataset("delayed-nu-fission",
|
|
|
|
|
data=self._delayed_nu_fission[i])
|
|
|
|
|
|
|
|
|
|
if self._beta[i] is not None:
|
|
|
|
|
xs_grp.create_dataset("beta", data=self._beta[i])
|
|
|
|
|
|
|
|
|
|
if self._decay_rate[i] is not None:
|
2020-08-28 17:42:15 +00:00
|
|
|
xs_grp.create_dataset("decay-rate",
|
2016-11-29 18:46:09 -05:00
|
|
|
data=self._decay_rate[i])
|
2016-09-07 04:23:05 -04:00
|
|
|
|
|
|
|
|
if self._scatter_matrix[i] is None:
|
|
|
|
|
raise ValueError('Scatter matrix must be provided when '
|
|
|
|
|
'writing the HDF5 library')
|
2016-09-19 20:44:06 -04:00
|
|
|
|
2016-09-07 04:23:05 -04:00
|
|
|
# Get the sparse scattering data to print to the library
|
|
|
|
|
G = self.energy_groups.num_groups
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-13 15:27:06 -05:00
|
|
|
Np = 1
|
|
|
|
|
Na = 1
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2016-09-07 04:23:05 -04:00
|
|
|
Np = self.num_polar
|
|
|
|
|
Na = self.num_azimuthal
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2021-04-26 09:22:45 -05:00
|
|
|
g_out_bounds = np.zeros((Np, Na, G, 2), dtype=int)
|
2016-11-13 15:27:06 -05:00
|
|
|
for p in range(Np):
|
|
|
|
|
for a in range(Na):
|
|
|
|
|
for g_in in range(G):
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.scatter_format == SCATTER_LEGENDRE:
|
|
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-13 15:27:06 -05:00
|
|
|
matrix = \
|
|
|
|
|
self._scatter_matrix[i][g_in, :, 0]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2016-11-13 13:29:45 -05:00
|
|
|
matrix = \
|
|
|
|
|
self._scatter_matrix[i][p, a, g_in, :, 0]
|
2017-01-29 15:25:00 -05:00
|
|
|
else:
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-13 15:27:06 -05:00
|
|
|
matrix = \
|
|
|
|
|
np.sum(self._scatter_matrix[i][g_in, :, :],
|
|
|
|
|
axis=1)
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2016-11-13 13:29:45 -05:00
|
|
|
matrix = \
|
|
|
|
|
np.sum(self._scatter_matrix[i][p, a, g_in, :, :],
|
|
|
|
|
axis=1)
|
2016-11-13 15:27:06 -05:00
|
|
|
nz = np.nonzero(matrix)
|
2016-11-27 06:34:47 -05:00
|
|
|
# It is possible that there only zeros in matrix
|
|
|
|
|
# and therefore nz will be empty, in that case set
|
|
|
|
|
# g_out_bounds to 0s
|
|
|
|
|
if len(nz[0]) == 0:
|
|
|
|
|
g_out_bounds[p, a, g_in, :] = 0
|
|
|
|
|
else:
|
|
|
|
|
g_out_bounds[p, a, g_in, 0] = nz[0][0]
|
|
|
|
|
g_out_bounds[p, a, g_in, 1] = nz[0][-1]
|
2016-11-13 15:27:06 -05:00
|
|
|
|
|
|
|
|
# Now create the flattened scatter matrix array
|
|
|
|
|
flat_scatt = []
|
|
|
|
|
for p in range(Np):
|
|
|
|
|
for a in range(Na):
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-13 15:27:06 -05:00
|
|
|
matrix = self._scatter_matrix[i][:, :, :]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2016-11-13 15:27:06 -05:00
|
|
|
matrix = self._scatter_matrix[i][p, a, :, :, :]
|
|
|
|
|
for g_in in range(G):
|
|
|
|
|
for g_out in range(g_out_bounds[p, a, g_in, 0],
|
|
|
|
|
g_out_bounds[p, a, g_in, 1] + 1):
|
|
|
|
|
for l in range(len(matrix[g_in, g_out, :])):
|
|
|
|
|
flat_scatt.append(matrix[g_in, g_out, l])
|
|
|
|
|
|
|
|
|
|
# And write it.
|
|
|
|
|
scatt_grp = xs_grp.create_group('scatter_data')
|
|
|
|
|
scatt_grp.create_dataset("scatter_matrix",
|
|
|
|
|
data=np.array(flat_scatt))
|
|
|
|
|
|
|
|
|
|
# Repeat for multiplicity
|
|
|
|
|
if self._multiplicity_matrix[i] is not None:
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-07 04:23:05 -04:00
|
|
|
# Now create the flattened scatter matrix array
|
2016-11-13 15:27:06 -05:00
|
|
|
flat_mult = []
|
2016-09-07 04:23:05 -04:00
|
|
|
for p in range(Np):
|
|
|
|
|
for a in range(Na):
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-13 15:27:06 -05:00
|
|
|
matrix = self._multiplicity_matrix[i][:, :]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2016-11-13 15:27:06 -05:00
|
|
|
matrix = self._multiplicity_matrix[i][p, a, :, :]
|
2016-09-09 20:39:05 -04:00
|
|
|
for g_in in range(G):
|
|
|
|
|
for g_out in range(g_out_bounds[p, a, g_in, 0],
|
|
|
|
|
g_out_bounds[p, a, g_in, 1] + 1):
|
2016-11-13 15:27:06 -05:00
|
|
|
flat_mult.append(matrix[g_in, g_out])
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-09-07 04:23:05 -04:00
|
|
|
# And write it.
|
2016-11-13 15:27:06 -05:00
|
|
|
scatt_grp.create_dataset("multiplicity_matrix",
|
|
|
|
|
data=np.array(flat_mult))
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-11-13 15:27:06 -05:00
|
|
|
# And finally, adjust g_out_bounds for 1-based group counting
|
|
|
|
|
# and write it.
|
|
|
|
|
g_out_bounds[:, :, :, :] += 1
|
2020-03-23 14:56:14 -05:00
|
|
|
if self.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-13 15:27:06 -05:00
|
|
|
scatt_grp.create_dataset("g_min", data=g_out_bounds[0, 0, :, 0])
|
|
|
|
|
scatt_grp.create_dataset("g_max", data=g_out_bounds[0, 0, :, 1])
|
2020-03-23 14:56:14 -05:00
|
|
|
elif self.representation == REPRESENTATION_ANGLE:
|
2016-09-19 20:44:06 -04:00
|
|
|
scatt_grp.create_dataset("g_min", data=g_out_bounds[:, :, :, 0])
|
|
|
|
|
scatt_grp.create_dataset("g_max", data=g_out_bounds[:, :, :, 1])
|
|
|
|
|
|
|
|
|
|
# Add the kinetics data
|
2016-10-13 14:38:06 -04:00
|
|
|
if self._inverse_velocity[i] is not None:
|
|
|
|
|
xs_grp.create_dataset("inverse-velocity",
|
|
|
|
|
data=self._inverse_velocity[i])
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-11-29 18:46:09 -05:00
|
|
|
@classmethod
|
|
|
|
|
def from_hdf5(cls, group, name, energy_groups, num_delayed_groups):
|
|
|
|
|
"""Generate XSdata object from an HDF5 group
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
group : h5py.Group
|
|
|
|
|
HDF5 group to read from
|
|
|
|
|
name : str
|
|
|
|
|
Name of the mgxs data set.
|
|
|
|
|
energy_groups : openmc.mgxs.EnergyGroups
|
|
|
|
|
Energy group structure
|
|
|
|
|
num_delayed_groups : int
|
|
|
|
|
Number of delayed groups
|
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
openmc.XSdata
|
|
|
|
|
Multi-group cross section data
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Get a list of all the subgroups which will contain our temperature
|
|
|
|
|
# strings
|
|
|
|
|
subgroups = group.keys()
|
|
|
|
|
temperatures = []
|
|
|
|
|
for subgroup in subgroups:
|
|
|
|
|
if subgroup != 'kTs':
|
|
|
|
|
temperatures.append(subgroup)
|
|
|
|
|
|
|
|
|
|
# To ensure the actual floating point temperature used when creating
|
|
|
|
|
# the new library is consistent with that used when originally creating
|
|
|
|
|
# the file, get the floating point temperatures straight from the kTs
|
|
|
|
|
# group.
|
|
|
|
|
kTs_group = group['kTs']
|
|
|
|
|
float_temperatures = []
|
|
|
|
|
for temperature in temperatures:
|
2019-03-27 11:45:48 -04:00
|
|
|
kT = kTs_group[temperature][()]
|
2016-11-29 18:46:09 -05:00
|
|
|
float_temperatures.append(kT / openmc.data.K_BOLTZMANN)
|
|
|
|
|
|
|
|
|
|
attrs = group.attrs.keys()
|
|
|
|
|
if 'representation' in attrs:
|
|
|
|
|
representation = group.attrs['representation'].decode()
|
|
|
|
|
else:
|
2020-03-23 14:56:14 -05:00
|
|
|
representation = REPRESENTATION_ISOTROPIC
|
2016-11-29 18:46:09 -05:00
|
|
|
|
|
|
|
|
data = cls(name, energy_groups, float_temperatures, representation,
|
|
|
|
|
num_delayed_groups)
|
|
|
|
|
|
|
|
|
|
if 'scatter_format' in attrs:
|
|
|
|
|
data.scatter_format = group.attrs['scatter_format'].decode()
|
|
|
|
|
|
|
|
|
|
# Get the remaining optional attributes
|
|
|
|
|
if 'atomic_weight_ratio' in attrs:
|
|
|
|
|
data.atomic_weight_ratio = group.attrs['atomic_weight_ratio']
|
|
|
|
|
if 'order' in attrs:
|
|
|
|
|
data.order = group.attrs['order']
|
2020-03-23 14:56:14 -05:00
|
|
|
if data.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
data.num_azimuthal = group.attrs['num_azimuthal']
|
|
|
|
|
data.num_polar = group.attrs['num_polar']
|
|
|
|
|
|
|
|
|
|
# Read the temperature-dependent datasets
|
|
|
|
|
for temp, float_temp in zip(temperatures, float_temperatures):
|
|
|
|
|
xs_types = ['total', 'absorption', 'fission', 'kappa-fission',
|
|
|
|
|
'chi', 'chi-prompt', 'chi-delayed', 'nu-fission',
|
|
|
|
|
'prompt-nu-fission', 'delayed-nu-fission', 'beta',
|
2020-08-28 17:42:15 +00:00
|
|
|
'decay-rate', 'inverse-velocity']
|
2016-11-29 18:46:09 -05:00
|
|
|
|
|
|
|
|
temperature_group = group[temp]
|
|
|
|
|
|
|
|
|
|
for xs_type in xs_types:
|
|
|
|
|
set_func = 'set_' + xs_type.replace(' ', '_').replace('-', '_')
|
|
|
|
|
if xs_type in temperature_group:
|
2019-03-27 11:45:48 -04:00
|
|
|
getattr(data, set_func)(temperature_group[xs_type][()],
|
2016-11-29 18:46:09 -05:00
|
|
|
float_temp)
|
|
|
|
|
|
|
|
|
|
scatt_group = temperature_group['scatter_data']
|
|
|
|
|
|
|
|
|
|
# Get scatter matrix and 'un-flatten' it
|
|
|
|
|
g_max = scatt_group['g_max']
|
|
|
|
|
g_min = scatt_group['g_min']
|
2019-03-27 11:45:48 -04:00
|
|
|
flat_scatter = scatt_group['scatter_matrix'][()]
|
2016-11-29 18:46:09 -05:00
|
|
|
scatter_matrix = np.zeros(data.xs_shapes["[G][G'][Order]"])
|
|
|
|
|
G = data.energy_groups.num_groups
|
2020-03-23 14:56:14 -05:00
|
|
|
if data.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-29 18:46:09 -05:00
|
|
|
Np = 1
|
|
|
|
|
Na = 1
|
2020-03-23 14:56:14 -05:00
|
|
|
elif data.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
Np = data.num_polar
|
|
|
|
|
Na = data.num_azimuthal
|
|
|
|
|
flat_index = 0
|
|
|
|
|
for p in range(Np):
|
|
|
|
|
for a in range(Na):
|
|
|
|
|
for g_in in range(G):
|
2020-03-23 14:56:14 -05:00
|
|
|
if data.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-29 18:46:09 -05:00
|
|
|
g_mins = g_min[g_in]
|
|
|
|
|
g_maxs = g_max[g_in]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif data.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
g_mins = g_min[p, a, g_in]
|
|
|
|
|
g_maxs = g_max[p, a, g_in]
|
|
|
|
|
for g_out in range(g_mins - 1, g_maxs):
|
|
|
|
|
for ang in range(data.num_orders):
|
2020-03-23 14:56:14 -05:00
|
|
|
if data.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-29 18:46:09 -05:00
|
|
|
scatter_matrix[g_in, g_out, ang] = \
|
|
|
|
|
flat_scatter[flat_index]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif data.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
scatter_matrix[p, a, g_in, g_out, ang] = \
|
|
|
|
|
flat_scatter[flat_index]
|
|
|
|
|
flat_index += 1
|
|
|
|
|
data.set_scatter_matrix(scatter_matrix, float_temp)
|
|
|
|
|
|
|
|
|
|
# Repeat for multiplicity
|
|
|
|
|
if 'multiplicity_matrix' in scatt_group:
|
2019-03-27 11:45:48 -04:00
|
|
|
flat_mult = scatt_group['multiplicity_matrix'][()]
|
2016-11-29 18:46:09 -05:00
|
|
|
mult_matrix = np.zeros(data.xs_shapes["[G][G']"])
|
|
|
|
|
flat_index = 0
|
|
|
|
|
for p in range(Np):
|
|
|
|
|
for a in range(Na):
|
|
|
|
|
for g_in in range(G):
|
2020-03-23 14:56:14 -05:00
|
|
|
if data.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-29 18:46:09 -05:00
|
|
|
g_mins = g_min[g_in]
|
|
|
|
|
g_maxs = g_max[g_in]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif data.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
g_mins = g_min[p, a, g_in]
|
|
|
|
|
g_maxs = g_max[p, a, g_in]
|
|
|
|
|
for g_out in range(g_mins - 1, g_maxs):
|
2020-03-23 14:56:14 -05:00
|
|
|
if data.representation == REPRESENTATION_ISOTROPIC:
|
2016-11-29 18:46:09 -05:00
|
|
|
mult_matrix[g_in, g_out] = \
|
|
|
|
|
flat_mult[flat_index]
|
2020-03-23 14:56:14 -05:00
|
|
|
elif data.representation == REPRESENTATION_ANGLE:
|
2016-11-29 18:46:09 -05:00
|
|
|
mult_matrix[p, a, g_in, g_out] = \
|
|
|
|
|
flat_mult[flat_index]
|
|
|
|
|
flat_index += 1
|
|
|
|
|
data.set_multiplicity_matrix(mult_matrix, float_temp)
|
|
|
|
|
|
|
|
|
|
return data
|
|
|
|
|
|
2016-02-22 19:51:34 -05:00
|
|
|
|
2020-03-19 15:21:15 -05:00
|
|
|
class MGXSLibrary:
|
2015-11-15 15:03:23 -05:00
|
|
|
"""Multi-Group Cross Sections file used for an OpenMC simulation.
|
2016-04-30 16:08:47 -04:00
|
|
|
Corresponds directly to the MG version of the cross_sections.xml input
|
|
|
|
|
file.
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
energy_groups : openmc.mgxs.EnergyGroups
|
2016-09-19 20:44:06 -04:00
|
|
|
Energy group structure
|
2016-10-18 23:11:17 -04:00
|
|
|
num_delayed_groups : int
|
2016-10-13 14:38:06 -04:00
|
|
|
Num delayed groups
|
2016-09-03 13:09:55 -04:00
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
Attributes
|
|
|
|
|
----------
|
|
|
|
|
energy_groups : openmc.mgxs.EnergyGroups
|
|
|
|
|
Energy group structure.
|
2016-10-18 23:11:17 -04:00
|
|
|
num_delayed_groups : int
|
2016-10-13 14:38:06 -04:00
|
|
|
Num delayed groups
|
2016-04-13 22:17:16 -05:00
|
|
|
xsdatas : Iterable of openmc.XSdata
|
2016-01-07 20:20:55 -05:00
|
|
|
Iterable of multi-Group cross section data objects
|
2015-11-15 15:03:23 -05:00
|
|
|
"""
|
|
|
|
|
|
2016-10-18 23:11:17 -04:00
|
|
|
def __init__(self, energy_groups, num_delayed_groups=0):
|
2016-09-03 13:09:55 -04:00
|
|
|
self.energy_groups = energy_groups
|
2016-10-18 23:11:17 -04:00
|
|
|
self.num_delayed_groups = num_delayed_groups
|
2016-09-03 13:09:55 -04:00
|
|
|
self._xsdatas = []
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
def __deepcopy__(self, memo):
|
|
|
|
|
existing = memo.get(id(self))
|
|
|
|
|
|
|
|
|
|
# If this is the first time we have tried to copy this object, copy it
|
|
|
|
|
if existing is None:
|
|
|
|
|
clone = type(self).__new__(type(self))
|
|
|
|
|
clone._energy_groups = copy.deepcopy(self.energy_groups, memo)
|
|
|
|
|
clone._num_delayed_groups = self.num_delayed_groups
|
|
|
|
|
clone._xsdatas = copy.deepcopy(self.xsdatas, memo)
|
|
|
|
|
|
|
|
|
|
memo[id(self)] = clone
|
|
|
|
|
|
|
|
|
|
return clone
|
|
|
|
|
|
|
|
|
|
# If this object has been copied before, return the first copy made
|
|
|
|
|
else:
|
|
|
|
|
return existing
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
@property
|
|
|
|
|
def energy_groups(self):
|
|
|
|
|
return self._energy_groups
|
|
|
|
|
|
|
|
|
|
@energy_groups.setter
|
|
|
|
|
def energy_groups(self, energy_groups):
|
2016-05-10 04:45:02 -04:00
|
|
|
check_type('energy groups', energy_groups, openmc.mgxs.EnergyGroups)
|
2015-11-15 15:03:23 -05:00
|
|
|
self._energy_groups = energy_groups
|
|
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@property
|
|
|
|
|
def num_delayed_groups(self):
|
|
|
|
|
return self._num_delayed_groups
|
|
|
|
|
|
2016-10-18 23:11:17 -04:00
|
|
|
@num_delayed_groups.setter
|
|
|
|
|
def num_delayed_groups(self, num_delayed_groups):
|
2016-11-29 18:46:09 -05:00
|
|
|
check_type('num_delayed_groups', num_delayed_groups, Integral)
|
2016-10-19 10:45:57 -04:00
|
|
|
check_greater_than('num_delayed_groups', num_delayed_groups, 0,
|
2016-10-18 23:33:47 -04:00
|
|
|
equality=True)
|
2016-10-19 10:45:57 -04:00
|
|
|
check_less_than('num_delayed_groups', num_delayed_groups,
|
|
|
|
|
openmc.mgxs.MAX_DELAYED_GROUPS, equality=True)
|
2016-10-18 23:11:17 -04:00
|
|
|
self._num_delayed_groups = num_delayed_groups
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2023-06-17 04:34:02 +01:00
|
|
|
@property
|
|
|
|
|
def xsdatas(self):
|
|
|
|
|
return self._xsdatas
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def names(self):
|
|
|
|
|
return [xsdata.name for xsdata in self.xsdatas]
|
|
|
|
|
|
2015-11-15 15:03:23 -05:00
|
|
|
def add_xsdata(self, xsdata):
|
2016-01-07 20:31:56 -05:00
|
|
|
"""Add an XSdata entry to the file.
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-04-13 22:17:16 -05:00
|
|
|
xsdata : openmc.XSdata
|
2015-11-15 15:03:23 -05:00
|
|
|
MGXS information to add
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-01-07 20:31:56 -05:00
|
|
|
if not isinstance(xsdata, XSdata):
|
2021-07-29 18:25:37 +01:00
|
|
|
msg = f'Unable to add a non-XSdata "{xsdata}" to the ' \
|
|
|
|
|
'MGXSLibrary instance'
|
2015-11-15 15:03:23 -05:00
|
|
|
raise ValueError(msg)
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2015-11-16 05:31:16 -05:00
|
|
|
if xsdata.energy_groups != self._energy_groups:
|
2016-04-26 07:08:03 -05:00
|
|
|
msg = 'Energy groups of XSdata do not match that of MGXSLibrary.'
|
2015-11-15 15:03:23 -05:00
|
|
|
raise ValueError(msg)
|
|
|
|
|
|
|
|
|
|
self._xsdatas.append(xsdata)
|
|
|
|
|
|
|
|
|
|
def add_xsdatas(self, xsdatas):
|
2016-11-29 18:46:09 -05:00
|
|
|
"""Add multiple XSdatas to the file.
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-04-13 22:17:16 -05:00
|
|
|
xsdatas : tuple or list of openmc.XSdata
|
2016-01-07 20:31:56 -05:00
|
|
|
XSdatas to add
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
"""
|
2016-10-13 14:38:06 -04:00
|
|
|
|
2016-05-11 21:19:30 -04:00
|
|
|
check_iterable_type('xsdatas', xsdatas, XSdata)
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
for xsdata in xsdatas:
|
|
|
|
|
self.add_xsdata(xsdata)
|
|
|
|
|
|
|
|
|
|
def remove_xsdata(self, xsdata):
|
|
|
|
|
"""Remove a xsdata from the file
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2016-04-13 22:17:16 -05:00
|
|
|
xsdata : openmc.XSdata
|
2016-01-07 20:31:56 -05:00
|
|
|
XSdata to remove
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2016-01-07 20:31:56 -05:00
|
|
|
if not isinstance(xsdata, XSdata):
|
2021-07-29 18:25:37 +01:00
|
|
|
msg = f'Unable to remove a non-XSdata "{xsdata}" from the ' \
|
|
|
|
|
'MGXSLibrary instance'
|
2015-11-15 15:03:23 -05:00
|
|
|
raise ValueError(msg)
|
|
|
|
|
|
|
|
|
|
self._xsdatas.remove(xsdata)
|
|
|
|
|
|
2016-11-29 18:46:09 -05:00
|
|
|
def get_by_name(self, name):
|
|
|
|
|
"""Access the XSdata objects by name
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
name : str
|
|
|
|
|
Name of openmc.XSdata object to obtain
|
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
result : openmc.XSdata or None
|
|
|
|
|
Provides the matching XSdata object or None, if not found
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
check_type("name", name, str)
|
|
|
|
|
result = None
|
|
|
|
|
for xsdata in self.xsdatas:
|
|
|
|
|
if name == xsdata.name:
|
|
|
|
|
result = xsdata
|
|
|
|
|
return result
|
|
|
|
|
|
2017-01-28 11:34:29 -05:00
|
|
|
def convert_representation(self, target_representation, num_polar=None,
|
|
|
|
|
num_azimuthal=None):
|
2017-02-16 21:02:34 -05:00
|
|
|
"""Produce a new XSdata object with the same data, but converted to the
|
|
|
|
|
new representation (isotropic or angle-dependent).
|
|
|
|
|
|
|
|
|
|
This method cannot be used to change the number of polar or
|
|
|
|
|
azimuthal bins of an XSdata object that already uses an angular
|
|
|
|
|
representation. Finally, this method simply uses an arithmetic mean to
|
|
|
|
|
convert from an angular to isotropic representation; no flux-weighting
|
2017-02-18 05:20:30 -05:00
|
|
|
is applied and therefore the reaction rates will not be preserved.
|
2017-01-28 11:34:29 -05:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
target_representation : {'isotropic', 'angle'}
|
|
|
|
|
Representation of the MGXS (isotropic or angle-dependent flux
|
|
|
|
|
weighting).
|
|
|
|
|
num_polar : int, optional
|
2017-03-01 07:10:51 -06:00
|
|
|
Number of equal width angular bins that the polar angular domain is
|
|
|
|
|
subdivided into. This is required when `target_representation` is
|
|
|
|
|
"angle".
|
2017-01-28 11:34:29 -05:00
|
|
|
num_azimuthal : int, optional
|
2017-03-01 07:10:51 -06:00
|
|
|
Number of equal width angular bins that the azimuthal angular domain
|
|
|
|
|
is subdivided into. This is required when `target_representation` is
|
|
|
|
|
"angle".
|
2017-01-28 11:34:29 -05:00
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
openmc.MGXSLibrary
|
|
|
|
|
Multi-group Library with the same data as self, but represented as
|
2017-03-01 07:10:51 -06:00
|
|
|
specified in `target_representation`.
|
2017-01-28 11:34:29 -05:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
library = copy.deepcopy(self)
|
|
|
|
|
for i, xsdata in enumerate(self.xsdatas):
|
|
|
|
|
library.xsdatas[i] = \
|
|
|
|
|
xsdata.convert_representation(target_representation,
|
|
|
|
|
num_polar, num_azimuthal)
|
|
|
|
|
return library
|
|
|
|
|
|
2017-01-28 13:44:38 -05:00
|
|
|
def convert_scatter_format(self, target_format, target_order):
|
|
|
|
|
"""Produce a new MGXSLibrary object with the same data, but converted
|
|
|
|
|
to the new scatter format and order
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2017-01-29 15:25:00 -05:00
|
|
|
target_format : {'tabular', 'legendre', 'histogram'}
|
|
|
|
|
Representation of the scattering angle distribution
|
2017-01-28 13:44:38 -05:00
|
|
|
target_order : int
|
|
|
|
|
Either the Legendre target_order, number of bins, or number of
|
|
|
|
|
points used to describe the angular distribution associated with
|
2017-01-29 15:25:00 -05:00
|
|
|
each group-to-group transfer probability
|
2017-01-28 13:44:38 -05:00
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
openmc.MGXSLibrary
|
2017-03-01 07:10:51 -06:00
|
|
|
Multi-group Library with the same data as self, but with the scatter
|
|
|
|
|
format represented as specified in `target_format` and
|
|
|
|
|
`target_order`.
|
2017-01-28 13:44:38 -05:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
library = copy.deepcopy(self)
|
|
|
|
|
for i, xsdata in enumerate(self.xsdatas):
|
|
|
|
|
library.xsdatas[i] = \
|
|
|
|
|
xsdata.convert_scatter_format(target_format, target_order)
|
|
|
|
|
|
|
|
|
|
return library
|
|
|
|
|
|
2017-12-17 19:48:08 -05:00
|
|
|
def export_to_hdf5(self, filename='mgxs.h5', libver='earliest'):
|
2016-09-19 20:44:06 -04:00
|
|
|
"""Create an hdf5 file that can be used for a simulation.
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2025-10-20 18:45:14 +02:00
|
|
|
filename : str or PathLike
|
2016-09-19 20:44:06 -04:00
|
|
|
Filename of file, default is mgxs.h5.
|
2017-12-17 19:48:08 -05:00
|
|
|
libver : {'earliest', 'latest'}
|
|
|
|
|
Compatibility mode for the HDF5 file. 'latest' will produce files
|
|
|
|
|
that are less backwards compatible but have performance benefits.
|
2015-11-15 15:03:23 -05:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2025-10-28 20:20:11 +05:30
|
|
|
check_type('filename', filename, (str, PathLike))
|
2016-09-03 13:09:55 -04:00
|
|
|
# Create and write to the HDF5 file
|
2017-12-17 19:48:08 -05:00
|
|
|
file = h5py.File(filename, "w", libver=libver)
|
2024-03-26 11:00:06 -05:00
|
|
|
file.attrs['filetype'] = np.bytes_(_FILETYPE_MGXS_LIBRARY)
|
2017-03-18 10:13:16 -04:00
|
|
|
file.attrs['version'] = [_VERSION_MGXS_LIBRARY, 0]
|
2016-10-13 14:38:06 -04:00
|
|
|
file.attrs['energy_groups'] = self.energy_groups.num_groups
|
2016-10-18 23:11:17 -04:00
|
|
|
file.attrs['delayed_groups'] = self.num_delayed_groups
|
2016-09-03 13:09:55 -04:00
|
|
|
file.attrs['group structure'] = self.energy_groups.group_edges
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
for xsdata in self._xsdatas:
|
2016-10-10 15:19:47 -04:00
|
|
|
xsdata.to_hdf5(file)
|
2015-11-15 15:03:23 -05:00
|
|
|
|
2016-09-03 13:09:55 -04:00
|
|
|
file.close()
|
2016-11-29 18:46:09 -05:00
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def from_hdf5(cls, filename=None):
|
|
|
|
|
"""Generate an MGXS Library from an HDF5 group or file
|
2016-12-13 19:55:54 -06:00
|
|
|
|
2016-11-29 18:46:09 -05:00
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
filename : str, optional
|
|
|
|
|
Name of HDF5 file containing MGXS data. Default is None.
|
2022-08-31 22:23:29 -05:00
|
|
|
If not provided, openmc.config['mg_cross_sections'] will be used.
|
2016-12-13 19:55:54 -06:00
|
|
|
|
2016-11-29 18:46:09 -05:00
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
openmc.MGXSLibrary
|
|
|
|
|
Multi-group cross section data object.
|
|
|
|
|
|
2016-12-13 19:55:54 -06:00
|
|
|
"""
|
2022-08-31 22:23:29 -05:00
|
|
|
# If filename is None, get the cross sections from openmc.config
|
2016-11-29 18:46:09 -05:00
|
|
|
if filename is None:
|
2022-08-31 22:23:29 -05:00
|
|
|
filename = openmc.config.get('mg_cross_sections')
|
2016-11-29 18:46:09 -05:00
|
|
|
|
|
|
|
|
# Check to make sure there was an environmental variable.
|
|
|
|
|
if filename is None:
|
2022-08-31 22:23:29 -05:00
|
|
|
raise ValueError("Either path or openmc.config['mg_cross_sections']"
|
|
|
|
|
"must be set")
|
2016-11-29 18:46:09 -05:00
|
|
|
|
2025-10-28 20:20:11 +05:30
|
|
|
check_type('filename', filename, (str, PathLike))
|
2026-01-06 23:59:38 +01:00
|
|
|
with h5py.File(filename, 'r') as file:
|
2016-11-29 18:46:09 -05:00
|
|
|
|
2026-01-06 23:59:38 +01:00
|
|
|
# Check filetype and version
|
|
|
|
|
check_filetype_version(file, _FILETYPE_MGXS_LIBRARY,
|
|
|
|
|
_VERSION_MGXS_LIBRARY)
|
2017-03-18 10:13:16 -04:00
|
|
|
|
2026-01-06 23:59:38 +01:00
|
|
|
group_structure = file.attrs['group structure']
|
|
|
|
|
num_delayed_groups = file.attrs['delayed_groups']
|
|
|
|
|
energy_groups = openmc.mgxs.EnergyGroups(group_structure)
|
|
|
|
|
data = cls(energy_groups, num_delayed_groups)
|
2016-11-29 18:46:09 -05:00
|
|
|
|
2026-01-06 23:59:38 +01:00
|
|
|
for group_name, group in file.items():
|
|
|
|
|
data.add_xsdata(openmc.XSdata.from_hdf5(group, group_name,
|
|
|
|
|
energy_groups,
|
|
|
|
|
num_delayed_groups))
|
2016-11-29 18:46:09 -05:00
|
|
|
|
|
|
|
|
return data
|