diff --git a/examples/python/basic/build-xml.py b/examples/python/basic/build-xml.py
index 4dc1c72e00..f248c0a8ac 100644
--- a/examples/python/basic/build-xml.py
+++ b/examples/python/basic/build-xml.py
@@ -15,21 +15,16 @@ particles = 10000
# Exporting to OpenMC materials.xml file
###############################################################################
-# Instantiate some Nuclides
-h1 = openmc.Nuclide('H1')
-o16 = openmc.Nuclide('O16')
-u235 = openmc.Nuclide('U235')
-
# Instantiate some Materials and register the appropriate Nuclides
moderator = openmc.Material(material_id=41, name='moderator')
moderator.set_density('g/cc', 1.0)
-moderator.add_nuclide(h1, 2.)
-moderator.add_nuclide(o16, 1.)
+moderator.add_element('H', 2.)
+moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')
fuel = openmc.Material(material_id=40, name='fuel')
fuel.set_density('g/cc', 4.5)
-fuel.add_nuclide(u235, 1.)
+fuel.add_nuclide('U235', 1.)
# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([moderator, fuel])
diff --git a/examples/python/boxes/build-xml.py b/examples/python/boxes/build-xml.py
index 308019e7dc..03e81b073b 100644
--- a/examples/python/boxes/build-xml.py
+++ b/examples/python/boxes/build-xml.py
@@ -15,25 +15,19 @@ particles = 10000
# Exporting to OpenMC materials.xml File
###############################################################################
-# Instantiate some Nuclides
-h1 = openmc.Nuclide('H1')
-o16 = openmc.Nuclide('O16')
-u235 = openmc.Nuclide('U235')
-u238 = openmc.Nuclide('U238')
-
# Instantiate some Materials and register the appropriate Nuclides
fuel1 = openmc.Material(material_id=1, name='fuel')
fuel1.set_density('g/cc', 4.5)
-fuel1.add_nuclide(u235, 1.)
+fuel1.add_nuclide('U235', 1.)
fuel2 = openmc.Material(material_id=2, name='depleted fuel')
fuel2.set_density('g/cc', 4.5)
-fuel2.add_nuclide(u238, 1.)
+fuel2.add_nuclide('U238', 1.)
moderator = openmc.Material(material_id=3, name='moderator')
moderator.set_density('g/cc', 1.0)
-moderator.add_nuclide(h1, 2.)
-moderator.add_nuclide(o16, 1.)
+moderator.add_element('H', 2.)
+moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')
# Instantiate a Materials collection and export to XML
diff --git a/examples/python/lattice/hexagonal/build-xml.py b/examples/python/lattice/hexagonal/build-xml.py
index 2b0bab38a9..8d124930fe 100644
--- a/examples/python/lattice/hexagonal/build-xml.py
+++ b/examples/python/lattice/hexagonal/build-xml.py
@@ -14,26 +14,20 @@ particles = 10000
# Exporting to OpenMC materials.xml File
###############################################################################
-# Instantiate some Nuclides
-h1 = openmc.Nuclide('H1')
-o16 = openmc.Nuclide('O16')
-u235 = openmc.Nuclide('U235')
-fe56 = openmc.Nuclide('Fe56')
-
# Instantiate some Materials and register the appropriate Nuclides
fuel = openmc.Material(material_id=1, name='fuel')
fuel.set_density('g/cc', 4.5)
-fuel.add_nuclide(u235, 1.)
+fuel.add_nuclide('U235', 1.)
moderator = openmc.Material(material_id=2, name='moderator')
moderator.set_density('g/cc', 1.0)
-moderator.add_nuclide(h1, 2.)
-moderator.add_nuclide(o16, 1.)
+moderator.add_element('H', 2.)
+moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')
iron = openmc.Material(material_id=3, name='iron')
iron.set_density('g/cc', 7.9)
-iron.add_nuclide(fe56, 1.)
+iron.add_element('Fe', 1.)
# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([moderator, fuel, iron])
diff --git a/examples/python/lattice/nested/build-xml.py b/examples/python/lattice/nested/build-xml.py
index 2357d0bb70..363d0db90c 100644
--- a/examples/python/lattice/nested/build-xml.py
+++ b/examples/python/lattice/nested/build-xml.py
@@ -14,20 +14,15 @@ particles = 10000
# Exporting to OpenMC materials.xml file
###############################################################################
-# Instantiate some Nuclides
-h1 = openmc.Nuclide('H1')
-o16 = openmc.Nuclide('O16')
-u235 = openmc.Nuclide('U235')
-
# Instantiate some Materials and register the appropriate Nuclides
fuel = openmc.Material(material_id=1, name='fuel')
fuel.set_density('g/cc', 4.5)
-fuel.add_nuclide(u235, 1.)
+fuel.add_nuclide('U235', 1.)
moderator = openmc.Material(material_id=2, name='moderator')
moderator.set_density('g/cc', 1.0)
-moderator.add_nuclide(h1, 2.)
-moderator.add_nuclide(o16, 1.)
+moderator.add_element('H', 2.)
+moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')
# Instantiate a Materials collection and export to XML
diff --git a/examples/python/lattice/simple/build-xml.py b/examples/python/lattice/simple/build-xml.py
index 06139f0911..354ce9cc49 100644
--- a/examples/python/lattice/simple/build-xml.py
+++ b/examples/python/lattice/simple/build-xml.py
@@ -14,20 +14,15 @@ particles = 10000
# Exporting to OpenMC materials.xml file
###############################################################################
-# Instantiate some Nuclides
-h1 = openmc.Nuclide('H1')
-o16 = openmc.Nuclide('O16')
-u235 = openmc.Nuclide('U235')
-
# Instantiate some Materials and register the appropriate Nuclides
fuel = openmc.Material(material_id=1, name='fuel')
fuel.set_density('g/cc', 4.5)
-fuel.add_nuclide(u235, 1.)
+fuel.add_nuclide('U235', 1.)
moderator = openmc.Material(material_id=2, name='moderator')
moderator.set_density('g/cc', 1.0)
-moderator.add_nuclide(h1, 2.)
-moderator.add_nuclide(o16, 1.)
+moderator.add_element('H', 2.)
+moderator.add_element('O', 1.)
moderator.add_s_alpha_beta('c_H_in_H2O')
# Instantiate a Materials collection and export to XML
diff --git a/examples/python/pincell/build-xml.py b/examples/python/pincell/build-xml.py
index cf01ba852e..4d41a3126c 100644
--- a/examples/python/pincell/build-xml.py
+++ b/examples/python/pincell/build-xml.py
@@ -14,86 +14,29 @@ particles = 1000
# Exporting to OpenMC materials.xml file
###############################################################################
-# Instantiate some Nuclides
-h1 = openmc.Nuclide('H1')
-h2 = openmc.Nuclide('H2')
-he4 = openmc.Nuclide('He4')
-b10 = openmc.Nuclide('B10')
-b11 = openmc.Nuclide('B11')
-o16 = openmc.Nuclide('O16')
-o17 = openmc.Nuclide('O17')
-cr50 = openmc.Nuclide('Cr50')
-cr52 = openmc.Nuclide('Cr52')
-cr53 = openmc.Nuclide('Cr53')
-cr54 = openmc.Nuclide('Cr54')
-fe54 = openmc.Nuclide('Fe54')
-fe56 = openmc.Nuclide('Fe56')
-fe57 = openmc.Nuclide('Fe57')
-fe58 = openmc.Nuclide('Fe58')
-zr90 = openmc.Nuclide('Zr90')
-zr91 = openmc.Nuclide('Zr91')
-zr92 = openmc.Nuclide('Zr92')
-zr94 = openmc.Nuclide('Zr94')
-zr96 = openmc.Nuclide('Zr96')
-sn112 = openmc.Nuclide('Sn112')
-sn114 = openmc.Nuclide('Sn114')
-sn115 = openmc.Nuclide('Sn115')
-sn116 = openmc.Nuclide('Sn116')
-sn117 = openmc.Nuclide('Sn117')
-sn118 = openmc.Nuclide('Sn118')
-sn119 = openmc.Nuclide('Sn119')
-sn120 = openmc.Nuclide('Sn120')
-sn122 = openmc.Nuclide('Sn122')
-sn124 = openmc.Nuclide('Sn124')
-u = openmc.Element('U')
-o = openmc.Element('O')
# Instantiate some Materials and register the appropriate Nuclides
uo2 = openmc.Material(material_id=1, name='UO2 fuel at 2.4% wt enrichment')
uo2.set_density('g/cm3', 10.29769)
-uo2.add_element(u, 1., enrichment=2.4)
-uo2.add_element(o, 2.)
+uo2.add_element('U', 1., enrichment=2.4)
+uo2.add_element('O', 2.)
helium = openmc.Material(material_id=2, name='Helium for gap')
helium.set_density('g/cm3', 0.001598)
-helium.add_nuclide(he4, 2.4044e-4)
+helium.add_element('He', 2.4044e-4)
zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')
zircaloy.set_density('g/cm3', 6.55)
-zircaloy.add_nuclide(o16, 3.0743e-4)
-zircaloy.add_nuclide(o17, 7.4887e-7)
-zircaloy.add_nuclide(cr50, 3.2962e-6)
-zircaloy.add_nuclide(cr52, 6.3564e-5)
-zircaloy.add_nuclide(cr53, 7.2076e-6)
-zircaloy.add_nuclide(cr54, 1.7941e-6)
-zircaloy.add_nuclide(fe54, 8.6699e-6)
-zircaloy.add_nuclide(fe56, 1.3610e-4)
-zircaloy.add_nuclide(fe57, 3.1431e-6)
-zircaloy.add_nuclide(fe58, 4.1829e-7)
-zircaloy.add_nuclide(zr90, 2.1827e-2)
-zircaloy.add_nuclide(zr91, 4.7600e-3)
-zircaloy.add_nuclide(zr92, 7.2758e-3)
-zircaloy.add_nuclide(zr94, 7.3734e-3)
-zircaloy.add_nuclide(zr96, 1.1879e-3)
-zircaloy.add_nuclide(sn112, 4.6735e-6)
-zircaloy.add_nuclide(sn114, 3.1799e-6)
-zircaloy.add_nuclide(sn115, 1.6381e-6)
-zircaloy.add_nuclide(sn116, 7.0055e-5)
-zircaloy.add_nuclide(sn117, 3.7003e-5)
-zircaloy.add_nuclide(sn118, 1.1669e-4)
-zircaloy.add_nuclide(sn119, 4.1387e-5)
-zircaloy.add_nuclide(sn120, 1.5697e-4)
-zircaloy.add_nuclide(sn122, 2.2308e-5)
-zircaloy.add_nuclide(sn124, 2.7897e-5)
+zircaloy.add_element('Sn', 0.014 , 'wo')
+zircaloy.add_element('Fe', 0.00165, 'wo')
+zircaloy.add_element('Cr', 0.001 , 'wo')
+zircaloy.add_element('Zr', 0.98335, 'wo')
-borated_water = openmc.Material(material_id=4, name='Borated water at 975 ppm')
+borated_water = openmc.Material(material_id=4, name='Borated water')
borated_water.set_density('g/cm3', 0.740582)
-borated_water.add_nuclide(b10, 8.0042e-6)
-borated_water.add_nuclide(b11, 3.2218e-5)
-borated_water.add_nuclide(h1, 4.9457e-2)
-borated_water.add_nuclide(h2, 7.4196e-6)
-borated_water.add_nuclide(o16, 2.4672e-2)
-borated_water.add_nuclide(o17, 6.0099e-5)
+borated_water.add_element('B', 4.0e-5)
+borated_water.add_element('H', 5.0e-2)
+borated_water.add_element('O', 2.4e-2)
borated_water.add_s_alpha_beta('c_H_in_H2O')
# Instantiate a Materials collection and export to XML
diff --git a/examples/python/reflective/build-xml.py b/examples/python/reflective/build-xml.py
index af86e446ab..09fa026263 100644
--- a/examples/python/reflective/build-xml.py
+++ b/examples/python/reflective/build-xml.py
@@ -15,13 +15,10 @@ particles = 10000
# Exporting to OpenMC materials.xml file
###############################################################################
-# Instantiate a Nuclides
-u235 = openmc.Nuclide('U235')
-
# Instantiate a Material and register the Nuclide
fuel = openmc.Material(material_id=1, name='fuel')
fuel.set_density('g/cc', 4.5)
-fuel.add_nuclide(u235, 1.)
+fuel.add_nuclide('U235', 1.)
# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([fuel])
diff --git a/openmc/material.py b/openmc/material.py
index c4ba437659..73329a5320 100644
--- a/openmc/material.py
+++ b/openmc/material.py
@@ -129,7 +129,7 @@ class Material(object):
string = 'Material\n'
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
- string += '{0: <16}{1}{2}\n'.format('\Temperature', '=\t',
+ string += '{0: <16}{1}{2}\n'.format('\tTemperature', '=\t',
self._temperature)
string += '{0: <16}{1}{2}'.format('\tDensity', '=\t', self._density)
@@ -251,7 +251,7 @@ class Material(object):
Parameters
----------
- units : {'g/cm3', 'g/cc', 'km/cm3', 'atom/b-cm', 'atom/cm3', 'sum', 'macro'}
+ units : {'g/cm3', 'g/cc', 'kg/cm3', 'atom/b-cm', 'atom/cm3', 'sum', 'macro'}
Physical units of density.
density : float, optional
Value of the density. Must be specified unless units is given as
@@ -641,37 +641,39 @@ class Material(object):
nucs = []
nuc_densities = []
nuc_density_types = []
+
for nuclide in nuclides.items():
nuc, nuc_density, nuc_density_type = nuclide[1]
nucs.append(nuc)
nuc_densities.append(nuc_density)
nuc_density_types.append(nuc_density_type)
+ nucs = np.array(nucs)
+ nuc_densities = np.array(nuc_densities)
+ nuc_density_types = np.array(nuc_density_types)
+
if sum_density:
density = np.sum(nuc_densities)
+
percent_in_atom = np.all(nuc_density_types == 'ao')
density_in_atom = density > 0.
sum_percent = 0.
- awrs = []
- for n, nuclide in enumerate(nuclides.items()):
- awr = openmc.data.atomic_mass(nuclide[0])
- if awr is not None:
- awrs.append(awr / openmc.data.NEUTRON_MASS)
- else:
- raise ValueError(nuclide[0] + " is invalid")
+ # Convert the weight amounts to atomic amounts
+ if not percent_in_atom:
+ for n, nuc in enumerate(nucs):
+ nuc_densities[n] *= self.average_molar_mass / \
+ openmc.data.atomic_mass(nuc)
- # Now that we have the awr, lets finish calculating densities
+ # Now that we have the atomic amounts, lets finish calculating densities
sum_percent = np.sum(nuc_densities)
nuc_densities = nuc_densities / sum_percent
+
+ # Convert the mass density to an atom density
if not density_in_atom:
- sum_percent = 0.
- for n, nuc in enumerate(nucs):
- x = nuc_densities[n]
- sum_percent += x * awrs[n]
- sum_percent = 1. / sum_percent
- density = -density * sum_percent * \
- openmc.data.AVOGADRO / openmc.data.NEUTRON_MASS * 1.E-24
+ density = -density / self.average_molar_mass * 1.E-24 \
+ * openmc.data.AVOGADRO
+
nuc_densities = density * nuc_densities
nuclides = OrderedDict()
diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py
index 7e0289064c..c3be755908 100644
--- a/openmc/mgxs/library.py
+++ b/openmc/mgxs/library.py
@@ -524,6 +524,14 @@ class Library(object):
for domain in self.domains:
for mgxs_type in self.mgxs_types:
mgxs = self.get_mgxs(domain, mgxs_type)
+
+ if mgxs_type in openmc.mgxs.MDGXS_TYPES:
+ if self.num_delayed_groups == 0:
+ mgxs.delayed_groups = None
+ else:
+ mgxs.delayed_groups \
+ = list(range(1, self.num_delayed_groups+1))
+
for tally in mgxs.tallies.values():
tallies_file.append(tally, merge=merge)
diff --git a/openmc/mgxs/mdgxs.py b/openmc/mgxs/mdgxs.py
index 5b2f451c2a..d37957c233 100644
--- a/openmc/mgxs/mdgxs.py
+++ b/openmc/mgxs/mdgxs.py
@@ -923,7 +923,7 @@ class ChiDelayed(MDGXS):
tally_keys : list of str
The keys into the tallies dictionary for each tally used to compute
the multi-group cross section
- estimator : {'tracklength', 'analog'}
+ estimator : 'analog'
The tally estimator used to compute the multi-group cross section
tallies : collections.OrderedDict
OpenMC tallies needed to compute the multi-group cross section. The keys
@@ -966,6 +966,7 @@ class ChiDelayed(MDGXS):
super(ChiDelayed, self).__init__(domain, domain_type, energy_groups,
delayed_groups, by_nuclide, name)
self._rxn_type = 'chi-delayed'
+ self._estimator = 'analog'
@property
def scores(self):
@@ -987,10 +988,6 @@ class ChiDelayed(MDGXS):
def tally_keys(self):
return ['delayed-nu-fission-in', 'delayed-nu-fission-out']
- @property
- def estimator(self):
- return 'analog'
-
@property
def rxn_rate_tally(self):
if self._rxn_rate_tally is None:
@@ -1018,6 +1015,34 @@ class ChiDelayed(MDGXS):
return self._xs_tally
+ def get_homogenized_mgxs(self, other_mgxs):
+ """Construct a homogenized MGXS with other MGXS objects.
+
+ This method constructs a new MGXS object that is the flux-weighted
+ combination of two MGXS objects. It is equivalent to what one would
+ obtain if the tally spatial domain were designed to encompass the
+ individual domains for both MGXS objects.
+
+ Parameters
+ ----------
+ other_mgxs : openmc.mgxs.MGXS or Iterable of openmc.mgxs.MGXS
+ The MGXS to homogenize with this one.
+
+ Returns
+ -------
+ openmc.mgxs.MGXS
+ A new homogenized MGXS
+
+ Raises
+ ------
+ ValueError
+ If the other_mgxs is of a different type.
+
+ """
+
+ return self._get_homogenized_mgxs(other_mgxs, 'delayed-nu-fission-in')
+
+
def get_slice(self, nuclides=[], groups=[], delayed_groups=[]):
"""Build a sliced ChiDelayed for the specified nuclides and energy
groups.
@@ -1586,6 +1611,33 @@ class Beta(MDGXS):
return self._xs_tally
+ def get_homogenized_mgxs(self, other_mgxs):
+ """Construct a homogenized MGXS with other MGXS objects.
+
+ This method constructs a new MGXS object that is the flux-weighted
+ combination of two MGXS objects. It is equivalent to what one would
+ obtain if the tally spatial domain were designed to encompass the
+ individual domains for both MGXS objects.
+
+ Parameters
+ ----------
+ other_mgxs : openmc.mgxs.MGXS or Iterable of openmc.mgxs.MGXS
+ The MGXS to homogenize with this one.
+
+ Returns
+ -------
+ openmc.mgxs.MGXS
+ A new homogenized MGXS
+
+ Raises
+ ------
+ ValueError
+ If the other_mgxs is of a different type.
+
+ """
+
+ return self._get_homogenized_mgxs(other_mgxs, 'nu-fission')
+
class DecayRate(MDGXS):
r"""The decay rate for delayed neutron precursors.
@@ -1703,7 +1755,6 @@ class DecayRate(MDGXS):
super(DecayRate, self).__init__(domain, domain_type, energy_groups,
delayed_groups, by_nuclide, name)
self._rxn_type = 'decay-rate'
- self._estimator = 'analog'
@property
def scores(self):
@@ -1738,6 +1789,33 @@ class DecayRate(MDGXS):
return self._xs_tally
+ def get_homogenized_mgxs(self, other_mgxs):
+ """Construct a homogenized MGXS with other MGXS objects.
+
+ This method constructs a new MGXS object that is the flux-weighted
+ combination of two MGXS objects. It is equivalent to what one would
+ obtain if the tally spatial domain were designed to encompass the
+ individual domains for both MGXS objects.
+
+ Parameters
+ ----------
+ other_mgxs : openmc.mgxs.MGXS or Iterable of openmc.mgxs.MGXS
+ The MGXS to homogenize with this one.
+
+ Returns
+ -------
+ openmc.mgxs.MGXS
+ A new homogenized MGXS
+
+ Raises
+ ------
+ ValueError
+ If the other_mgxs is of a different type.
+
+ """
+
+ return self._get_homogenized_mgxs(other_mgxs, 'delayed-nu-fission')
+
@add_metaclass(ABCMeta)
class MatrixMDGXS(MDGXS):
@@ -2295,7 +2373,7 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS):
tally_keys : list of str
The keys into the tallies dictionary for each tally used to compute
the multi-group cross section
- estimator : {'tracklength', 'analog'}
+ estimator : 'analog'
The tally estimator used to compute the multi-group cross section
tallies : collections.OrderedDict
OpenMC tallies needed to compute the multi-group cross section. The keys
diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py
index 3ad67484a6..fab4127eb6 100644
--- a/openmc/mgxs/mgxs.py
+++ b/openmc/mgxs/mgxs.py
@@ -996,6 +996,111 @@ class MGXS(object):
avg_xs.sparse = self.sparse
return avg_xs
+ def _get_homogenized_mgxs(self, other_mgxs, denom_score='flux'):
+ """Construct a homogenized MGXS with other MGXS objects.
+
+ This method constructs a new MGXS object that is the flux-weighted
+ combination of two MGXS objects. It is equivalent to what one would
+ obtain if the tally spatial domain were designed to encompass the
+ individual domains for both MGXS objects. This is accomplished by
+ summing the rxn rate (numerator) tally and the denominator tally
+ (often a tally of the flux over the spatial domain) that are used to
+ compute a multi-group cross-section.
+
+ Parameters
+ ----------
+ other_mgxs : openmc.mgxs.MGXS or Iterable of openmc.mgxs.MGXS
+ The MGXS to homogenize with this one.
+ denom_score : str
+ The denominator score in the denominator of computing the MGXS.
+
+ Returns
+ -------
+ openmc.mgxs.MGXS
+ A new homogenized MGXS
+
+ Raises
+ ------
+ ValueError
+ If the other_mgxs is of a different type.
+
+ """
+
+ # Check type of denom score
+ cv.check_type('denom_score', denom_score, str)
+
+ # Construct a collection of the subdomain filter bins to homogenize
+ # across
+ if isinstance(other_mgxs, openmc.mgxs.MGXS):
+ other_mgxs = [other_mgxs]
+
+ cv.check_iterable_type('other_mgxs', other_mgxs, openmc.mgxs.MGXS)
+ for mgxs in other_mgxs:
+ if mgxs.rxn_type != self.rxn_type:
+ msg = 'Not able to homogenize two MGXS with different rxn types'
+ raise ValueError(msg)
+
+ # Clone this MGXS to initialize the homogenized version
+ homogenized_mgxs = copy.deepcopy(self)
+ homogenized_mgxs._derived = True
+ name = 'hom({}, '.format(self.domain.name)
+
+ # Get the domain filter
+ filter_type = _DOMAIN_TO_FILTER[self.domain_type]
+ self_filter = self.rxn_rate_tally.find_filter(filter_type)
+
+ # Get the rxn rate and denom tallies
+ rxn_rate_tally = self.rxn_rate_tally
+ denom_tally = self.tallies[denom_score]
+
+ for mgxs in other_mgxs:
+
+ # Swap the domain filter bins for the other mgxs rxn rate tally
+ other_rxn_rate_tally = copy.deepcopy(mgxs.rxn_rate_tally)
+ other_filter = other_rxn_rate_tally.find_filter(filter_type)
+ other_filter._bins = self_filter._bins
+
+ # Swap the domain filter bins for the denom tally
+ other_denom_tally = copy.deepcopy(mgxs.tallies[denom_score])
+ other_filter = other_denom_tally.find_filter(filter_type)
+ other_filter._bins = self_filter._bins
+
+ # Add the rxn rate and denom tallies
+ rxn_rate_tally += other_rxn_rate_tally
+ denom_tally += other_denom_tally
+
+ # Update the name for the homogenzied MGXS
+ name += '{}, '.format(mgxs.domain.name)
+
+ # Set the properties of the homogenized MGXS
+ homogenized_mgxs._rxn_rate_tally = rxn_rate_tally
+ homogenized_mgxs.tallies[denom_score] = denom_tally
+ homogenized_mgxs._domain.name = name[:-2] + ')'
+
+ return homogenized_mgxs
+
+ def get_homogenized_mgxs(self, other_mgxs):
+ """Construct a homogenized mgxs with other MGXS objects.
+
+ Parameters
+ ----------
+ other_mgxs : openmc.mgxs.MGXS or Iterable of openmc.mgxs.MGXS
+ The MGXS to homogenize with this one.
+
+ Returns
+ -------
+ openmc.mgxs.MGXS
+ A new homogenized MGXS
+
+ Raises
+ ------
+ ValueError
+ If the other_mgxs is of a different type.
+
+ """
+
+ return self._get_homogenized_mgxs(other_mgxs, 'flux')
+
def get_slice(self, nuclides=[], groups=[]):
"""Build a sliced MGXS for the specified nuclides and energy groups.
@@ -3182,7 +3287,7 @@ class NuScatterXS(MGXS):
tally_keys : list of str
The keys into the tallies dictionary for each tally used to compute
the multi-group cross section
- estimator : {'tracklength', 'collision', 'analog'}
+ estimator : 'analog'
The tally estimator used to compute the multi-group cross section
tallies : collections.OrderedDict
OpenMC tallies needed to compute the multi-group cross section. The keys
@@ -4561,6 +4666,28 @@ class Chi(MGXS):
return self._xs_tally
+ def get_homogenized_mgxs(self, other_mgxs):
+ """Construct a homogenized mgxs with other MGXS objects.
+
+ Parameters
+ ----------
+ other_mgxs : openmc.mgxs.MGXS or Iterable of openmc.mgxs.MGXS
+ The MGXS to homogenize with this one.
+
+ Returns
+ -------
+ openmc.mgxs.MGXS
+ A new homogenized MGXS
+
+ Raises
+ ------
+ ValueError
+ If the other_mgxs is of a different type.
+
+ """
+
+ return self._get_homogenized_mgxs(other_mgxs, 'nu-fission-in')
+
def get_slice(self, nuclides=[], groups=[]):
"""Build a sliced Chi for the specified nuclides and energy groups.
@@ -5338,7 +5465,7 @@ class PromptNuFissionMatrixXS(MatrixMGXS):
tally_keys : list of str
The keys into the tallies dictionary for each tally used to compute
the multi-group cross section
- estimator : {'tracklength', 'collision', 'analog'}
+ estimator : 'analog'
The tally estimator used to compute the multi-group cross section
tallies : collections.OrderedDict
OpenMC tallies needed to compute the multi-group cross section. The keys
diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py
index 331d9ed12d..61a102c147 100644
--- a/openmc/mgxs_library.py
+++ b/openmc/mgxs_library.py
@@ -15,8 +15,8 @@ from openmc.checkvalue import check_type, check_value, check_greater_than, \
# Supported incoming particle MGXS angular treatment representations
_REPRESENTATIONS = ['isotropic', 'angle']
_SCATTER_TYPES = ['tabular', 'legendre', 'histogram']
-_XS_SHAPES = ["[G][G'][Order]", "[G]", "[G']", "[G][G']", "[DG]", "[G][DG]",
- "[G'][DG]", "[G][G'][DG]"]
+_XS_SHAPES = ["[G][G'][Order]", "[G]", "[G']", "[G][G']", "[DG]", "[DG][G]",
+ "[DG][G']", "[DG][G][G']"]
class XSdata(object):
@@ -145,11 +145,11 @@ class XSdata(object):
[DG]: beta, decay_rate
- [G][DG]: delayed_nu_fission, beta, decay_rate
+ [DG][G]: delayed_nu_fission, beta, decay_rate
- [G'][DG]: chi_delayed
+ [DG][G']: chi_delayed
- [G][G'][DG]: delayed_nu_fission
+ [DG][G][G']: delayed_nu_fission
"""
@@ -296,13 +296,13 @@ class XSdata(object):
self._xs_shapes["[G][G']"] = (self.energy_groups.num_groups,
self.energy_groups.num_groups)
self._xs_shapes["[DG]"] = (self.num_delayed_groups,)
- self._xs_shapes["[G][DG]"] = (self.energy_groups.num_groups,
- self.num_delayed_groups)
- self._xs_shapes["[G'][DG]"] = (self.energy_groups.num_groups,
- self.num_delayed_groups)
- self._xs_shapes["[G][G'][DG]"] = (self.energy_groups.num_groups,
+ self._xs_shapes["[DG][G]"] = (self.num_delayed_groups,
+ self.energy_groups.num_groups)
+ self._xs_shapes["[DG'][G']"] = (self.num_delayed_groups,
+ self.energy_groups.num_groups)
+ self._xs_shapes["[DG][G][G']"] = (self.num_delayed_groups,
self.energy_groups.num_groups,
- self.num_delayed_groups)
+ self.energy_groups.num_groups)
self._xs_shapes["[G][G'][Order]"] \
= (self.energy_groups.num_groups,
@@ -634,7 +634,7 @@ class XSdata(object):
"""
# Get the accepted shapes for this xs
- shapes = [self.xs_shapes["[G']"], self.xs_shapes["[G'][DG]"]]
+ shapes = [self.xs_shapes["[G']"], self.xs_shapes["[DG][G']"]]
# Convert to a numpy array so we can easily get the shape for checking
chi_delayed = np.asarray(chi_delayed)
@@ -664,7 +664,7 @@ class XSdata(object):
"""
# Get the accepted shapes for this xs
- shapes = [self.xs_shapes["[DG]"], self.xs_shapes["[G][DG]"]]
+ shapes = [self.xs_shapes["[DG]"], self.xs_shapes["[DG][G]"]]
# Convert to a numpy array so we can easily get the shape for checking
beta = np.asarray(beta)
@@ -694,7 +694,7 @@ class XSdata(object):
"""
# Get the accepted shapes for this xs
- shapes = [self.xs_shapes["[DG]"], self.xs_shapes["[G][DG]"]]
+ shapes = [self.xs_shapes["[DG]"], self.xs_shapes["[DG][G]"]]
# Convert to a numpy array so we can easily get the shape for checking
decay_rate = np.asarray(decay_rate)
@@ -856,7 +856,7 @@ class XSdata(object):
"""
# Get the accepted shapes for this xs
- shapes = [self.xs_shapes["[G][DG]"], self.xs_shapes["[G][G'][DG]"]]
+ shapes = [self.xs_shapes["[DG][G]"], self.xs_shapes["[DG][G][G']"]]
# Convert to a numpy array so we can easily get the shape for checking
delayed_nu_fission = np.asarray(delayed_nu_fission)
@@ -925,7 +925,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -970,7 +970,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1017,7 +1017,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1064,7 +1064,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1119,7 +1119,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1174,7 +1174,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1231,7 +1231,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1277,7 +1277,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1320,7 +1320,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1366,7 +1366,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1414,7 +1414,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1459,7 +1459,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1509,7 +1509,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1598,7 +1598,7 @@ class XSdata(object):
See also
--------
openmc.mgxs.Library.create_mg_library()
- openmc.mgxs.Library.get_xsdata
+ openmc.mgxs.Library.get_xsdata()
"""
@@ -1644,6 +1644,54 @@ class XSdata(object):
self._multiplicity_matrix[i] = \
np.nan_to_num(self._multiplicity_matrix[i])
+ def set_inverse_velocity_mgxs(self, inverse_velocity, temperature=294.,
+ nuclide='total', xs_type='macro',
+ subdomain=None):
+ """This method allows for an openmc.mgxs.InverseVelocity
+ to be used to set the inverse velocity for this XSdata object.
+
+ Parameters
+ ----------
+ inverse_velocity : openmc.mgxs.InverseVelocity
+ MGXS object containing the inverse velocity for the domain of
+ 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()
+ openmc.mgxs.Library.get_xsdata()
+
+ """
+
+ check_type('inverse_velocity', inverse_velocity, openmc.mgxs.InverseVelocity)
+ check_value('energy_groups', inverse_velocity.energy_groups,
+ [self.energy_groups])
+ check_value('domain_type', inverse_velocity.domain_type,
+ openmc.mgxs.DOMAIN_TYPES)
+ check_type('temperature', temperature, Real)
+ check_value('temperature', temperature, self.temperatures)
+
+ i = np.where(self.temperatures == temperature)[0][0]
+ if self.representation == 'isotropic':
+ self._inverse_velocity[i] = inverse_velocity.get_xs\
+ (nuclides=nuclide, xs_type=xs_type,
+ subdomains=subdomain)
+ elif self.representation == 'angle':
+ msg = 'Angular-Dependent MGXS have not yet been implemented'
+ raise ValueError(msg)
+
def to_hdf5(self, file):
"""Write XSdata to an HDF5 file
diff --git a/openmc/settings.py b/openmc/settings.py
index cc3a1fbb09..e6a3f9e131 100644
--- a/openmc/settings.py
+++ b/openmc/settings.py
@@ -830,7 +830,7 @@ class Settings(object):
def _create_keff_trigger_subelement(self, run_mode_element):
if self._keff_trigger is not None:
- element = ET.SubElement(run_mode_subelement, "keff_trigger")
+ element = ET.SubElement(run_mode_element, "keff_trigger")
for key in self._keff_trigger:
subelement = ET.SubElement(element, key)
diff --git a/openmc/tallies.py b/openmc/tallies.py
index af57a1ffd8..20e03129b5 100644
--- a/openmc/tallies.py
+++ b/openmc/tallies.py
@@ -705,7 +705,7 @@ class Tally(object):
"""
- # Two tallys must have the same number of filters
+ # Two tallies must have the same number of filters
if len(self.filters) != len(other.filters):
return False
@@ -3486,9 +3486,14 @@ class Tallies(cv.CheckedList):
for d in derivs:
root_element.append(d.to_xml_element())
- def export_to_xml(self):
+ def export_to_xml(self, path='tallies.xml'):
"""Create a tallies.xml file that can be used for a simulation.
+ Parameters
+ ----------
+ path : str
+ Path to file to write. Defaults to 'tallies.xml'.
+
"""
root_element = ET.Element("tallies")
@@ -3501,5 +3506,5 @@ class Tallies(cv.CheckedList):
# Write the XML Tree to the tallies.xml file
tree = ET.ElementTree(root_element)
- tree.write("tallies.xml", xml_declaration=True,
+ tree.write(path, xml_declaration=True,
encoding='utf-8', method="xml")
diff --git a/src/input_xml.F90 b/src/input_xml.F90
index cdb9c253fb..c39ef0412f 100644
--- a/src/input_xml.F90
+++ b/src/input_xml.F90
@@ -3668,13 +3668,6 @@ contains
end if
case ('decay-rate')
t % score_bins(j) = SCORE_DECAY_RATE
-
- ! Set tally estimator to analog for CE mode
- ! (MG mode has all data available without a collision being
- ! necessary)
- if (run_CE) then
- t % estimator = ESTIMATOR_ANALOG
- end if
case ('delayed-nu-fission')
t % score_bins(j) = SCORE_DELAYED_NU_FISSION
if (t % find_filter(FILTER_ENERGYOUT) > 0) then
diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90
index e57d7da626..a329b5bccc 100644
--- a/src/nuclide_header.F90
+++ b/src/nuclide_header.F90
@@ -621,7 +621,8 @@ module nuclide_header
case (EMISSION_DELAYED)
if (this % n_precursor > 0) then
- if (present(group)) then
+ if (present(group) .and. group < &
+ size(this % reactions(this % index_fission(1)) % products)) then
! If delayed group specified, determine yield immediately
associate(p => this % reactions(this % index_fission(1)) % products(1 + group))
nu = p % yield % evaluate(E)
diff --git a/src/tally.F90 b/src/tally.F90
index e3fdd1ab55..8d06dc9aca 100644
--- a/src/tally.F90
+++ b/src/tally.F90
@@ -679,8 +679,8 @@ contains
end if
end if
-
case (SCORE_DECAY_RATE)
+
! make sure the correct energy is used
if (t % estimator == ESTIMATOR_TRACKLENGTH) then
E = p % E
@@ -691,12 +691,134 @@ contains
! Set the delayedgroup filter index
dg_filter = t % find_filter(FILTER_DELAYEDGROUP)
- if (survival_biasing) then
- ! No fission events occur if survival biasing is on -- need to
- ! calculate fraction of absorptions that would have resulted in
- ! delayed-nu-fission
- if (micro_xs(p % event_nuclide) % absorption > ZERO .and. &
- nuclides(p % event_nuclide) % fissionable) then
+ if (t % estimator == ESTIMATOR_ANALOG) then
+ if (survival_biasing) then
+ ! No fission events occur if survival biasing is on -- need to
+ ! calculate fraction of absorptions that would have resulted in
+ ! delayed-nu-fission
+ if (micro_xs(p % event_nuclide) % absorption > ZERO .and. &
+ nuclides(p % event_nuclide) % fissionable) then
+
+ ! Check if the delayed group filter is present
+ if (dg_filter > 0) then
+ select type(filt => t % filters(dg_filter) % obj)
+ type is (DelayedGroupFilter)
+
+ ! Loop over all delayed group bins and tally to them
+ ! individually
+ do d_bin = 1, filt % n_bins
+
+ ! Get the delayed group for this bin
+ d = filt % groups(d_bin)
+
+ ! Compute the yield for this delayed group
+ yield = nuclides(p % event_nuclide) &
+ % nu(E, EMISSION_DELAYED, d)
+
+ associate (rxn => nuclides(p % event_nuclide) % &
+ reactions(nuclides(p % event_nuclide) % index_fission(1)))
+
+ ! Compute the score
+ score = p % absorb_wgt * yield * &
+ micro_xs(p % event_nuclide) % fission &
+ / micro_xs(p % event_nuclide) % absorption &
+ * rxn % products(1 + d) % decay_rate
+ end associate
+
+ ! Tally to bin
+ call score_fission_delayed_dg(t, d_bin, score, score_index)
+ end do
+ cycle SCORE_LOOP
+ end select
+ else
+
+ ! If the delayed group filter is not present, compute the score
+ ! by accumulating the absorbed weight times the decay rate times
+ ! the fraction of the delayed-nu-fission xs to the absorption xs
+ ! for all delayed groups.
+ score = ZERO
+
+ associate (rxn => nuclides(p % event_nuclide) % &
+ reactions(nuclides(p % event_nuclide) % index_fission(1)))
+
+ ! We need to be careful not to overshoot the number of delayed
+ ! groups since this could cause the range of the rxn % products
+ ! array to be exceeded. Hence, we use the size of this array
+ ! and not the MAX_DELAYED_GROUPS constant for this loop.
+ do d = 1, size(rxn % products) - 2
+
+ score = score + rxn % products(1 + d) % decay_rate * &
+ p % absorb_wgt * micro_xs(p % event_nuclide) % fission *&
+ nuclides(p % event_nuclide) % nu(E, EMISSION_DELAYED, d)&
+ / micro_xs(p % event_nuclide) % absorption
+ end do
+ end associate
+ end if
+ end if
+ else
+
+ ! Skip any non-fission events
+ if (.not. p % fission) cycle SCORE_LOOP
+ ! If there is no outgoing energy filter, than we only need to
+ ! score to one bin. For the score to be 'analog', we need to
+ ! score the number of particles that were banked in the fission
+ ! bank. Since this was weighted by 1/keff, we multiply by keff
+ ! to get the proper score. Loop over the neutrons produced from
+ ! fission and check which ones are delayed. If a delayed neutron is
+ ! encountered, add its contribution to the fission bank to the
+ ! score.
+
+ score = ZERO
+
+ ! loop over number of particles banked
+ do k = 1, p % n_bank
+
+ ! get the delayed group
+ g = fission_bank(n_bank - p % n_bank + k) % delayed_group
+
+ ! Case for tallying delayed emissions
+ if (g /= 0) then
+
+ ! Accumulate the decay rate times delayed nu fission score
+ associate (rxn => nuclides(p % event_nuclide) % &
+ reactions(nuclides(p % event_nuclide) % index_fission(1)))
+
+ ! determine score based on bank site weight and keff.
+ score = score + keff * fission_bank(n_bank - p % n_bank + k) &
+ % wgt * rxn % products(1 + g) % decay_rate
+ end associate
+
+ ! if the delayed group filter is present, tally to corresponding
+ ! delayed group bin if it exists
+ if (dg_filter > 0) then
+
+ ! declare the delayed group filter type
+ select type(filt => t % filters(dg_filter) % obj)
+ type is (DelayedGroupFilter)
+
+ ! loop over delayed group bins until the corresponding bin is
+ ! found
+ do d_bin = 1, filt % n_bins
+ d = filt % groups(d_bin)
+
+ ! check whether the delayed group of the particle is equal to
+ ! the delayed group of this bin
+ if (d == g) then
+ call score_fission_delayed_dg(t, d_bin, score, score_index)
+ end if
+ end do
+ end select
+
+ ! Reset the score to zero
+ score = ZERO
+ end if
+ end if
+ end do
+ end if
+ else
+
+ ! Check if tally is on a single nuclide
+ if (i_nuclide > 0) then
! Check if the delayed group filter is present
if (dg_filter > 0) then
@@ -711,17 +833,14 @@ contains
d = filt % groups(d_bin)
! Compute the yield for this delayed group
- yield = nuclides(p % event_nuclide) &
- % nu(E, EMISSION_DELAYED, d)
+ yield = nuclides(i_nuclide) % nu(E, EMISSION_DELAYED, d)
- associate (rxn => nuclides(p % event_nuclide) % &
- reactions(nuclides(p % event_nuclide) % index_fission(1)))
+ associate (rxn => nuclides(i_nuclide) % &
+ reactions(nuclides(i_nuclide) % index_fission(1)))
- ! Compute the score
- score = p % absorb_wgt * yield * &
- micro_xs(p % event_nuclide) % fission &
- / micro_xs(p % event_nuclide) % absorption &
- * rxn % products(1 + d) % decay_rate
+ ! Compute the score and tally to bin
+ score = micro_xs(i_nuclide) % fission * yield * flux * &
+ atom_density * rxn % products(1 + d) % decay_rate
end associate
! Tally to bin
@@ -746,78 +865,90 @@ contains
! and not the MAX_DELAYED_GROUPS constant for this loop.
do d = 1, size(rxn % products) - 2
- score = score + rxn % products(1 + d) % decay_rate * &
- p % absorb_wgt * micro_xs(p % event_nuclide) % fission *&
- nuclides(p % event_nuclide) % nu(E, EMISSION_DELAYED, d)&
- / micro_xs(p % event_nuclide) % absorption
+ score = score + micro_xs(i_nuclide) % fission * flux * &
+ nuclides(i_nuclide) % nu(E, EMISSION_DELAYED) * &
+ atom_density * rxn % products(1 + d) % decay_rate
end do
end associate
end if
- end if
- else
- ! Skip any non-fission events
- if (.not. p % fission) cycle SCORE_LOOP
- ! If there is no outgoing energy filter, than we only need to
- ! score to one bin. For the score to be 'analog', we need to
- ! score the number of particles that were banked in the fission
- ! bank. Since this was weighted by 1/keff, we multiply by keff
- ! to get the proper score. Loop over the neutrons produced from
- ! fission and check which ones are delayed. If a delayed neutron is
- ! encountered, add its contribution to the fission bank to the
- ! score.
+ ! Tally is on total nuclides
+ else
- score = ZERO
+ ! Check if the delayed group filter is present
+ if (dg_filter > 0) then
+ select type(filt => t % filters(dg_filter) % obj)
+ type is (DelayedGroupFilter)
- ! loop over number of particles banked
- do k = 1, p % n_bank
+ ! Loop over all nuclides in the current material
+ do l = 1, materials(p % material) % n_nuclides
- ! get the delayed group
- g = fission_bank(n_bank - p % n_bank + k) % delayed_group
+ ! Get atom density
+ atom_density_ = materials(p % material) % atom_density(l)
- ! Case for tallying delayed emissions
- if (g /= 0) then
+ ! Get index in nuclides array
+ i_nuc = materials(p % material) % nuclide(l)
- ! Accumulate the decay rate times delayed nu fission score
- associate (rxn => nuclides(p % event_nuclide) % &
- reactions(nuclides(p % event_nuclide) % index_fission(1)))
+ if (nuclides(i_nuc) % fissionable) then
- ! determine score based on bank site weight and keff.
- score = score + keff * fission_bank(n_bank - p % n_bank + k) &
- % wgt * rxn % products(1 + g) % decay_rate
- end associate
+ ! Loop over all delayed group bins and tally to them
+ ! individually
+ do d_bin = 1, filt % n_bins
- ! if the delayed group filter is present, tally to corresponding
- ! delayed group bin if it exists
- if (dg_filter > 0) then
+ ! Get the delayed group for this bin
+ d = filt % groups(d_bin)
- ! declare the delayed group filter type
- select type(filt => t % filters(dg_filter) % obj)
- type is (DelayedGroupFilter)
+ ! Get the yield for the desired nuclide and delayed group
+ yield = nuclides(i_nuc) % nu(E, EMISSION_DELAYED, d)
- ! loop over delayed group bins until the corresponding bin is
- ! found
- do d_bin = 1, filt % n_bins
- d = filt % groups(d_bin)
+ associate (rxn => nuclides(i_nuc) % &
+ reactions(nuclides(i_nuc) % index_fission(1)))
- ! check whether the delayed group of the particle is equal to
- ! the delayed group of this bin
- if (d == g) then
+ ! Compute the score
+ score = micro_xs(i_nuc) % fission * yield * flux * &
+ atom_density_ * rxn % products(1 + d) % decay_rate
+ end associate
+
+ ! Tally to bin
call score_fission_delayed_dg(t, d_bin, score, score_index)
- end if
- end do
- end select
+ end do
+ end if
+ end do
+ cycle SCORE_LOOP
+ end select
+ else
- ! Reset the score to zero
- score = ZERO
- end if
+ score = ZERO
+
+ ! Loop over all nuclides in the current material
+ do l = 1, materials(p % material) % n_nuclides
+
+ ! Get atom density
+ atom_density_ = materials(p % material) % atom_density(l)
+
+ ! Get index in nuclides array
+ i_nuc = materials(p % material) % nuclide(l)
+
+ if (nuclides(i_nuc) % fissionable) then
+
+ associate (rxn => nuclides(i_nuc) % &
+ reactions(nuclides(i_nuc) % index_fission(1)))
+
+ ! We need to be careful not to overshoot the number of delayed
+ ! groups since this could cause the range of the rxn % products
+ ! array to be exceeded. Hence, we use the size of this array
+ ! and not the MAX_DELAYED_GROUPS constant for this loop.
+ do d = 1, size(rxn % products) - 2
+
+ ! Accumulate the contribution from each nuclide
+ score = score + micro_xs(i_nuc) % fission * nuclides(i_nuc) %&
+ nu(E, EMISSION_DELAYED) * atom_density_ * flux * &
+ rxn % products(1 + d) % decay_rate
+ end do
+ end associate
+ end if
+ end do
end if
- end do
-
- ! If the delayed group filter is present, cycle because the
- ! score_fission_delayed_dg(...) has already tallied the score
- if (dg_filter > 0) then
- cycle SCORE_LOOP
end if
end if
diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat
index 2c9e622f8d..ac3f32c4f7 100644
--- a/tests/test_mgxs_library_condense/inputs_true.dat
+++ b/tests/test_mgxs_library_condense/inputs_true.dat
@@ -396,7 +396,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -404,7 +404,7 @@
total
decay-rate
- analog
+ tracklength
@@ -767,7 +767,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -775,7 +775,7 @@
total
decay-rate
- analog
+ tracklength
@@ -1138,7 +1138,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -1146,7 +1146,7 @@
total
decay-rate
- analog
+ tracklength
diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat
index 6f29fbc4cd..00cd27e1e6 100644
--- a/tests/test_mgxs_library_condense/results_true.dat
+++ b/tests/test_mgxs_library_condense/results_true.dat
@@ -64,12 +64,12 @@
4 10000 5 1 total 0.001231 0.000105
5 10000 6 1 total 0.000512 0.000044
material delayedgroup group in nuclide mean std. dev.
-0 10000 1 1 total 0.000000 0.000000
-1 10000 2 1 total 0.032739 0.028454
-2 10000 3 1 total 0.120780 0.170809
-3 10000 4 1 total 0.302780 0.109110
-4 10000 5 1 total 0.000000 0.000000
-5 10000 6 1 total 0.000000 0.000000
+0 10000 1 1 total 0.013355 0.001207
+1 10000 2 1 total 0.032600 0.002866
+2 10000 3 1 total 0.121083 0.010442
+3 10000 4 1 total 0.305910 0.025627
+4 10000 5 1 total 0.861934 0.068282
+5 10000 6 1 total 2.895065 0.230223
material delayedgroup group in group out nuclide mean std. dev.
0 10000 1 1 1 total 0.000000 0.000000
1 10000 2 1 1 total 0.000384 0.000236
diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat
index 682f598f72..fd04015270 100644
--- a/tests/test_mgxs_library_distribcell/inputs_true.dat
+++ b/tests/test_mgxs_library_distribcell/inputs_true.dat
@@ -423,7 +423,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -431,7 +431,7 @@
total
decay-rate
- analog
+ tracklength
diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat
index 905a55815d..52d668e0b8 100644
--- a/tests/test_mgxs_library_distribcell/results_true.dat
+++ b/tests/test_mgxs_library_distribcell/results_true.dat
@@ -64,12 +64,12 @@
4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 5 1 total 0.001210 0.000058
5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 6 1 total 0.000504 0.000024
sum(distribcell) delayedgroup group in nuclide mean std. dev.
-0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 0.000000 0.000000
-1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 2 1 total 0.032739 0.046300
-2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 3 1 total 0.120780 0.170809
-3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 4 1 total 0.000000 0.000000
-4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 5 1 total 0.000000 0.000000
-5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 6 1 total 2.853000 4.034751
+0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 0.013353 0.000686
+1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 2 1 total 0.032613 0.001627
+2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 3 1 total 0.121054 0.005911
+3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 4 1 total 0.305627 0.014428
+4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 5 1 total 0.860892 0.037879
+5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 6 1 total 2.891521 0.127879
sum(distribcell) delayedgroup group in group out nuclide mean std. dev.
0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 1 total 0.000000 0.000000
1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 2 1 1 total 0.000175 0.000175
diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat
index 2c9e622f8d..ac3f32c4f7 100644
--- a/tests/test_mgxs_library_hdf5/inputs_true.dat
+++ b/tests/test_mgxs_library_hdf5/inputs_true.dat
@@ -396,7 +396,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -404,7 +404,7 @@
total
decay-rate
- analog
+ tracklength
@@ -767,7 +767,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -775,7 +775,7 @@
total
decay-rate
- analog
+ tracklength
@@ -1138,7 +1138,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -1146,7 +1146,7 @@
total
decay-rate
- analog
+ tracklength
diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat
index d491e72bab..3f276cf5a6 100644
--- a/tests/test_mgxs_library_hdf5/results_true.dat
+++ b/tests/test_mgxs_library_hdf5/results_true.dat
@@ -117,18 +117,18 @@ domain=10000 type=beta
[1.82980497e-04 4.50738567e-04]
[7.48899920e-05 1.88812772e-04]]
domain=10000 type=decay-rate
-[[0.00000000e+00 0.00000000e+00]
- [0.00000000e+00 3.27390000e-02]
- [0.00000000e+00 1.20780000e-01]
- [0.00000000e+00 3.02780000e-01]
- [0.00000000e+00 0.00000000e+00]
- [0.00000000e+00 0.00000000e+00]]
-[[0.00000000e+00 0.00000000e+00]
- [0.00000000e+00 2.84543737e-02]
- [0.00000000e+00 1.70808714e-01]
- [0.00000000e+00 1.09109511e-01]
- [0.00000000e+00 0.00000000e+00]
- [0.00000000e+00 0.00000000e+00]]
+[[1.34450193e-02 1.33360001e-02]
+ [3.20638662e-02 3.27389978e-02]
+ [1.22136025e-01 1.20780007e-01]
+ [3.15269337e-01 3.02780066e-01]
+ [8.89232590e-01 8.49490287e-01]
+ [2.98940410e+00 2.85300088e+00]]
+[[1.08439397e-03 1.44623816e-03]
+ [2.65794939e-03 3.55041884e-03]
+ [1.02955008e-02 1.30981285e-02]
+ [2.71748525e-02 3.28353351e-02]
+ [7.93682876e-02 9.21239479e-02]
+ [2.66253276e-01 3.09396954e-01]]
domain=10000 type=delayed-nu-fission matrix
[[[0.00000000e+00 0.00000000e+00]
[0.00000000e+00 0.00000000e+00]]
diff --git a/tests/test_mgxs_library_mesh/inputs_true.dat b/tests/test_mgxs_library_mesh/inputs_true.dat
index 675251ad55..07b2076d73 100644
--- a/tests/test_mgxs_library_mesh/inputs_true.dat
+++ b/tests/test_mgxs_library_mesh/inputs_true.dat
@@ -660,7 +660,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -668,7 +668,7 @@
total
decay-rate
- analog
+ tracklength
diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat
index b4681d25c4..df4dcd3400 100644
--- a/tests/test_mgxs_library_mesh/results_true.dat
+++ b/tests/test_mgxs_library_mesh/results_true.dat
@@ -214,32 +214,32 @@
21 2 2 1 4 1 total 0.002675 0.000783
22 2 2 1 5 1 total 0.001199 0.000341
23 2 2 1 6 1 total 0.000499 0.000142
- mesh 1 delayedgroup group in nuclide mean std. dev.
- x y z
-0 1 1 1 1 1 total 0.00000 0.00000
-1 1 1 1 2 1 total 0.00000 0.00000
-2 1 1 1 3 1 total 0.00000 0.00000
-3 1 1 1 4 1 total 0.00000 0.00000
-4 1 1 1 5 1 total 0.84949 1.20136
-5 1 1 1 6 1 total 0.00000 0.00000
-6 1 2 1 1 1 total 0.00000 0.00000
-7 1 2 1 2 1 total 0.00000 0.00000
-8 1 2 1 3 1 total 0.00000 0.00000
-9 1 2 1 4 1 total 0.00000 0.00000
-10 1 2 1 5 1 total 0.00000 0.00000
-11 1 2 1 6 1 total 0.00000 0.00000
-12 2 1 1 1 1 total 0.00000 0.00000
-13 2 1 1 2 1 total 0.00000 0.00000
-14 2 1 1 3 1 total 0.00000 0.00000
-15 2 1 1 4 1 total 0.00000 0.00000
-16 2 1 1 5 1 total 0.00000 0.00000
-17 2 1 1 6 1 total 0.00000 0.00000
-18 2 2 1 1 1 total 0.00000 0.00000
-19 2 2 1 2 1 total 0.00000 0.00000
-20 2 2 1 3 1 total 0.00000 0.00000
-21 2 2 1 4 1 total 0.00000 0.00000
-22 2 2 1 5 1 total 0.00000 0.00000
-23 2 2 1 6 1 total 0.00000 0.00000
+ mesh 1 delayedgroup group in nuclide mean std. dev.
+ x y z
+0 1 1 1 1 1 total 0.013362 0.003586
+1 1 1 1 2 1 total 0.032554 0.008644
+2 1 1 1 3 1 total 0.121179 0.031941
+3 1 1 1 4 1 total 0.306858 0.079970
+4 1 1 1 5 1 total 0.865303 0.220416
+5 1 1 1 6 1 total 2.906554 0.741587
+6 1 2 1 1 1 total 0.013362 0.004521
+7 1 2 1 2 1 total 0.032556 0.011045
+8 1 2 1 3 1 total 0.121174 0.041226
+9 1 2 1 4 1 total 0.306816 0.104995
+10 1 2 1 5 1 total 0.865155 0.301124
+11 1 2 1 6 1 total 2.906049 1.010025
+12 2 1 1 1 1 total 0.013353 0.002006
+13 2 1 1 2 1 total 0.032614 0.004677
+14 2 1 1 3 1 total 0.121052 0.016785
+15 2 1 1 4 1 total 0.305600 0.040199
+16 2 1 1 5 1 total 0.860792 0.101713
+17 2 1 1 6 1 total 2.891182 0.344217
+18 2 2 1 1 1 total 0.013356 0.004047
+19 2 2 1 2 1 total 0.032596 0.009453
+20 2 2 1 3 1 total 0.121091 0.034091
+21 2 2 1 4 1 total 0.305990 0.082530
+22 2 2 1 5 1 total 0.862223 0.216936
+23 2 2 1 6 1 total 2.896051 0.731528
mesh 1 delayedgroup group in group out nuclide mean std. dev.
x y z
0 1 1 1 1 1 1 total 0.000000 0.000000
diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat
index 2c9e622f8d..ac3f32c4f7 100644
--- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat
+++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat
@@ -396,7 +396,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -404,7 +404,7 @@
total
decay-rate
- analog
+ tracklength
@@ -767,7 +767,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -775,7 +775,7 @@
total
decay-rate
- analog
+ tracklength
@@ -1138,7 +1138,7 @@
total
delayed-nu-fission
- analog
+ tracklength
@@ -1146,7 +1146,7 @@
total
decay-rate
- analog
+ tracklength
diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat
index fac47af469..b4a83befd5 100644
--- a/tests/test_mgxs_library_no_nuclides/results_true.dat
+++ b/tests/test_mgxs_library_no_nuclides/results_true.dat
@@ -129,18 +129,18 @@
8 10000 5 2 total 0.004684 0.000451
10 10000 6 2 total 0.001962 0.000189
material delayedgroup group in nuclide mean std. dev.
-1 10000 1 1 total 0.000000 0.000000
-3 10000 2 1 total 0.000000 0.000000
-5 10000 3 1 total 0.000000 0.000000
-7 10000 4 1 total 0.000000 0.000000
-9 10000 5 1 total 0.000000 0.000000
-11 10000 6 1 total 0.000000 0.000000
-0 10000 1 2 total 0.000000 0.000000
-2 10000 2 2 total 0.032739 0.028454
-4 10000 3 2 total 0.120780 0.170809
-6 10000 4 2 total 0.302780 0.109110
-8 10000 5 2 total 0.000000 0.000000
-10 10000 6 2 total 0.000000 0.000000
+1 10000 1 1 total 0.013445 0.001084
+3 10000 2 1 total 0.032064 0.002658
+5 10000 3 1 total 0.122136 0.010296
+7 10000 4 1 total 0.315269 0.027175
+9 10000 5 1 total 0.889233 0.079368
+11 10000 6 1 total 2.989404 0.266253
+0 10000 1 2 total 0.013336 0.001446
+2 10000 2 2 total 0.032739 0.003550
+4 10000 3 2 total 0.120780 0.013098
+6 10000 4 2 total 0.302780 0.032835
+8 10000 5 2 total 0.849490 0.092124
+10 10000 6 2 total 2.853001 0.309397
material delayedgroup group in group out nuclide mean std. dev.
3 10000 1 1 1 total 0.000000 0.000000
7 10000 2 1 1 total 0.000000 0.000000