From 24b5ee906baf97e0e918ed6533e452cdbcbbf30d Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sat, 18 Feb 2017 11:37:17 -0500 Subject: [PATCH 01/40] Added ScatterProbabilityMatrix class to openmc.mgxs --- openmc/mgxs/mgxs.py | 552 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 552 insertions(+) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 9eb642e32..011182cfe 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4722,6 +4722,241 @@ class NuScatterMatrixXS(ScatterMatrixXS): self._hdf5_key = 'nu-scatter matrix' + +# FIXME: Kord's scattering matrix idea + +class ConvolvedScatterMatrixXS(ScatterMatrixXS): + """A scattering production matrix multi-group cross section for one or + more Legendre moments. + + This class can be used for both OpenMC input generation and tally data + post-processing to compute spatially-homogenized and energy-integrated + multi-group cross sections for multi-group neutronics calculations. At a + minimum, one needs to set the :attr:`NuScatterMatrixXS.energy_groups` and + :attr:`NuScatterMatrixXS.domain` properties. Tallies for the flux and + appropriate reaction rates over the specified domain are generated + automatically via the :attr:`NuScatterMatrixXS.tallies` property, which can + then be appended to a :class:`openmc.Tallies` instance. + + For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the + necessary data to compute multi-group cross sections from a + :class:`openmc.StatePoint` instance. The derived multi-group cross section + can then be obtained from the :attr:`NuScatterMatrixXS.xs_tally` property. + + The calculation of the scattering-production matrix is the same as that for + :class:`ScatterMatrixXS` except that the scattering multiplicity is + accounted for. + + Parameters + ---------- + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + The domain type for spatial homogenization + groups : openmc.mgxs.EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + num_polar : Integral, optional + Number of equi-width polar angle bins for angle discretization; + defaults to one bin + num_azimuthal : Integral, optional + Number of equi-width azimuthal angle bins for angle discretization; + defaults to one bin + + Attributes + ---------- + correction : 'P0' or None + Apply the P0 correction to scattering matrices if set to 'P0' + legendre_order : int + The highest legendre moment in the scattering matrix (default is 0) + name : str, optional + Name of the multi-group cross section + rxn_type : str + Reaction type (e.g., 'total', 'nu-fission', etc.) + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + domain : Material or Cell or Universe or Mesh + Domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + Domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + Energy group structure for energy condensation + num_polar : Integral + Number of equi-width polar angle bins for angle discretization + num_azimuthal : Integral + Number of equi-width azimuthal angle bins for angle discretization + tally_trigger : openmc.Trigger + An (optional) tally precision trigger given to each tally used to + compute the cross section + scores : list of str + The scores in each tally used to compute the multi-group cross section + filters : list of openmc.Filter + The filters in each tally used to compute the multi-group cross section + tally_keys : list of str + The keys into the tallies dictionary for each tally used to compute + the multi-group cross section + 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 + are strings listed in the :attr:`NuScatterMatrixXS.tally_keys` property + and values are instances of :class:`openmc.Tally`. + rxn_rate_tally : openmc.Tally + Derived tally for the reaction rate tally used in the numerator to + compute the multi-group cross section. This attribute is None + unless the multi-group cross section has been computed. + xs_tally : openmc.Tally + Derived tally for the multi-group cross section. This attribute + is None unless the multi-group cross section has been computed. + num_subdomains : int + The number of subdomains is unity for 'material', 'cell' and 'universe' + domain types. This is equal to the number of cell instances + for 'distribcell' domain types (it is equal to unity prior to loading + tally data from a statepoint file). + num_nuclides : int + The number of nuclides for which the multi-group cross section is + being tracked. This is unity if the by_nuclide attribute is False. + nuclides : Iterable of str or 'sum' + The optional user-specified nuclides for which to compute cross + sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides + are not specified by the user, all nuclides in the spatial domain + are included. This attribute is 'sum' if by_nuclide is false. + sparse : bool + Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format + for compressed data storage + loaded_sp : bool + Whether or not a statepoint file has been loaded with tally data + derived : bool + Whether or not the MGXS is merged from one or more other MGXS + hdf5_key : str + The key used to index multi-group cross sections in an HDF5 data store + + """ + + def __init__(self, domain=None, domain_type=None, + groups=None, by_nuclide=False, name='', num_polar=1, + num_azimuthal=1): + super(ScatterMatrixXS, self).__init__(domain, domain_type, + groups, by_nuclide, name, + num_polar, num_azimuthal) + self._rxn_type = 'scatter' + self._hdf5_key = 'convolved scatter matrix' + self._estimator = 'track-length' + self._valid_estimators = ['analog'] + + + def __deepcopy__(self, memo): + clone = super(ScatterMatrixXS, self).__deepcopy__(memo) + clone._correction = self.correction + clone._scatter_format = self.scatter_format + clone._legendre_order = self.legendre_order + clone._histogram_bins = self.histogram_bins + return clone + + + @property + def _dont_squeeze(self): + """Create a tuple of axes which should not be removed during the get_xs + process + """ + if self.num_polar > 1 or self.num_azimuthal > 1: + if self.scatter_format == 'histogram': + return (0, 1, 3, 4, 5) + else: + return (0, 1, 3, 4) + else: + if self.scatter_format == 'histogram': + return (1, 2, 3) + else: + return (1, 2) + + + @property + def correction(self): + return self._correction + + + @property + def scatter_format(self): + return self._scatter_format + + + @property + def legendre_order(self): + return self._legendre_order + + + @property + def histogram_bins(self): + return self._histogram_bins + + + @property + def scores(self): + scores = ['flux'] + + if self.scatter_format == 'legendre': + if self.correction == 'P0' and self.legendre_order == 0: + scores += ['{}-0'.format(self.rxn_type), + '{}-1'.format(self.rxn_type)] + else: + scores += ['{}-P{}'.format(self.rxn_type, self.legendre_order)] + elif self.scatter_format == 'histogram': + scores += [self.rxn_type] + + return scores + + + @property + def filters(self): + group_edges = self.energy_groups.group_edges + energy = openmc.EnergyFilter(group_edges) + energyout = openmc.EnergyoutFilter(group_edges) + + if self.scatter_format == 'legendre': + if self.correction == 'P0' and self.legendre_order == 0: + filters = [[energy], [energy, energyout], [energyout]] + else: + filters = [[energy], [energy, energyout]] + elif self.scatter_format == 'histogram': + bins = np.linspace(-1., 1., num=self.histogram_bins + 1, + endpoint=True) + filters = [[energy], [energy, energyout, openmc.MuFilter(bins)]] + + return self._add_angle_filters(filters) + + + @property + def rxn_rate_tally(self): + if self._rxn_rate_tally is None: + if self.scatter_format == 'legendre': + # If using P0 correction subtract scatter-1 from the diagonal + if self.correction == 'P0' and self.legendre_order == 0: + scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)] + scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] + energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) + energy_filter = copy.deepcopy(energy_filter) + scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) + self._rxn_rate_tally = scatter_p0 - scatter_p1 + + # Extract scattering moment reaction rate Tally + else: + tally_key = '{}-P{}'.format(self.rxn_type, + self.legendre_order) + self._rxn_rate_tally = self.tallies[tally_key] + elif self.scatter_format == 'histogram': + # Extract scattering rate distribution tally + self._rxn_rate_tally = self.tallies[self.rxn_type] + + self._rxn_rate_tally.sparse = self.sparse + + return self._rxn_rate_tally + + class MultiplicityMatrixXS(MatrixMGXS): r"""The scattering multiplicity matrix. @@ -4891,6 +5126,321 @@ class MultiplicityMatrixXS(MatrixMGXS): return self._xs_tally +# FIXME + +class ScatterProbabilityMatrix(MatrixMGXS): + r"""The group-to-group scattering matrix. + + This class can be used for both OpenMC input generation and tally data + post-processing to compute spatially-homogenized and energy-integrated + multi-group cross sections for multi-group neutronics calculations. At a + minimum, one needs to set the :attr:`NuScatterProbabilityMatrix.energy_groups` + and :attr:`ScatterProbabilityMatrix.domain` properties. Tallies for the + appropriate reaction rates over the specified domain are generated + automatically via the :attr:`ScatterProbabilityMatrix.tallies` property, + which can then be appended to a :class:`openmc.Tallies` instance. + + For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the + necessary data to compute multi-group cross sections from a + :class:`openmc.StatePoint` instance. The derived multi-group cross section + can then be obtained from the :attr:`ScatterProbabilityMatrix.xs_tally` + property. + + For a spatial domain :math:`V`, incoming energy group + :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, + the multiplicity is calculated as: + + .. math:: + + \langle \upsilon \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in + D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} + d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow + E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ + \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in + D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} + d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow + E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ + \upsilon_{g'\rightarrow g} &= \frac{\langle \upsilon + \sigma_{s,g'\rightarrow g} \rangle}{\langle \sigma_{s,g'\rightarrow g} + \rangle} + + where :math:`\upsilon_i` is the multiplicity for the :math:`i`-th reaction. + + Parameters + ---------- + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + The domain type for spatial homogenization + groups : openmc.mgxs.EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + num_polar : Integral, optional + Number of equi-width polar angle bins for angle discretization; + defaults to one bin + num_azimuthal : Integral, optional + Number of equi-width azimuthal angle bins for angle discretization; + defaults to one bin + + Attributes + ---------- + name : str, optional + Name of the multi-group cross section + rxn_type : str + Reaction type (e.g., 'total', 'nu-fission', etc.) + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + domain : Material or Cell or Universe or Mesh + Domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + Domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + Energy group structure for energy condensation + num_polar : Integral + Number of equi-width polar angle bins for angle discretization + num_azimuthal : Integral + Number of equi-width azimuthal angle bins for angle discretization + tally_trigger : openmc.Trigger + An (optional) tally precision trigger given to each tally used to + compute the cross section + scores : list of str + The scores in each tally used to compute the multi-group cross section + filters : list of openmc.Filter + The filters in each tally used to compute the multi-group cross section + tally_keys : list of str + The keys into the tallies dictionary for each tally used to compute + the multi-group cross section + 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 + are strings listed in the :attr:`MultiplicityMatrixXS.tally_keys` + property and values are instances of :class:`openmc.Tally`. + rxn_rate_tally : openmc.Tally + Derived tally for the reaction rate tally used in the numerator to + compute the multi-group cross section. This attribute is None + unless the multi-group cross section has been computed. + xs_tally : openmc.Tally + Derived tally for the multi-group cross section. This attribute + is None unless the multi-group cross section has been computed. + num_subdomains : int + The number of subdomains is unity for 'material', 'cell' and 'universe' + domain types. This is equal to the number of cell instances + for 'distribcell' domain types (it is equal to unity prior to loading + tally data from a statepoint file). + num_nuclides : int + The number of nuclides for which the multi-group cross section is + being tracked. This is unity if the by_nuclide attribute is False. + nuclides : Iterable of str or 'sum' + The optional user-specified nuclides for which to compute cross + sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides + are not specified by the user, all nuclides in the spatial domain + are included. This attribute is 'sum' if by_nuclide is false. + sparse : bool + Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format + for compressed data storage + loaded_sp : bool + Whether or not a statepoint file has been loaded with tally data + derived : bool + Whether or not the MGXS is merged from one or more other MGXS + hdf5_key : str + The key used to index multi-group cross sections in an HDF5 data store + + """ + + def __init__(self, domain=None, domain_type=None, + groups=None, by_nuclide=False, name='', num_polar=1, + num_azimuthal=1): + super(ScatterProbabilityMatrix, self).__init__( + domain, domain_type, groups, by_nuclide, + name, num_polar, num_azimuthal) + + self._rxn_type = 'scatter' + self._estimator = 'analog' + self._valid_estimators = ['analog'] + self._hdf5_key = 'scatter probability matrix' + + @property + def scores(self): + scores = ['scatter'] + return scores + + @property + def filters(self): + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy = openmc.EnergyFilter(group_edges) + energyout = openmc.EnergyoutFilter(group_edges) + filters = [[energy, energyout]] + + return self._add_angle_filters(filters) + + @property + def rxn_rate_tally(self): + if self._rxn_rate_tally is None: + self._rxn_rate_tally = self.tallies['scatter'] + self._rxn_rate_tally.sparse = self.sparse + return self._rxn_rate_tally + + @property + def xs_tally(self): + + if self._xs_tally is None: + energyout = self.filters[1] + norm = self.rxn_rate_tally.summation( + filters=openmc.EnergyOutFilter, filter_bins=energyout.bins) + + # Compute the group-to-group probailities + self._xs_tally = self.tallies['scatter'] / norm + super(ScatterProbabilityMatrix, self)._compute_xs() + + return self._xs_tally + + +# FIXME + +class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): + r"""The group-to-group nu-scattering matrix. + + This class can be used for both OpenMC input generation and tally data + post-processing to compute spatially-homogenized and energy-integrated + multi-group cross sections for multi-group neutronics calculations. At a + minimum, one needs to set the :attr:`ScatterProbabilityMatrix.energy_groups` + and :attr:`NuScatterProbabilityMatrix.domain` properties. Tallies for the + appropriate reaction rates over the specified domain are generated + automatically via the :attr:`NuScatterProbabilityMatrix.tallies` property, + which can then be appended to a :class:`openmc.Tallies` instance. + + For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the + necessary data to compute multi-group cross sections from a + :class:`openmc.StatePoint` instance. The derived multi-group cross section + can then be obtained from the :attr:`NuScatterProbabilityMatrix.xs_tally` + property. + + For a spatial domain :math:`V`, incoming energy group + :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, + the multiplicity is calculated as: + + .. math:: + + \langle \upsilon \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in + D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} + d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow + E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ + \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in + D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} + d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow + E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ + \upsilon_{g'\rightarrow g} &= \frac{\langle \upsilon + \sigma_{s,g'\rightarrow g} \rangle}{\langle \sigma_{s,g'\rightarrow g} + \rangle} + + where :math:`\upsilon_i` is the multiplicity for the :math:`i`-th reaction. + + Parameters + ---------- + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + The domain type for spatial homogenization + groups : openmc.mgxs.EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + num_polar : Integral, optional + Number of equi-width polar angle bins for angle discretization; + defaults to one bin + num_azimuthal : Integral, optional + Number of equi-width azimuthal angle bins for angle discretization; + defaults to one bin + + Attributes + ---------- + name : str, optional + Name of the multi-group cross section + rxn_type : str + Reaction type (e.g., 'total', 'nu-fission', etc.) + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + domain : Material or Cell or Universe or Mesh + Domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + Domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + Energy group structure for energy condensation + num_polar : Integral + Number of equi-width polar angle bins for angle discretization + num_azimuthal : Integral + Number of equi-width azimuthal angle bins for angle discretization + tally_trigger : openmc.Trigger + An (optional) tally precision trigger given to each tally used to + compute the cross section + scores : list of str + The scores in each tally used to compute the multi-group cross section + filters : list of openmc.Filter + The filters in each tally used to compute the multi-group cross section + tally_keys : list of str + The keys into the tallies dictionary for each tally used to compute + the multi-group cross section + 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 + are strings listed in the :attr:`MultiplicityMatrixXS.tally_keys` + property and values are instances of :class:`openmc.Tally`. + rxn_rate_tally : openmc.Tally + Derived tally for the reaction rate tally used in the numerator to + compute the multi-group cross section. This attribute is None + unless the multi-group cross section has been computed. + xs_tally : openmc.Tally + Derived tally for the multi-group cross section. This attribute + is None unless the multi-group cross section has been computed. + num_subdomains : int + The number of subdomains is unity for 'material', 'cell' and 'universe' + domain types. This is equal to the number of cell instances + for 'distribcell' domain types (it is equal to unity prior to loading + tally data from a statepoint file). + num_nuclides : int + The number of nuclides for which the multi-group cross section is + being tracked. This is unity if the by_nuclide attribute is False. + nuclides : Iterable of str or 'sum' + The optional user-specified nuclides for which to compute cross + sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides + are not specified by the user, all nuclides in the spatial domain + are included. This attribute is 'sum' if by_nuclide is false. + sparse : bool + Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format + for compressed data storage + loaded_sp : bool + Whether or not a statepoint file has been loaded with tally data + derived : bool + Whether or not the MGXS is merged from one or more other MGXS + hdf5_key : str + The key used to index multi-group cross sections in an HDF5 data store + + """ + + def __init__(self, domain=None, domain_type=None, + groups=None, by_nuclide=False, name='', num_polar=1, + num_azimuthal=1): + + super(NuScatterProbabilityMatrix, self).__init__( + domain, domain_type, groups,by_nuclide, + name, num_polar, num_azimuthal) + + self._rxn_type = 'nu-scatter' + self._estimator = 'analog' + self._valid_estimators = ['analog'] + self._hdf5_key = 'nu-scatter probability matrix' + + class NuFissionMatrixXS(MatrixMGXS): r"""A fission production matrix multi-group cross section. @@ -5020,6 +5570,8 @@ class NuFissionMatrixXS(MatrixMGXS): self._valid_estimators = ['analog'] + + class Chi(MGXS): r"""The fission spectrum. From 61eb0825f4f2424f89c917a598e52c0e946617d7 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sat, 18 Feb 2017 14:46:27 -0500 Subject: [PATCH 02/40] Added new consistent scattering matrix classes to openmc.mgxs --- openmc/mgxs/mgxs.py | 495 +++++++++++++++++++++++--------------------- 1 file changed, 257 insertions(+), 238 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 011182cfe..959743313 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -32,6 +32,8 @@ MGXS_TYPES = ['total', 'nu-scatter matrix', 'multiplicity matrix', 'nu-fission matrix', + 'scatter probability matrix', + 'nu-scatter probability matrix', 'chi', 'chi-prompt', 'inverse-velocity', @@ -725,6 +727,10 @@ class MGXS(object): mgxs = NuScatterMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'multiplicity matrix': mgxs = MultiplicityMatrixXS(domain, domain_type, energy_groups) + elif mgxs_type == 'scatter probability matrix': + mgxs = ScatterProbabilityMatrix(domain, domain_type, energy_groups) + elif mgxs_type == 'nu-scatter probability matrix': + mgxs = NuScatterProbabilityMatrix(domain, domain_type, energy_groups) elif mgxs_type == 'nu-fission matrix': mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'chi': @@ -4722,241 +4728,6 @@ class NuScatterMatrixXS(ScatterMatrixXS): self._hdf5_key = 'nu-scatter matrix' - -# FIXME: Kord's scattering matrix idea - -class ConvolvedScatterMatrixXS(ScatterMatrixXS): - """A scattering production matrix multi-group cross section for one or - more Legendre moments. - - This class can be used for both OpenMC input generation and tally data - post-processing to compute spatially-homogenized and energy-integrated - multi-group cross sections for multi-group neutronics calculations. At a - minimum, one needs to set the :attr:`NuScatterMatrixXS.energy_groups` and - :attr:`NuScatterMatrixXS.domain` properties. Tallies for the flux and - appropriate reaction rates over the specified domain are generated - automatically via the :attr:`NuScatterMatrixXS.tallies` property, which can - then be appended to a :class:`openmc.Tallies` instance. - - For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the - necessary data to compute multi-group cross sections from a - :class:`openmc.StatePoint` instance. The derived multi-group cross section - can then be obtained from the :attr:`NuScatterMatrixXS.xs_tally` property. - - The calculation of the scattering-production matrix is the same as that for - :class:`ScatterMatrixXS` except that the scattering multiplicity is - accounted for. - - Parameters - ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh - The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - The domain type for spatial homogenization - groups : openmc.mgxs.EnergyGroups - The energy group structure for energy condensation - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - name : str, optional - Name of the multi-group cross section. Used as a label to identify - tallies in OpenMC 'tallies.xml' file. - num_polar : Integral, optional - Number of equi-width polar angle bins for angle discretization; - defaults to one bin - num_azimuthal : Integral, optional - Number of equi-width azimuthal angle bins for angle discretization; - defaults to one bin - - Attributes - ---------- - correction : 'P0' or None - Apply the P0 correction to scattering matrices if set to 'P0' - legendre_order : int - The highest legendre moment in the scattering matrix (default is 0) - name : str, optional - Name of the multi-group cross section - rxn_type : str - Reaction type (e.g., 'total', 'nu-fission', etc.) - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - domain : Material or Cell or Universe or Mesh - Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - Domain type for spatial homogenization - energy_groups : openmc.mgxs.EnergyGroups - Energy group structure for energy condensation - num_polar : Integral - Number of equi-width polar angle bins for angle discretization - num_azimuthal : Integral - Number of equi-width azimuthal angle bins for angle discretization - tally_trigger : openmc.Trigger - An (optional) tally precision trigger given to each tally used to - compute the cross section - scores : list of str - The scores in each tally used to compute the multi-group cross section - filters : list of openmc.Filter - The filters in each tally used to compute the multi-group cross section - tally_keys : list of str - The keys into the tallies dictionary for each tally used to compute - the multi-group cross section - 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 - are strings listed in the :attr:`NuScatterMatrixXS.tally_keys` property - and values are instances of :class:`openmc.Tally`. - rxn_rate_tally : openmc.Tally - Derived tally for the reaction rate tally used in the numerator to - compute the multi-group cross section. This attribute is None - unless the multi-group cross section has been computed. - xs_tally : openmc.Tally - Derived tally for the multi-group cross section. This attribute - is None unless the multi-group cross section has been computed. - num_subdomains : int - The number of subdomains is unity for 'material', 'cell' and 'universe' - domain types. This is equal to the number of cell instances - for 'distribcell' domain types (it is equal to unity prior to loading - tally data from a statepoint file). - num_nuclides : int - The number of nuclides for which the multi-group cross section is - being tracked. This is unity if the by_nuclide attribute is False. - nuclides : Iterable of str or 'sum' - The optional user-specified nuclides for which to compute cross - sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides - are not specified by the user, all nuclides in the spatial domain - are included. This attribute is 'sum' if by_nuclide is false. - sparse : bool - Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format - for compressed data storage - loaded_sp : bool - Whether or not a statepoint file has been loaded with tally data - derived : bool - Whether or not the MGXS is merged from one or more other MGXS - hdf5_key : str - The key used to index multi-group cross sections in an HDF5 data store - - """ - - def __init__(self, domain=None, domain_type=None, - groups=None, by_nuclide=False, name='', num_polar=1, - num_azimuthal=1): - super(ScatterMatrixXS, self).__init__(domain, domain_type, - groups, by_nuclide, name, - num_polar, num_azimuthal) - self._rxn_type = 'scatter' - self._hdf5_key = 'convolved scatter matrix' - self._estimator = 'track-length' - self._valid_estimators = ['analog'] - - - def __deepcopy__(self, memo): - clone = super(ScatterMatrixXS, self).__deepcopy__(memo) - clone._correction = self.correction - clone._scatter_format = self.scatter_format - clone._legendre_order = self.legendre_order - clone._histogram_bins = self.histogram_bins - return clone - - - @property - def _dont_squeeze(self): - """Create a tuple of axes which should not be removed during the get_xs - process - """ - if self.num_polar > 1 or self.num_azimuthal > 1: - if self.scatter_format == 'histogram': - return (0, 1, 3, 4, 5) - else: - return (0, 1, 3, 4) - else: - if self.scatter_format == 'histogram': - return (1, 2, 3) - else: - return (1, 2) - - - @property - def correction(self): - return self._correction - - - @property - def scatter_format(self): - return self._scatter_format - - - @property - def legendre_order(self): - return self._legendre_order - - - @property - def histogram_bins(self): - return self._histogram_bins - - - @property - def scores(self): - scores = ['flux'] - - if self.scatter_format == 'legendre': - if self.correction == 'P0' and self.legendre_order == 0: - scores += ['{}-0'.format(self.rxn_type), - '{}-1'.format(self.rxn_type)] - else: - scores += ['{}-P{}'.format(self.rxn_type, self.legendre_order)] - elif self.scatter_format == 'histogram': - scores += [self.rxn_type] - - return scores - - - @property - def filters(self): - group_edges = self.energy_groups.group_edges - energy = openmc.EnergyFilter(group_edges) - energyout = openmc.EnergyoutFilter(group_edges) - - if self.scatter_format == 'legendre': - if self.correction == 'P0' and self.legendre_order == 0: - filters = [[energy], [energy, energyout], [energyout]] - else: - filters = [[energy], [energy, energyout]] - elif self.scatter_format == 'histogram': - bins = np.linspace(-1., 1., num=self.histogram_bins + 1, - endpoint=True) - filters = [[energy], [energy, energyout, openmc.MuFilter(bins)]] - - return self._add_angle_filters(filters) - - - @property - def rxn_rate_tally(self): - if self._rxn_rate_tally is None: - if self.scatter_format == 'legendre': - # If using P0 correction subtract scatter-1 from the diagonal - if self.correction == 'P0' and self.legendre_order == 0: - scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)] - scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] - energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) - energy_filter = copy.deepcopy(energy_filter) - scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) - self._rxn_rate_tally = scatter_p0 - scatter_p1 - - # Extract scattering moment reaction rate Tally - else: - tally_key = '{}-P{}'.format(self.rxn_type, - self.legendre_order) - self._rxn_rate_tally = self.tallies[tally_key] - elif self.scatter_format == 'histogram': - # Extract scattering rate distribution tally - self._rxn_rate_tally = self.tallies[self.rxn_type] - - self._rxn_rate_tally.sparse = self.sparse - - return self._rxn_rate_tally - - class MultiplicityMatrixXS(MatrixMGXS): r"""The scattering multiplicity matrix. @@ -5126,7 +4897,7 @@ class MultiplicityMatrixXS(MatrixMGXS): return self._xs_tally -# FIXME +# FIXME: Kord's scattering matrix idea class ScatterProbabilityMatrix(MatrixMGXS): r"""The group-to-group scattering matrix. @@ -5301,7 +5072,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): return self._xs_tally -# FIXME +# FIXME: Kord's scattering matrix idea class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): r"""The group-to-group nu-scattering matrix. @@ -5430,7 +5201,6 @@ class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): def __init__(self, domain=None, domain_type=None, groups=None, by_nuclide=False, name='', num_polar=1, num_azimuthal=1): - super(NuScatterProbabilityMatrix, self).__init__( domain, domain_type, groups,by_nuclide, name, num_polar, num_azimuthal) @@ -5441,6 +5211,255 @@ class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): self._hdf5_key = 'nu-scatter probability matrix' + +# FIXME: Kord's scattering matrix idea + +@add_metaclass(ABCMeta) +class ConvolvedMGXS(MGXS): + + # FIXME: Add docstring + + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + + super(ConvolvedMGXS, self).__init__( + domain, domain_type, groups, by_nuclide, + name, num_polar, num_azimuthal) + + self._mgxs = [] + + 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 = super(ConvolvedMGXS, self).__deepcopy__(self) + clone._mgxs = copy.deepcopy(self.mgxs) + return clone + else: + return existing + + @property + def mgxs(self): + return self._mgxs + + @property + def filters(self): + filters = [] + for mgxs in self.mgxs: + filters.extend(mgxs.filters) + return filters + + @property + def tallies(self): + + # Instantiate tallies if they do not exist + if self._tallies is None: + + # Initialize a collection of Tallies + self._tallies = OrderedDict() + + # Add tallies created for each MGXS + for mgxs in self.mgxs: + for key in mgxs.tallies: + self._tallies[key] = mgxs.tallies[key] + + return self._tallies + + @name.setter + def name(self, name): + cv.check_type('name', name, string_types) + + self._name = name + for mgxs in self.mgxs: + mgxs.name = name + + @by_nuclide.setter + def by_nuclide(self, by_nuclide): + cv.check_type('by_nuclide', by_nuclide, bool) + + self._by_nuclide = by_nuclide + for mgxs in self.mgxs: + mgxs.by_nuclide = by_nuclide + + @nuclides.setter + def nuclides(self, nuclides): + cv.check_iterable_type('nuclides', nuclides, string_types) + + self._nuclides = nuclides + for mgxs in self.mgxs: + mgxs.nuclides = nuclides + + @estimator.setter + def estimator(self, estimator): + raise ValueError('Unable to assign a tally estimator a ConvolvedMGXS') + + @domain.setter + def domain(self, domain): + cv.check_type('domain', domain, _DOMAINS) + + self._domain = domain + for mgxs in self.mgxs: + mgxs.domain = domain + + # Assign a domain type + if self.domain_type is None: + if isinstance(domain, openmc.Material): + self._domain_type = 'material' + elif isinstance(domain, openmc.Cell): + self._domain_type = 'cell' + elif isinstance(domain, openmc.Universe): + self._domain_type = 'universe' + elif isinstance(domain, openmc.Mesh): + self._domain_type = 'mesh' + + @domain_type.setter + def domain_type(self, domain_type): + cv.check_value('domain type', domain_type, DOMAIN_TYPES) + + self._domain_type = domain_type + for mgxs in self.mgxs: + mgxs.domain_type = domain_type + + @energy_groups.setter + def energy_groups(self, energy_groups): + cv.check_type('energy groups', energy_groups, openmc.mgxs.EnergyGroups) + + self._energy_groups = energy_groups + for mgxs in self.mgxs: + mgxs.energy_groups = energy_groups + + @num_polar.setter + def num_polar(self, num_polar): + cv.check_type('num_polar', num_polar, Integral) + cv.check_greater_than('num_polar', num_polar, 0) + + self._num_polar = num_polar + for mgxs in self.mgxs: + mgxs.num_polar = num_polar + + @num_azimuthal.setter + def num_azimuthal(self, num_azimuthal): + cv.check_type('num_azimuthal', num_azimuthal, Integral) + cv.check_greater_than('num_azimuthal', num_azimuthal, 0) + + self._num_azimuthal = num_azimuthal + for mgxs in self.mgxs: + mgxs.num_azimuthal = num_azimuthal + + @tally_trigger.setter + def tally_trigger(self, tally_trigger): + cv.check_type('tally trigger', tally_trigger, openmc.Trigger) + + self._tally_trigger = tally_trigger + for mgxs in self.mgxs: + mgxs.tally_trigger = tally_trigger + + @sparse.setter + def sparse(self, sparse): + """Convert tally data from NumPy arrays to SciPy list of lists (LIL) + sparse matrices, and vice versa. + + This property may be used to reduce the amount of data in memory during + tally data processing. The tally data will be stored as SciPy LIL + matrices internally within the Tally object. All tally data access + properties and methods will return data as a dense NumPy array. + + """ + + cv.check_type('sparse', sparse, bool) + + # Sparsify or densify the derived MGXS tallies and the base tallies + if self._xs_tally: + self.xs_tally.sparse = sparse + if self._rxn_rate_tally: + self.rxn_rate_tally.sparse = sparse + + for tally_name in self.tallies: + self.tallies[tally_name].sparse = sparse + + self._sparse = sparse + for mgxs in self.mgxs: + mgxs.sparse = sparse + + +# FIXME: Kord's scattering matrix idea + +class ConsistentScatterMatrixXS(ScatterMatrixXS, ConvolvedMGXS): + + # FIXME: Add docstring + + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + super(ConsistentScatterMatrixXS, self).__init__( + domain, domain_type, groups, by_nuclide, + name, num_polar, num_azimuthal) + + self._hdf5_key = 'consistent scatter matrix' + + # Initialize each MGXS used by the convolution + self._mgxs = [ScatterXS(), ScatterProbabilityMatrix()] + + # Assign parameters to each MGXS in the convlution + for mgxs in self.mgxs: + mgxs.name = name + mgxs.by_nuclide = by_nuclide + + if domain_type is not None: + mgxs.domain_type = domain_type + if domain is not None: + mgxs.domain = domain + if groups is not None: + mgxs.energy_groups = groups + mgxs.num_polar = num_polar + mgxs.num_azimuthal = num_azimuthal + + @property + def scatter_xs(self): + return self.mgxs[0] + + @property + def probability_matrix(self): + return self.mgxs[1] + + @property + def rxn_rate_tally(self): + if self._rxn_rate_tally is None: + self._rxn_rate_tally = self.mgxs[0].rxn_rate_tally + self._rxn_rate_tally.sparse = self.sparse + + return self._rxn_rate_tally + + @property + def xs_tally(self): + if self._xs_tally is None: + if self.tallies is None: + msg = 'Unable to get xs_tally since tallies have ' \ + 'not been loaded from a statepoint' + raise ValueError(msg) + + self._xs_tally = \ + self.scatter_xs.xs_tally * self.probability_matrix.xs_tally + self._compute_xs() + + return self._xs_tally + + +class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): + + # FIXME: Add docstring + + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + super(ConsistentNuScatterMatrixXS, self).__init__( + domain, domain_type, groups, by_nuclide, + name, num_polar, num_azimuthal) + + + self._rxn_type = 'nu-scatter' + self._hdf5_key = 'consistent nu-scatter matrix' + + class NuFissionMatrixXS(MatrixMGXS): r"""A fission production matrix multi-group cross section. From 38d7f2aad746154ab7b0ae5c5cc58f4d7179d92b Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sat, 18 Feb 2017 18:10:48 -0500 Subject: [PATCH 03/40] New consistent scatter matrixs MGXS classes in openmc.mgxs now work without transport correction --- openmc/mgxs/mgxs.py | 165 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 148 insertions(+), 17 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 959743313..a5c995b1b 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -34,6 +34,8 @@ MGXS_TYPES = ['total', 'nu-fission matrix', 'scatter probability matrix', 'nu-scatter probability matrix', + 'consistent scatter matrix', + 'consistent nu-scatter matrix', 'chi', 'chi-prompt', 'inverse-velocity', @@ -731,6 +733,10 @@ class MGXS(object): mgxs = ScatterProbabilityMatrix(domain, domain_type, energy_groups) elif mgxs_type == 'nu-scatter probability matrix': mgxs = NuScatterProbabilityMatrix(domain, domain_type, energy_groups) + elif mgxs_type == 'consistent scatter matrix': + mgxs = ConsistentScatterMatrixXS(domain, domain_type, energy_groups) + elif mgxs_type == 'consistent nu-scatter matrix': + mgxs = ConsistentNuScatterMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'nu-fission matrix': mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'chi': @@ -5061,9 +5067,13 @@ class ScatterProbabilityMatrix(MatrixMGXS): def xs_tally(self): if self._xs_tally is None: - energyout = self.filters[1] +# energyout = self.filters[0][1] + energyout_bins = \ + [self.energy_groups.get_group_bounds(i) for i in range(self.num_groups, 0, -1)] norm = self.rxn_rate_tally.summation( - filters=openmc.EnergyOutFilter, filter_bins=energyout.bins) + filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) + # Remove the AggregateFilter summed across energyout bins + norm._filters = norm._filters[:2] # Compute the group-to-group probailities self._xs_tally = self.tallies['scatter'] / norm @@ -5222,12 +5232,11 @@ class ConvolvedMGXS(MGXS): def __init__(self, domain=None, domain_type=None, groups=None, by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + self._mgxs = [] super(ConvolvedMGXS, self).__init__( domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - self._mgxs = [] - def __deepcopy__(self, memo): existing = memo.get(id(self)) @@ -5262,11 +5271,12 @@ class ConvolvedMGXS(MGXS): # Add tallies created for each MGXS for mgxs in self.mgxs: for key in mgxs.tallies: - self._tallies[key] = mgxs.tallies[key] + new_key = '{} : {}'.format(mgxs.hdf5_key, key) + self._tallies[new_key] = mgxs.tallies[key] return self._tallies - @name.setter + @MGXS.name.setter def name(self, name): cv.check_type('name', name, string_types) @@ -5274,7 +5284,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.name = name - @by_nuclide.setter + @MGXS.by_nuclide.setter def by_nuclide(self, by_nuclide): cv.check_type('by_nuclide', by_nuclide, bool) @@ -5282,7 +5292,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.by_nuclide = by_nuclide - @nuclides.setter + @MGXS.nuclides.setter def nuclides(self, nuclides): cv.check_iterable_type('nuclides', nuclides, string_types) @@ -5290,11 +5300,11 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.nuclides = nuclides - @estimator.setter + @MGXS.estimator.setter def estimator(self, estimator): raise ValueError('Unable to assign a tally estimator a ConvolvedMGXS') - @domain.setter + @MGXS.domain.setter def domain(self, domain): cv.check_type('domain', domain, _DOMAINS) @@ -5313,7 +5323,7 @@ class ConvolvedMGXS(MGXS): elif isinstance(domain, openmc.Mesh): self._domain_type = 'mesh' - @domain_type.setter + @MGXS.domain_type.setter def domain_type(self, domain_type): cv.check_value('domain type', domain_type, DOMAIN_TYPES) @@ -5321,7 +5331,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.domain_type = domain_type - @energy_groups.setter + @MGXS.energy_groups.setter def energy_groups(self, energy_groups): cv.check_type('energy groups', energy_groups, openmc.mgxs.EnergyGroups) @@ -5329,7 +5339,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.energy_groups = energy_groups - @num_polar.setter + @MGXS.num_polar.setter def num_polar(self, num_polar): cv.check_type('num_polar', num_polar, Integral) cv.check_greater_than('num_polar', num_polar, 0) @@ -5338,7 +5348,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.num_polar = num_polar - @num_azimuthal.setter + @MGXS.num_azimuthal.setter def num_azimuthal(self, num_azimuthal): cv.check_type('num_azimuthal', num_azimuthal, Integral) cv.check_greater_than('num_azimuthal', num_azimuthal, 0) @@ -5347,7 +5357,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.num_azimuthal = num_azimuthal - @tally_trigger.setter + @MGXS.tally_trigger.setter def tally_trigger(self, tally_trigger): cv.check_type('tally trigger', tally_trigger, openmc.Trigger) @@ -5355,7 +5365,7 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.tally_trigger = tally_trigger - @sparse.setter + @MGXS.sparse.setter def sparse(self, sparse): """Convert tally data from NumPy arrays to SciPy list of lists (LIL) sparse matrices, and vice versa. @@ -5382,10 +5392,68 @@ class ConvolvedMGXS(MGXS): for mgxs in self.mgxs: mgxs.sparse = sparse + def load_from_statepoint(self, statepoint): + """Extracts tallies in an OpenMC StatePoint with the data needed to + compute multi-group cross sections. + + This method is needed to compute cross section data from tallies + in an OpenMC StatePoint object. + + NOTE: The statepoint must first be linked with an OpenMC Summary object. + + Parameters + ---------- + statepoint : openmc.StatePoint + An OpenMC StatePoint object with tally data + + Raises + ------ + ValueError + When this method is called with a statepoint that has not been + linked with a summary object. + + """ + + cv.check_type('statepoint', statepoint, openmc.statepoint.StatePoint) + + if statepoint.summary is None: + msg = 'Unable to load data from a statepoint which has not been ' \ + 'linked with a summary file' + raise ValueError(msg) + + # Override the domain object that loaded from an OpenMC summary file + # NOTE: This is necessary for micro cross-sections which require + # the isotopic number densities as computed by OpenMC + if self.domain_type == 'cell' or self.domain_type == 'distribcell': + self.domain = statepoint.summary.get_cell_by_id(self.domain.id) + elif self.domain_type == 'universe': + self.domain = statepoint.summary.get_universe_by_id(self.domain.id) + elif self.domain_type == 'material': + self.domain = statepoint.summary.get_material_by_id(self.domain.id) + elif self.domain_type == 'mesh': + self.domain = statepoint.meshes[self.domain.id] + else: + msg = 'Unable to load data from a statepoint for domain type {0} ' \ + 'which is not yet supported'.format(self.domain_type) + raise ValueError(msg) + + # Clear any tallies previously loaded from a statepoint + if self.loaded_sp: + self._tallies = None + self._xs_tally = None + self._rxn_rate_tally = None + self._loaded_sp = False + + for mgxs in self.mgxs: + mgxs.load_from_statepoint(statepoint) + + self._loaded_sp = True + # FIXME: Kord's scattering matrix idea +# FIXME: Note that this does not yet support transport correction -class ConsistentScatterMatrixXS(ScatterMatrixXS, ConvolvedMGXS): +class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # FIXME: Add docstring @@ -5399,6 +5467,12 @@ class ConsistentScatterMatrixXS(ScatterMatrixXS, ConvolvedMGXS): # Initialize each MGXS used by the convolution self._mgxs = [ScatterXS(), ScatterProbabilityMatrix()] + ''' + self._mgxs[1].correction = self.correction + self._mgxs[1].scatter_format = self.scatter_format + self._mgxs[1].legendre_order = self.legendre_order + self._mgxs[1].histogram_bins = self. + ''' # Assign parameters to each MGXS in the convlution for mgxs in self.mgxs: @@ -5444,6 +5518,63 @@ class ConsistentScatterMatrixXS(ScatterMatrixXS, ConvolvedMGXS): return self._xs_tally + # FIXME: Add not implemented yet errors to these property getters/setters + ''' + @ScatterMatrixXS.correction.setter + def correction(self, correction): + cv.check_value('correction', correction, ('P0', None)) + + if self.scatter_format == 'legendre': + if correction == 'P0' and self.legendre_order > 0: + msg = 'The P0 correction will be ignored since the ' \ + 'scattering order {} is greater than '\ + 'zero'.format(self.legendre_order) + warnings.warn(msg) + elif self.scatter_format == 'histogram': + msg = 'The P0 correction will be ignored since the ' \ + 'scatter format is set to histogram' + warnings.warn(msg) + + self._correction = correction + + @ScatterMatrixXS.scatter_format.setter + def scatter_format(self, scatter_format): + cv.check_value('scatter_format', scatter_format, MU_TREATMENTS) + self._scatter_format = scatter_format + + @ScatterMatrixXS.legendre_order.setter + def legendre_order(self, legendre_order): + cv.check_type('legendre_order', legendre_order, Integral) + cv.check_greater_than('legendre_order', legendre_order, 0, + equality=True) + cv.check_less_than('legendre_order', legendre_order, _MAX_LEGENDRE, + equality=True) + + if self.scatter_format == 'legendre': + if self.correction == 'P0' and legendre_order > 0: + msg = 'The P0 correction will be ignored since the ' \ + 'scattering order {} is greater than ' \ + 'zero'.format(self.legendre_order) + warnings.warn(msg, RuntimeWarning) + self.correction = None + elif self.scatter_format == 'histogram': + msg = 'The legendre order will be ignored since the ' \ + 'scatter format is set to histogram' + warnings.warn(msg) + + self._legendre_order = legendre_order + + @ScatterMatrixXS.histogram_bins.setter + def histogram_bins(self, histogram_bins): + cv.check_type('histogram_bins', histogram_bins, Integral) + cv.check_greater_than('histogram_bins', histogram_bins, 0) + + self._histogram_bins = histogram_bins + ''' + + def load_from_statepoint(self, statepoint): + super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) + class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): From d619e7dca76f0e3ec4cad931132f5939a9fd49ea Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sat, 18 Feb 2017 18:40:41 -0500 Subject: [PATCH 04/40] New consistent scatter matrix class methods now working --- openmc/mgxs/mgxs.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index a5c995b1b..56fac9bcd 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5238,15 +5238,9 @@ class ConvolvedMGXS(MGXS): name, num_polar, num_azimuthal) 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 = super(ConvolvedMGXS, self).__deepcopy__(self) - clone._mgxs = copy.deepcopy(self.mgxs) - return clone - else: - return existing + clone = super(ConvolvedMGXS, self).__deepcopy__(memo) + clone._mgxs = copy.deepcopy(self.mgxs) + return clone @property def mgxs(self): @@ -5575,6 +5569,26 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def load_from_statepoint(self, statepoint): super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) + def get_condensed_xs(self, coarse_groups): + condense_xs = \ + super(ConsistentScatterMatrixXS, self).get_condensed_xs(coarse_groups) + condense_xs._tallies = None + + for i, mgxs in enumerate(condense_xs._mgxs): + condense_xs._mgxs[i] = mgxs.get_condensed_xs(coarse_groups) + + return condense_xs + + def get_subdomain_avg_xs(self, subdomains='all'): + avg_xs = \ + super(ConsistentScatterMatrixXS, self).get_subdomain_avg_xs(subdomains) + avg_xs._tallies = None + + for i, mgxs in enumerate(avg_xs._mgxs): + self._mgxs[i] = mgxs.get_subdomain_avg_xs(subdomains) + + return avg_xs + class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): From 1f3ae990802e23fbc4bc97adfad22fc133b01349 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sat, 18 Feb 2017 19:00:58 -0500 Subject: [PATCH 05/40] Fixed issue in ConsistentNuScatterMatrixXS --- openmc/mgxs/mgxs.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 56fac9bcd..53802a4bb 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5600,9 +5600,23 @@ class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - self._rxn_type = 'nu-scatter' self._hdf5_key = 'consistent nu-scatter matrix' + self._mgxs = [NuScatterXS(), ScatterProbabilityMatrix()] + + # Assign parameters to each MGXS in the convlution + for mgxs in self.mgxs: + mgxs.name = name + mgxs.by_nuclide = by_nuclide + + if domain_type is not None: + mgxs.domain_type = domain_type + if domain is not None: + mgxs.domain = domain + if groups is not None: + mgxs.energy_groups = groups + mgxs.num_polar = num_polar + mgxs.num_azimuthal = num_azimuthal class NuFissionMatrixXS(MatrixMGXS): From 8287b88ce03a1ab789c8bb12fd7e7ea8d794e3ee Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sat, 18 Feb 2017 19:11:05 -0500 Subject: [PATCH 06/40] Removed commented out code in openmc.mgxs --- openmc/mgxs/mgxs.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 53802a4bb..477292bd4 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5461,12 +5461,6 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # Initialize each MGXS used by the convolution self._mgxs = [ScatterXS(), ScatterProbabilityMatrix()] - ''' - self._mgxs[1].correction = self.correction - self._mgxs[1].scatter_format = self.scatter_format - self._mgxs[1].legendre_order = self.legendre_order - self._mgxs[1].histogram_bins = self. - ''' # Assign parameters to each MGXS in the convlution for mgxs in self.mgxs: From f3192d01b8dfb3464998122d58df6250ff02ffac Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 14:53:16 -0500 Subject: [PATCH 07/40] First attempt to add transport correction to consistent scattering matrix MGXS --- openmc/mgxs/mgxs.py | 169 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 164 insertions(+), 5 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 477292bd4..338bb67cc 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3911,7 +3911,9 @@ class ScatterMatrixXS(MatrixMGXS): self._valid_estimators = ['analog'] def __deepcopy__(self, memo): + print('HERE2') clone = super(ScatterMatrixXS, self).__deepcopy__(memo) + print('HERE3', clone) clone._correction = self.correction clone._scatter_format = self.scatter_format clone._legendre_order = self.legendre_order @@ -5238,14 +5240,24 @@ class ConvolvedMGXS(MGXS): name, num_polar, num_azimuthal) def __deepcopy__(self, memo): + print('HERE1') clone = super(ConvolvedMGXS, self).__deepcopy__(memo) + print('WTF') clone._mgxs = copy.deepcopy(self.mgxs) + print('HERE4') return clone @property def mgxs(self): return self._mgxs + @property + def scores(self): + scores = [] + for mgxs in self.mgxs: + scores += mgxs.scores + return scores + @property def filters(self): filters = [] @@ -5253,6 +5265,14 @@ class ConvolvedMGXS(MGXS): filters.extend(mgxs.filters) return filters + @property + def tally_keys(self): + keys = [] + for mgxs in self.mgxs: + for tally_key in mgxs.tallies: + keys += ['{} : {}'.format(mgxs.hdf5_key, tally_key)] + return keys + @property def tallies(self): @@ -5264,9 +5284,9 @@ class ConvolvedMGXS(MGXS): # Add tallies created for each MGXS for mgxs in self.mgxs: - for key in mgxs.tallies: - new_key = '{} : {}'.format(mgxs.hdf5_key, key) - self._tallies[new_key] = mgxs.tallies[key] + for tally_key in mgxs.tallies: + new_key = '{} : {}'.format(mgxs.hdf5_key, tally_key) + self._tallies[new_key] = mgxs.tallies[tally_key] return self._tallies @@ -5431,6 +5451,44 @@ class ConvolvedMGXS(MGXS): 'which is not yet supported'.format(self.domain_type) raise ValueError(msg) + # Use tally "slicing" to ensure that tallies correspond to our domain + # NOTE: This is important if tally merging was used + if self.domain_type == 'mesh': + filters = [_DOMAIN_TO_FILTER[self.domain_type]] + xyz = [range(1, x + 1) for x in self.domain.dimension] + filter_bins = [tuple(itertools.product(*xyz))] + elif self.domain_type != 'distribcell': + filters = [_DOMAIN_TO_FILTER[self.domain_type]] + filter_bins = [(self.domain.id,)] + # Distribcell filters only accept single cell - neglect it when slicing + else: + filters = [] + filter_bins = [] + + # Clear any tallies previously loaded from a statepoint + if self.loaded_sp: + self._tallies = None + self._xs_tally = None + self._rxn_rate_tally = None + self._loaded_sp = False + + # Find, slice and store Tallies from StatePoint + # The tally slicing is needed if tally merging was used + for tally_type, tally in self.tallies.items(): + sp_tally = statepoint.get_tally( + tally.scores, tally.filters, tally.nuclides, + estimator=tally.estimator, exact_filters=True) + sp_tally = sp_tally.get_slice( + tally.scores, filters, filter_bins, tally.nuclides) + sp_tally.sparse = self.sparse + self._tallies[tally_type] = sp_tally + + for mgxs in self.mgxs: + mgxs.load_from_statepoint(statepoint) + + self._loaded_sp = True + + ''' # Clear any tallies previously loaded from a statepoint if self.loaded_sp: self._tallies = None @@ -5442,6 +5500,7 @@ class ConvolvedMGXS(MGXS): mgxs.load_from_statepoint(statepoint) self._loaded_sp = True + ''' # FIXME: Kord's scattering matrix idea @@ -5476,6 +5535,78 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): mgxs.num_polar = num_polar mgxs.num_azimuthal = num_azimuthal + @property + def scores(self): + scores = super(ConsistentScatterMatrixXS, self).scores + + # FIXME: Add scores for transport correction + if self.correction == 'P0' and self.legendre_order == 0: + scores += ['{}-1'.format(self.rxn_type)] + + return scores + + @property + def filters(self): + filters = super(ConsistentScatterMatrixXS, self).filters + + # FIXME: Add filters for transport correction + if self.correction == 'P0' and self.legendre_order == 0: + group_edges = self.energy_groups.group_edges + energyout = openmc.EnergyoutFilter(group_edges) + filters += self._add_angle_filters([[energyout]]) + + return filters + + @property + def tally_keys(self): + tally_keys = super(ConsistentScatterMatrixXS, self).tally_keys + + # FIXME: Add key for transport correction tally + if self.correction == 'P0' and self.legendre_order == 0: + tally_keys += ['scatter-1'] + + return tally_keys + + # FIXME: Make this work for transport correction + @property + def tallies(self): + + if self._tallies is None: + + self._tallies = super(ConsistentScatterMatrixXS, self).tallies + + # FIXME: Add in the transport correction tally + if self.correction == 'P0' and self.legendre_order == 0: + + tally_key = 'scatter-1' + + # Create a domain Filter object + filter_type = _DOMAIN_TO_FILTER[self.domain_type] + if self.domain_type == 'mesh': + domain_filter = filter_type(self.domain) + else: + domain_filter = filter_type(self.domain.id) + + # Create each Tally needed to compute the multi group cross section + self._tallies['scatter-1'] = openmc.Tally(name=self.name) + self._tallies['scatter-1'].estimator = 'analog' + self._tallies['scatter-1'].scores = [self.scores[-1]] + self._tallies['scatter-1'].filters = [domain_filter, *self.filters[-1]] + + # If a tally trigger was specified, add it to each tally + if self.tally_trigger: + trigger_clone = copy.deepcopy(self.tally_trigger) + trigger_clone.scores = [self.scores[-1]] + self._tallies[tally_key].triggers.append(trigger_clone) + + # If this is a by-nuclide cross-section, add nuclides to Tally + if self.by_nuclide: + self._tallies['scatter-1'].nuclides += self.get_nuclides() + else: + self._tallies['scatter-1'].nuclides.append('total') + + return self._tallies + @property def scatter_xs(self): return self.mgxs[0] @@ -5486,11 +5617,23 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): @property def rxn_rate_tally(self): + raise NotImplementedError('The rxn rate tally is not well defined ') + ''' if self._rxn_rate_tally is None: + + # FIXME: Add transport correction option + # If using P0 correction subtract scatter-1 from the diagonal + if self.correction == 'P0' and self.legendre_order == 0: + scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)] + scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] + self._rxn_rate_tally = self.mgxs[0].rxn_rate_tally self._rxn_rate_tally.sparse = self.sparse return self._rxn_rate_tally + ''' + + # FIXME: Apply transport correction @property def xs_tally(self): @@ -5500,8 +5643,24 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): 'not been loaded from a statepoint' raise ValueError(msg) + + # FIXME: If using P0 correction subtract scatter-1 from the diagonal + if self.correction == 'P0' and self.legendre_order == 0: + # FIXME: The flux tally must also use an analog estimator + flux = self.tallies['{} : flux'.format(self.rxn_type)] + scatter_p0 = self.tallies['{0} : {0}'.format(self.rxn_type)] + scatter_p1 = self.tallies['scatter-1'] + + energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) + energy_filter = copy.deepcopy(energy_filter) + scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) + correction = scatter_p1 / flux + else: + correction = 0. + self._xs_tally = \ self.scatter_xs.xs_tally * self.probability_matrix.xs_tally + self._xs_tally - correction self._compute_xs() return self._xs_tally @@ -5560,8 +5719,8 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): self._histogram_bins = histogram_bins ''' - def load_from_statepoint(self, statepoint): - super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) +# def load_from_statepoint(self, statepoint): +# super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) def get_condensed_xs(self, coarse_groups): condense_xs = \ From 70a8101cc6e90dafdb540de8627c0cbcecee67ff Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 15:25:42 -0500 Subject: [PATCH 08/40] Fixed a few issues in transport correction for consistent scattering matrices --- openmc/mgxs/mgxs.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 338bb67cc..fb7207663 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3911,9 +3911,7 @@ class ScatterMatrixXS(MatrixMGXS): self._valid_estimators = ['analog'] def __deepcopy__(self, memo): - print('HERE2') clone = super(ScatterMatrixXS, self).__deepcopy__(memo) - print('HERE3', clone) clone._correction = self.correction clone._scatter_format = self.scatter_format clone._legendre_order = self.legendre_order @@ -5240,11 +5238,8 @@ class ConvolvedMGXS(MGXS): name, num_polar, num_azimuthal) def __deepcopy__(self, memo): - print('HERE1') clone = super(ConvolvedMGXS, self).__deepcopy__(memo) - print('WTF') clone._mgxs = copy.deepcopy(self.mgxs) - print('HERE4') return clone @property @@ -5660,7 +5655,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): self._xs_tally = \ self.scatter_xs.xs_tally * self.probability_matrix.xs_tally - self._xs_tally - correction + self._xs_tally -= correction self._compute_xs() return self._xs_tally From b1574c359d24953a48247334b6b463d41c7866eb Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 15:45:37 -0500 Subject: [PATCH 09/40] Fixed energy condensation issue with consistent scattering matrix MGXS --- openmc/mgxs/mgxs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index fb7207663..038023f09 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5720,7 +5720,6 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def get_condensed_xs(self, coarse_groups): condense_xs = \ super(ConsistentScatterMatrixXS, self).get_condensed_xs(coarse_groups) - condense_xs._tallies = None for i, mgxs in enumerate(condense_xs._mgxs): condense_xs._mgxs[i] = mgxs.get_condensed_xs(coarse_groups) From b2ad5087ca5bcb7b64feb0d04f8318a711a0d971 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 15:54:37 -0500 Subject: [PATCH 10/40] Removed comments from consistent scattering matrix implementation --- openmc/mgxs/mgxs.py | 110 ++++---------------------------------------- 1 file changed, 10 insertions(+), 100 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 038023f09..006b4d830 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4903,8 +4903,6 @@ class MultiplicityMatrixXS(MatrixMGXS): return self._xs_tally -# FIXME: Kord's scattering matrix idea - class ScatterProbabilityMatrix(MatrixMGXS): r"""The group-to-group scattering matrix. @@ -5053,7 +5051,6 @@ class ScatterProbabilityMatrix(MatrixMGXS): energy = openmc.EnergyFilter(group_edges) energyout = openmc.EnergyoutFilter(group_edges) filters = [[energy, energyout]] - return self._add_angle_filters(filters) @property @@ -5067,11 +5064,11 @@ class ScatterProbabilityMatrix(MatrixMGXS): def xs_tally(self): if self._xs_tally is None: -# energyout = self.filters[0][1] energyout_bins = \ [self.energy_groups.get_group_bounds(i) for i in range(self.num_groups, 0, -1)] norm = self.rxn_rate_tally.summation( filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) + # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] @@ -5082,8 +5079,6 @@ class ScatterProbabilityMatrix(MatrixMGXS): return self._xs_tally -# FIXME: Kord's scattering matrix idea - class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): r"""The group-to-group nu-scattering matrix. @@ -5221,9 +5216,6 @@ class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): self._hdf5_key = 'nu-scatter probability matrix' - -# FIXME: Kord's scattering matrix idea - @add_metaclass(ABCMeta) class ConvolvedMGXS(MGXS): @@ -5478,28 +5470,12 @@ class ConvolvedMGXS(MGXS): sp_tally.sparse = self.sparse self._tallies[tally_type] = sp_tally + # Load data for the tallies in each MGXS in the convolution for mgxs in self.mgxs: mgxs.load_from_statepoint(statepoint) self._loaded_sp = True - ''' - # Clear any tallies previously loaded from a statepoint - if self.loaded_sp: - self._tallies = None - self._xs_tally = None - self._rxn_rate_tally = None - self._loaded_sp = False - - for mgxs in self.mgxs: - mgxs.load_from_statepoint(statepoint) - - self._loaded_sp = True - ''' - - -# FIXME: Kord's scattering matrix idea -# FIXME: Note that this does not yet support transport correction class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): @@ -5534,7 +5510,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def scores(self): scores = super(ConsistentScatterMatrixXS, self).scores - # FIXME: Add scores for transport correction + # Add scores for transport correction if self.correction == 'P0' and self.legendre_order == 0: scores += ['{}-1'.format(self.rxn_type)] @@ -5544,7 +5520,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def filters(self): filters = super(ConsistentScatterMatrixXS, self).filters - # FIXME: Add filters for transport correction + # Add filters for transport correction if self.correction == 'P0' and self.legendre_order == 0: group_edges = self.energy_groups.group_edges energyout = openmc.EnergyoutFilter(group_edges) @@ -5556,23 +5532,20 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def tally_keys(self): tally_keys = super(ConsistentScatterMatrixXS, self).tally_keys - # FIXME: Add key for transport correction tally + # Add key for transport correction tally if self.correction == 'P0' and self.legendre_order == 0: tally_keys += ['scatter-1'] return tally_keys - # FIXME: Make this work for transport correction @property def tallies(self): if self._tallies is None: - self._tallies = super(ConsistentScatterMatrixXS, self).tallies - # FIXME: Add in the transport correction tally + # Add in the transport correction tally if self.correction == 'P0' and self.legendre_order == 0: - tally_key = 'scatter-1' # Create a domain Filter object @@ -5613,22 +5586,6 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): @property def rxn_rate_tally(self): raise NotImplementedError('The rxn rate tally is not well defined ') - ''' - if self._rxn_rate_tally is None: - - # FIXME: Add transport correction option - # If using P0 correction subtract scatter-1 from the diagonal - if self.correction == 'P0' and self.legendre_order == 0: - scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)] - scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] - - self._rxn_rate_tally = self.mgxs[0].rxn_rate_tally - self._rxn_rate_tally.sparse = self.sparse - - return self._rxn_rate_tally - ''' - - # FIXME: Apply transport correction @property def xs_tally(self): @@ -5638,10 +5595,8 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): 'not been loaded from a statepoint' raise ValueError(msg) - - # FIXME: If using P0 correction subtract scatter-1 from the diagonal + # If using P0 correction subtract scatter-1 from the diagonal if self.correction == 'P0' and self.legendre_order == 0: - # FIXME: The flux tally must also use an analog estimator flux = self.tallies['{} : flux'.format(self.rxn_type)] scatter_p0 = self.tallies['{0} : {0}'.format(self.rxn_type)] scatter_p1 = self.tallies['scatter-1'] @@ -5660,62 +5615,17 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): return self._xs_tally - # FIXME: Add not implemented yet errors to these property getters/setters - ''' - @ScatterMatrixXS.correction.setter - def correction(self, correction): - cv.check_value('correction', correction, ('P0', None)) - - if self.scatter_format == 'legendre': - if correction == 'P0' and self.legendre_order > 0: - msg = 'The P0 correction will be ignored since the ' \ - 'scattering order {} is greater than '\ - 'zero'.format(self.legendre_order) - warnings.warn(msg) - elif self.scatter_format == 'histogram': - msg = 'The P0 correction will be ignored since the ' \ - 'scatter format is set to histogram' - warnings.warn(msg) - - self._correction = correction - @ScatterMatrixXS.scatter_format.setter def scatter_format(self, scatter_format): - cv.check_value('scatter_format', scatter_format, MU_TREATMENTS) - self._scatter_format = scatter_format + raise NotImplementedError('Not yet supported') @ScatterMatrixXS.legendre_order.setter def legendre_order(self, legendre_order): - cv.check_type('legendre_order', legendre_order, Integral) - cv.check_greater_than('legendre_order', legendre_order, 0, - equality=True) - cv.check_less_than('legendre_order', legendre_order, _MAX_LEGENDRE, - equality=True) - - if self.scatter_format == 'legendre': - if self.correction == 'P0' and legendre_order > 0: - msg = 'The P0 correction will be ignored since the ' \ - 'scattering order {} is greater than ' \ - 'zero'.format(self.legendre_order) - warnings.warn(msg, RuntimeWarning) - self.correction = None - elif self.scatter_format == 'histogram': - msg = 'The legendre order will be ignored since the ' \ - 'scatter format is set to histogram' - warnings.warn(msg) - - self._legendre_order = legendre_order + raise NotImplementedError('Not yet supported') @ScatterMatrixXS.histogram_bins.setter def histogram_bins(self, histogram_bins): - cv.check_type('histogram_bins', histogram_bins, Integral) - cv.check_greater_than('histogram_bins', histogram_bins, 0) - - self._histogram_bins = histogram_bins - ''' - -# def load_from_statepoint(self, statepoint): -# super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) + raise NotImplementedError('Not yet supported') def get_condensed_xs(self, coarse_groups): condense_xs = \ From b2d76fc4ccabfbb859315071cd1e474af8656471 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 15:55:47 -0500 Subject: [PATCH 11/40] Removed NotImplementedError from property setters for consistent scattering matrix MGXS --- openmc/mgxs/mgxs.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 006b4d830..1f4b91dd7 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5615,18 +5615,6 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): return self._xs_tally - @ScatterMatrixXS.scatter_format.setter - def scatter_format(self, scatter_format): - raise NotImplementedError('Not yet supported') - - @ScatterMatrixXS.legendre_order.setter - def legendre_order(self, legendre_order): - raise NotImplementedError('Not yet supported') - - @ScatterMatrixXS.histogram_bins.setter - def histogram_bins(self, histogram_bins): - raise NotImplementedError('Not yet supported') - def get_condensed_xs(self, coarse_groups): condense_xs = \ super(ConsistentScatterMatrixXS, self).get_condensed_xs(coarse_groups) From 2369ff44431e448ef5007e43e2b8881d5cbb4c5a Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 16:22:49 -0500 Subject: [PATCH 12/40] Added new MGXS classes to Sphinx documentation --- docs/source/pythonapi/index.rst | 5 +++ openmc/mgxs/mgxs.py | 57 ++++++++++++--------------------- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/docs/source/pythonapi/index.rst b/docs/source/pythonapi/index.rst index 1125a4b32..2d998c302 100644 --- a/docs/source/pythonapi/index.rst +++ b/docs/source/pythonapi/index.rst @@ -285,6 +285,9 @@ Multi-group Cross Sections openmc.mgxs.CaptureXS openmc.mgxs.Chi openmc.mgxs.ChiPrompt + openmc.mgxs.ConsistentNuScatterMatrixXS + openmc.mgxs.ConsistentScatterMatrixXS + openmc.mgxs.ConvolvedMGXS openmc.mgxs.FissionXS openmc.mgxs.InverseVelocity openmc.mgxs.KappaFissionXS @@ -293,10 +296,12 @@ Multi-group Cross Sections openmc.mgxs.NuFissionMatrixXS openmc.mgxs.NuScatterXS openmc.mgxs.NuScatterMatrixXS + openmc.mgxs.NuScatterProbabilityMatrix openmc.mgxs.PromptNuFissionXS openmc.mgxs.PromptNuFissionMatrixXS openmc.mgxs.ScatterXS openmc.mgxs.ScatterMatrixXS + openmc.mgxs.ScatterProbabilityMatrix openmc.mgxs.TotalXS openmc.mgxs.TransportXS diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 1f4b91dd7..7653deca4 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4904,12 +4904,12 @@ class MultiplicityMatrixXS(MatrixMGXS): class ScatterProbabilityMatrix(MatrixMGXS): - r"""The group-to-group scattering matrix. + r"""The group-to-group scattering probability matrix. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated multi-group cross sections for multi-group neutronics calculations. At a - minimum, one needs to set the :attr:`NuScatterProbabilityMatrix.energy_groups` + minimum, one needs to set the :attr:`ScatterProbabilityMatrix.energy_groups` and :attr:`ScatterProbabilityMatrix.domain` properties. Tallies for the appropriate reaction rates over the specified domain are generated automatically via the :attr:`ScatterProbabilityMatrix.tallies` property, @@ -4923,23 +4923,22 @@ class ScatterProbabilityMatrix(MatrixMGXS): For a spatial domain :math:`V`, incoming energy group :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, - the multiplicity is calculated as: + the group-to-group scatterin probabilities are calculated as: .. math:: - \langle \upsilon \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in - D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} - d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow - E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ - \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in - D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} - d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow - E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ - \upsilon_{g'\rightarrow g} &= \frac{\langle \upsilon - \sigma_{s,g'\rightarrow g} \rangle}{\langle \sigma_{s,g'\rightarrow g} - \rangle} + \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr + \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega + \int_{E_g}^{E_{g-1}} dE \; \sigma_s (r, E' + \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ + \langle \sigma_{s,g'} \phi \rangle &= \int_{r \in V} dr + \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega + \int_{0}^{\infty} dE \; \sigma_s (r, E' + \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ + P_{s,g'\rightarrow g} &= \frac{\langle + \sigma_{s,g'\rightarrow g} \phi \rangle}{\langle + \sigma_{s,g'} \phi \rangle} - where :math:`\upsilon_i` is the multiplicity for the :math:`i`-th reaction. Parameters ---------- @@ -5080,12 +5079,12 @@ class ScatterProbabilityMatrix(MatrixMGXS): class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): - r"""The group-to-group nu-scattering matrix. + r"""The group-to-group scattering-production probability matrix. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated multi-group cross sections for multi-group neutronics calculations. At a - minimum, one needs to set the :attr:`ScatterProbabilityMatrix.energy_groups` + minimum, one needs to set the :attr:`NuScatterProbabilityMatrix.energy_groups` and :attr:`NuScatterProbabilityMatrix.domain` properties. Tallies for the appropriate reaction rates over the specified domain are generated automatically via the :attr:`NuScatterProbabilityMatrix.tallies` property, @@ -5094,28 +5093,12 @@ class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the necessary data to compute multi-group cross sections from a :class:`openmc.StatePoint` instance. The derived multi-group cross section - can then be obtained from the :attr:`NuScatterProbabilityMatrix.xs_tally` + can then be obtained from the :attr:`ScatterProbabilityMatrix.xs_tally` property. - For a spatial domain :math:`V`, incoming energy group - :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, - the multiplicity is calculated as: - - .. math:: - - \langle \upsilon \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in - D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} - d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow - E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ - \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in - D} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} - d\Omega \int_{E_g}^{E_{g-1}} dE \; \sum_i \upsilon_i \sigma_i (r, E' \rightarrow - E, \Omega' \cdot \Omega) \psi(r, E', \Omega') \\ - \upsilon_{g'\rightarrow g} &= \frac{\langle \upsilon - \sigma_{s,g'\rightarrow g} \rangle}{\langle \sigma_{s,g'\rightarrow g} - \rangle} - - where :math:`\upsilon_i` is the multiplicity for the :math:`i`-th reaction. + The calculation of the scattering-production matrix is the same as that for + :class:`ScatterProbabilityMatrix` except that the scattering multiplicity is + accounted for. Parameters ---------- From fe74423c485528733582f69b953d59b4468a70d5 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 19 Feb 2017 16:51:03 -0500 Subject: [PATCH 13/40] Added docstrings to all consistent scattering matrix MGXS classes in openmc.mgxs --- docs/source/pythonapi/index.rst | 10 - openmc/mgxs/mgxs.py | 375 +++++++++++++++++++++++++++++++- 2 files changed, 371 insertions(+), 14 deletions(-) diff --git a/docs/source/pythonapi/index.rst b/docs/source/pythonapi/index.rst index 2d998c302..fec0ad767 100644 --- a/docs/source/pythonapi/index.rst +++ b/docs/source/pythonapi/index.rst @@ -115,16 +115,6 @@ Many of the above classes are derived from several abstract classes: openmc.Region openmc.Lattice -One function is also available to create a hexagonal region defined by the -intersection of six surface half-spaces. - -.. autosummary:: - :toctree: generated - :nosignatures: - :template: myfunction.rst - - openmc.make_hexagon_region - Constructing Tallies -------------------- diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 7653deca4..fb871a4b0 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5201,8 +5201,101 @@ class NuScatterProbabilityMatrix(ScatterProbabilityMatrix): @add_metaclass(ABCMeta) class ConvolvedMGXS(MGXS): + """An abstract convolution of multiple multi-group cross sections for some + energy group structure within some spatial domain. - # FIXME: Add docstring + This class can be used for both OpenMC input generation and tally data + post-processing to compute spatially-homogenized and energy-integrated + multi-group cross sections for multi-group neutronics calculations. + + NOTE: Users should instantiate the subclasses of this abstract class. + + Parameters + ---------- + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + The domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + num_polar : Integral, optional + Number of equi-width polar angle bins for angle discretization; + defaults to one bin + num_azimuthal : Integral, optional + Number of equi-width azimuthal angle bins for angle discretization; + defaults to one bin + + Attributes + ---------- + name : str, optional + Name of the multi-group cross section + rxn_type : str + Reaction type (e.g., 'total', 'nu-fission', etc.) + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + domain : Material or Cell or Universe or Mesh + Domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + Domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + Energy group structure for energy condensation + num_polar : Integral + Number of equi-width polar angle bins for angle discretization + num_azimuthal : Integral + Number of equi-width azimuthal angle bins for angle discretization + tally_trigger : openmc.Trigger + An (optional) tally precision trigger given to each tally used to + compute the cross section + scores : list of str + The scores in each tally used to compute the multi-group cross section + filters : list of openmc.Filter + The filters in each tally used to compute the multi-group cross section + 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'} + The tally estimator used to compute the multi-group cross section + tallies : collections.OrderedDict + OpenMC tallies needed to compute the multi-group cross section + rxn_rate_tally : openmc.Tally + Derived tally for the reaction rate tally used in the numerator to + compute the multi-group cross section. This attribute is None + unless the multi-group cross section has been computed. + xs_tally : openmc.Tally + Derived tally for the multi-group cross section. This attribute + is None unless the multi-group cross section has been computed. + num_subdomains : int + The number of subdomains is unity for 'material', 'cell' and 'universe' + domain types. This is equal to the number of cell instances + for 'distribcell' domain types (it is equal to unity prior to loading + tally data from a statepoint file) and the number of mesh cells for + 'mesh' domain types. + num_nuclides : int + The number of nuclides for which the multi-group cross section is + being tracked. This is unity if the by_nuclide attribute is False. + nuclides : Iterable of str or 'sum' + The optional user-specified nuclides for which to compute cross + sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides + are not specified by the user, all nuclides in the spatial domain + are included. This attribute is 'sum' if by_nuclide is false. + sparse : bool + Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format + for compressed data storage + loaded_sp : bool + Whether or not a statepoint file has been loaded with tally data + derived : bool + Whether or not the MGXS is merged from one or more other MGXS + hdf5_key : str + The key used to index multi-group cross sections in an HDF5 data store + mgxs : list of openmc.mgxs.MGXS + A list of MGXS to combine to compute this multi-group cross section + + """ def __init__(self, domain=None, domain_type=None, groups=None, by_nuclide=False, name='', num_polar=1, num_azimuthal=1): @@ -5461,8 +5554,150 @@ class ConvolvedMGXS(MGXS): class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): + r"""A scattering matrix multi-group cross section computed as the product + of the scatter cross section and group-to-group scattering probabilities. - # FIXME: Add docstring + This class is a variation of the :class:`ScatterMatrixXS` which computes + the scattering matrix as the convolution product of :class:`ScatterXS` and + :class:`ScatterProbabilityMatrix`. Unlike the :class:`ScatterMatrixXS`, + this scattering matrix is computed from the scattering cross section which + uses a tracklength estimator. This ensures that reaction rate balance is + exactly preserved with a :class:`TotalXS` computed using a tracklength + estimator. + + This class can be used for both OpenMC input generation and tally data + post-processing to compute spatially-homogenized and energy-integrated + multi-group cross sections for multi-group neutronics calculations. At a + minimum, one needs to set the + :attr:`ConsistentScatterMatrixXS.energy_groups` and + :attr:`ConsistentScatterMatrixXS.domain` properties. Tallies for the flux + and appropriate reaction rates over the specified domain are generated + automatically via the :attr:`ConsistentScatterMatrixXS.tallies` property, + which can then be appended to a :class:`openmc.Tallies` instance. + + For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the + necessary data to compute multi-group cross sections from a + :class:`openmc.StatePoint` instance. The derived multi-group cross section + can then be obtained from the :attr:`ConsistentScatterMatrixXS.xs_tally` + property. + + For a spatial domain :math:`V`, incoming energy group + :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, + the Legendre scattering moments are calculated as: + + .. math:: + + \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr + \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega + \int_{E_g}^{E_{g-1}} dE \; \sigma_s (r, E' + \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ + \langle \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega + \int_{E_g}^{E_{g-1}} dE \; \psi (r, E, \Omega) \\ + \sigma_{s,g'\rightarrow g} &= \frac{\langle + \sigma_{s,,g'\rightarrow g} \phi \rangle}{\langle \phi \rangle} + + Parameters + ---------- + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + The domain type for spatial homogenization + groups : openmc.mgxs.EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + num_polar : Integral, optional + Number of equi-width polar angle bins for angle discretization; + defaults to one bin + num_azimuthal : Integral, optional + Number of equi-width azimuthal angle bins for angle discretization; + defaults to one bin + + Attributes + ---------- + correction : 'P0' or None + Apply the P0 correction to scattering matrices if set to 'P0'; this is + used only if :attr:`ConsistentScatterMatrixXS.scatter_format` is + 'legendre' + scatter_format : {'legendre', or 'histogram'} + Representation of the angular scattering distribution (default is + 'legendre') + legendre_order : int + The highest Legendre moment in the scattering matrix; this is used if + :attr:`ConsistentScatterMatrixXS.scatter_format` is 'legendre'. + (default is 0) + histogram_bins : int + The number of equally-spaced bins for the histogram representation of + the angular scattering distribution; this is used if + :attr:`ConsistentScatterMatrixXS.scatter_format` is 'histogram'. + (default is 16) + name : str, optional + Name of the multi-group cross section + rxn_type : str + Reaction type (e.g., 'total', 'nu-fission', etc.) + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + domain : Material or Cell or Universe or Mesh + Domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + Domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + Energy group structure for energy condensation + num_polar : Integral + Number of equi-width polar angle bins for angle discretization + num_azimuthal : Integral + Number of equi-width azimuthal angle bins for angle discretization + tally_trigger : openmc.Trigger + An (optional) tally precision trigger given to each tally used to + compute the cross section + scores : list of str + The scores in each tally used to compute the multi-group cross section + filters : list of openmc.Filter + The filters in each tally used to compute the multi-group cross section + tally_keys : list of str + The keys into the tallies dictionary for each tally used to compute + the multi-group cross section + 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 + are strings listed in the :attr:`ConsistentScatterMatrixXS.tally_keys` + property + and values are instances of :class:`openmc.Tally`. + rxn_rate_tally : openmc.Tally + Derived tally for the reaction rate tally used in the numerator to + compute the multi-group cross section. This attribute is None + unless the multi-group cross section has been computed. + xs_tally : openmc.Tally + Derived tally for the multi-group cross section. This attribute + is None unless the multi-group cross section has been computed. + num_subdomains : int + The number of subdomains is unity for 'material', 'cell' and 'universe' + domain types. This is equal to the number of cell instances + for 'distribcell' domain types (it is equal to unity prior to loading + tally data from a statepoint file). + num_nuclides : int + The number of nuclides for which the multi-group cross section is + being tracked. This is unity if the by_nuclide attribute is False. + nuclides : Iterable of str or 'sum' + The optional user-specified nuclides for which to compute cross + sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides + are not specified by the user, all nuclides in the spatial domain + are included. This attribute is 'sum' if by_nuclide is false. + sparse : bool + Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format + for compressed data storage + loaded_sp : bool + Whether or not a statepoint file has been loaded with tally data + derived : bool + Whether or not the MGXS is merged from one or more other MGXS + hdf5_key : str + The key used to index multi-group cross sections in an HDF5 data store + + """ def __init__(self, domain=None, domain_type=None, groups=None, by_nuclide=False, name='', num_polar=1, num_azimuthal=1): @@ -5619,8 +5854,140 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): + r"""A scattering-production matrix multi-group cross section computed as + the product of the scattering-production cross section and group-to-group + scattering-production probabilities. - # FIXME: Add docstring + This class is a variation of the :class:`NuScatterMatrixXS` which computes + the scattering-production matrix as the convolution product of + :class:`NuScatterXS` and :class:`NuScatterProbabilityMatrix`. Unlike the + :class:`NuScatterMatrixXS`, this scattering-production matrix is computed + from the scattering-production cross section which uses a tracklength + estimator. This ensures that reaction rate balance is exactly preserved + with a :class:`TotalXS` computed using a tracklength estimator. + + This class can be used for both OpenMC input generation and tally data + post-processing to compute spatially-homogenized and energy-integrated + multi-group cross sections for multi-group neutronics calculations. At a + minimum, one needs to set the + :attr:`ConsistentNuScatterMatrixXS.energy_groups` and + :attr:`ConsistentNuScatterMatrixXS.domain` properties. Tallies for the flux + and appropriate reaction rates over the specified domain are generated + automatically via the :attr:`ConsistentNuScatterMatrixXS.tallies` property, + which can then be appended to a :class:`openmc.Tallies` instance. + + For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the + necessary data to compute multi-group cross sections from a + :class:`openmc.StatePoint` instance. The derived multi-group cross section + can then be obtained from the :attr:`ConsistentNuScatterMatrixXS.xs_tally` + property. + + The calculation of the scattering-production matrix is the same as that for + :class:`ConsistentScatterMatrixXS` except that the scattering multiplicity + is accounted for. + + Parameters + ---------- + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + The domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + The domain type for spatial homogenization + groups : openmc.mgxs.EnergyGroups + The energy group structure for energy condensation + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + name : str, optional + Name of the multi-group cross section. Used as a label to identify + tallies in OpenMC 'tallies.xml' file. + num_polar : Integral, optional + Number of equi-width polar angle bins for angle discretization; + defaults to one bin + num_azimuthal : Integral, optional + Number of equi-width azimuthal angle bins for angle discretization; + defaults to one bin + + Attributes + ---------- + correction : 'P0' or None + Apply the P0 correction to scattering matrices if set to 'P0'; this is + used only if :attr:`ConsistentNuScatterMatrixXS.scatter_format` is + 'legendre' + scatter_format : {'legendre', or 'histogram'} + Representation of the angular scattering distribution (default is + 'legendre') + legendre_order : int + The highest Legendre moment in the scattering matrix; this is used if + :attr:`ConsistentScatterNuMatrixXS.scatter_format` is 'legendre'. + (default is 0) + histogram_bins : int + The number of equally-spaced bins for the histogram representation of + the angular scattering distribution; this is used if + :attr:`ConsistentScatterNuMatrixXS.scatter_format` is 'histogram'. + (default is 16) + name : str, optional + Name of the multi-group cross section + rxn_type : str + Reaction type (e.g., 'total', 'nu-fission', etc.) + by_nuclide : bool + If true, computes cross sections for each nuclide in domain + domain : Material or Cell or Universe or Mesh + Domain for spatial homogenization + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} + Domain type for spatial homogenization + energy_groups : openmc.mgxs.EnergyGroups + Energy group structure for energy condensation + num_polar : Integral + Number of equi-width polar angle bins for angle discretization + num_azimuthal : Integral + Number of equi-width azimuthal angle bins for angle discretization + tally_trigger : openmc.Trigger + An (optional) tally precision trigger given to each tally used to + compute the cross section + scores : list of str + The scores in each tally used to compute the multi-group cross section + filters : list of openmc.Filter + The filters in each tally used to compute the multi-group cross section + tally_keys : list of str + The keys into the tallies dictionary for each tally used to compute + the multi-group cross section + 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 + are strings listed in the :attr:`ConsistentScatterNuMatrixXS.tally_keys` + property + and values are instances of :class:`openmc.Tally`. + rxn_rate_tally : openmc.Tally + Derived tally for the reaction rate tally used in the numerator to + compute the multi-group cross section. This attribute is None + unless the multi-group cross section has been computed. + xs_tally : openmc.Tally + Derived tally for the multi-group cross section. This attribute + is None unless the multi-group cross section has been computed. + num_subdomains : int + The number of subdomains is unity for 'material', 'cell' and 'universe' + domain types. This is equal to the number of cell instances + for 'distribcell' domain types (it is equal to unity prior to loading + tally data from a statepoint file). + num_nuclides : int + The number of nuclides for which the multi-group cross section is + being tracked. This is unity if the by_nuclide attribute is False. + nuclides : Iterable of str or 'sum' + The optional user-specified nuclides for which to compute cross + sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides + are not specified by the user, all nuclides in the spatial domain + are included. This attribute is 'sum' if by_nuclide is false. + sparse : bool + Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format + for compressed data storage + loaded_sp : bool + Whether or not a statepoint file has been loaded with tally data + derived : bool + Whether or not the MGXS is merged from one or more other MGXS + hdf5_key : str + The key used to index multi-group cross sections in an HDF5 data store + + """ def __init__(self, domain=None, domain_type=None, groups=None, by_nuclide=False, name='', num_polar=1, num_azimuthal=1): @@ -5630,7 +5997,7 @@ class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): self._rxn_type = 'nu-scatter' self._hdf5_key = 'consistent nu-scatter matrix' - self._mgxs = [NuScatterXS(), ScatterProbabilityMatrix()] + self._mgxs = [NuScatterXS(), NuScatterProbabilityMatrix()] # Assign parameters to each MGXS in the convlution for mgxs in self.mgxs: From 0ace8c59aa124b12528a3169392d7466c60b5421 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 20 Feb 2017 11:42:46 -0500 Subject: [PATCH 14/40] Made consistent nu-scatter matrix use tracklength tallies with ScatterXS and MultiplicityMatrixXS --- openmc/mgxs/mgxs.py | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 078c8c878..2ebea1b63 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5803,7 +5803,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): @property def rxn_rate_tally(self): - raise NotImplementedError('The rxn rate tally is not well defined ') + raise NotImplementedError('The reaction rate tally is not well defined ') @property def xs_tally(self): @@ -5815,8 +5815,8 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # If using P0 correction subtract scatter-1 from the diagonal if self.correction == 'P0' and self.legendre_order == 0: - flux = self.tallies['{} : flux'.format(self.rxn_type)] - scatter_p0 = self.tallies['{0} : {0}'.format(self.rxn_type)] + flux = self.tallies['scatter : flux'] + scatter_p0 = self.tallies['scatter : scatter'] scatter_p1 = self.tallies['scatter-1'] energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) @@ -5997,7 +5997,7 @@ class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): self._rxn_type = 'nu-scatter' self._hdf5_key = 'consistent nu-scatter matrix' - self._mgxs = [NuScatterXS(), NuScatterProbabilityMatrix()] + self._mgxs = [ScatterXS(), NuScatterProbabilityMatrix(), MultiplicityMatrixXS()] # Assign parameters to each MGXS in the convlution for mgxs in self.mgxs: @@ -6013,6 +6013,39 @@ class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): mgxs.num_polar = num_polar mgxs.num_azimuthal = num_azimuthal + @property + def multiplicity_matrix(self): + return self.mgxs[2] + + @property + def xs_tally(self): + if self._xs_tally is None: + if self.tallies is None: + msg = 'Unable to get xs_tally since tallies have ' \ + 'not been loaded from a statepoint' + raise ValueError(msg) + + # If using P0 correction subtract scatter-1 from the diagonal + if self.correction == 'P0' and self.legendre_order == 0: + flux = self.tallies['scatter : flux'] + scatter_p0 = self.tallies['scatter : scatter'] + scatter_p1 = self.tallies['scatter-1'] + + energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) + energy_filter = copy.deepcopy(energy_filter) + scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) + correction = scatter_p1 / flux + else: + correction = 0. + + self._xs_tally = \ + self.scatter_xs.xs_tally * self.probability_matrix.xs_tally + self._xs_tally *= self.multiplicity_matrix.xs_tally + self._xs_tally -= correction + self._compute_xs() + + return self._xs_tally + class NuFissionMatrixXS(MatrixMGXS): r"""A fission production matrix multi-group cross section. From 6753e3a1409acd39aacef0915c21c6c8d197b4ce Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 20 Feb 2017 12:53:05 -0500 Subject: [PATCH 15/40] Update MGXS tests with consistent scattering matrices --- openmc/mgxs/library.py | 3 +- openmc/mgxs/mgxs.py | 15 +- .../inputs_true.dat | 1176 ++++++++++------- .../results_true.dat | 24 + .../inputs_true.dat | 162 ++- .../results_true.dat | 8 + tests/test_mgxs_library_hdf5/inputs_true.dat | 1176 ++++++++++------- tests/test_mgxs_library_hdf5/results_true.dat | 60 + tests/test_mgxs_library_mesh/inputs_true.dat | 162 ++- tests/test_mgxs_library_mesh/results_true.dat | 24 + .../inputs_true.dat | 1176 ++++++++++------- .../results_true.dat | 60 + .../inputs_true.dat | 892 ++++++++----- .../results_true.dat | 2 +- 14 files changed, 3188 insertions(+), 1752 deletions(-) diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index f5342e844..08d9d9147 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -526,7 +526,8 @@ class Library(object): mgxs.tally_trigger = self.tally_trigger # Specify whether to use a transport ('P0') correction - if isinstance(mgxs, openmc.mgxs.ScatterMatrixXS): + if isinstance(mgxs, openmc.mgxs.ScatterMatrixXS) and not \ + isinstance(mgxs, openmc.mgxs.ConsistentScatterMatrixXS): mgxs.correction = self.correction mgxs.scatter_format = self.scatter_format mgxs.legendre_order = self.legendre_order diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 2ebea1b63..792fedc5c 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3623,7 +3623,6 @@ class ScatterXS(MGXS): num_azimuthal) self._rxn_type = 'scatter' - class NuScatterXS(MGXS): r"""A scattering neutron production multi-group cross section. @@ -5845,10 +5844,9 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def get_subdomain_avg_xs(self, subdomains='all'): avg_xs = \ super(ConsistentScatterMatrixXS, self).get_subdomain_avg_xs(subdomains) - avg_xs._tallies = None for i, mgxs in enumerate(avg_xs._mgxs): - self._mgxs[i] = mgxs.get_subdomain_avg_xs(subdomains) + avg_xs._mgxs[i] = mgxs.get_subdomain_avg_xs(subdomains) return avg_xs @@ -5860,11 +5858,12 @@ class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): This class is a variation of the :class:`NuScatterMatrixXS` which computes the scattering-production matrix as the convolution product of - :class:`NuScatterXS` and :class:`NuScatterProbabilityMatrix`. Unlike the - :class:`NuScatterMatrixXS`, this scattering-production matrix is computed - from the scattering-production cross section which uses a tracklength - estimator. This ensures that reaction rate balance is exactly preserved - with a :class:`TotalXS` computed using a tracklength estimator. + :class:`ScatterXS`, :class:`NuScatterProbabilityMatrix` and + :class:`MultiplicityMatrixXS`. Unlike the :class:`NuScatterMatrixXS`, this + scattering-production matrix is computed from the scattering cross section + which uses a tracklength estimator. This ensures that reaction rate balance + is exactly preserved with a :class:`TotalXS` computed using a tracklength + estimator. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat index ad6526fc1..e56317dad 100644 --- a/tests/test_mgxs_library_condense/inputs_true.dat +++ b/tests/test_mgxs_library_condense/inputs_true.dat @@ -274,46 +274,49 @@ - + + total - nu-fission + scatter analog + total - nu-fission + scatter analog - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total - inverse-velocity + scatter tracklength + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + @@ -325,14 +328,15 @@ total - prompt-nu-fission + scatter tracklength + total - flux + scatter analog @@ -340,69 +344,64 @@ total - prompt-nu-fission + nu-scatter analog + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + total flux tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - total - decay-rate + inverse-velocity tracklength @@ -410,9 +409,100 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + @@ -421,254 +511,165 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - nu-scatter-1 - analog - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - total - fission + flux tracklength total - flux + total tracklength total - fission - tracklength + flux + analog total - flux - tracklength + total + analog - + total - nu-fission - tracklength + scatter-1 + analog total flux - tracklength + analog total - kappa-fission - tracklength + total + analog - + total - flux - tracklength + nu-scatter-1 + analog total - scatter + flux tracklength total - flux - analog + absorption + tracklength total - nu-scatter - analog + flux + tracklength total - flux - analog + absorption + tracklength - total - scatter-P3 - analog + fission + tracklength total flux - analog + tracklength - total - nu-scatter-P3 - analog + fission + tracklength - total - nu-scatter - analog + flux + tracklength - total - scatter - analog + nu-fission + tracklength total flux - analog + tracklength - total - nu-fission - analog + kappa-fission + tracklength - + total - nu-fission - analog + flux + tracklength - + total - nu-fission - analog + scatter + tracklength - + total - prompt-nu-fission + flux analog - + total - prompt-nu-fission + nu-scatter analog @@ -676,34 +677,37 @@ total flux - tracklength + analog + total - inverse-velocity - tracklength + scatter-P3 + analog total flux - tracklength + analog + total - prompt-nu-fission - tracklength + nu-scatter-P3 + analog + total - flux + nu-scatter analog @@ -711,7 +715,7 @@ total - prompt-nu-fission + scatter analog @@ -719,9 +723,185 @@ total flux - tracklength + analog + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + @@ -729,7 +909,7 @@ delayed-nu-fission tracklength - + @@ -737,7 +917,7 @@ delayed-nu-fission analog - + @@ -745,14 +925,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -760,7 +940,7 @@ delayed-nu-fission tracklength - + @@ -768,7 +948,7 @@ delayed-nu-fission tracklength - + @@ -776,14 +956,14 @@ decay-rate tracklength - + total flux analog - + @@ -792,211 +972,39 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - nu-scatter-1 - analog - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - fission - tracklength - - - - - total - flux - tracklength - - - - - total - fission - tracklength - - - - - total - flux - tracklength - - - - - total - nu-fission - tracklength - - - - - total - flux - tracklength - - - - - total - kappa-fission - tracklength - - - - - total - flux - tracklength - - - - - total - scatter - tracklength - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - total - flux - analog - - total - scatter-P3 - analog + flux + tracklength total - flux - analog + total + tracklength - total - nu-scatter-P3 + flux analog - total - nu-scatter + total analog - total - scatter + scatter-1 analog @@ -1009,51 +1017,50 @@ - total - nu-fission + total analog - + total - nu-fission + nu-scatter-1 analog - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + total - inverse-velocity + fission tracklength @@ -1067,7 +1074,7 @@ total - prompt-nu-fission + fission tracklength @@ -1075,15 +1082,14 @@ total flux - analog + tracklength - total - prompt-nu-fission - analog + nu-fission + tracklength @@ -1094,58 +1100,53 @@ - total - delayed-nu-fission + kappa-fission tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + scatter + tracklength total - nu-fission - tracklength + flux + analog - total - delayed-nu-fission - tracklength + nu-scatter + analog - total - delayed-nu-fission - tracklength + flux + analog - + total - decay-rate - tracklength + scatter-P3 + analog @@ -1155,6 +1156,275 @@ analog + + + + total + nu-scatter-P3 + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + analog + + + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat index 7ae1c8186..429caef14 100644 --- a/tests/test_mgxs_library_condense/results_true.dat +++ b/tests/test_mgxs_library_condense/results_true.dat @@ -32,6 +32,14 @@ 0 10000 1 1 total 1.0 0.066111 material group in group out nuclide mean std. dev. 0 10000 1 1 total 0.085835 0.005592 + material group in group out nuclide mean std. dev. +0 10000 1 1 total 1.0 0.066111 + material group in group out nuclide mean std. dev. +0 10000 1 1 total 1.0 0.066111 + material group in group out nuclide mean std. dev. +0 10000 1 1 total 0.341361 0.031842 + material group in group out nuclide mean std. dev. +0 10000 1 1 total 0.341361 0.040919 material group out nuclide mean std. dev. 0 10000 1 total 1.0 0.046071 material group out nuclide mean std. dev. @@ -111,6 +119,14 @@ 0 10001 1 1 total 1.0 0.095039 material group in group out nuclide mean std. dev. 0 10001 1 1 total 0.0 0.0 + material group in group out nuclide mean std. dev. +0 10001 1 1 total 1.0 0.095039 + material group in group out nuclide mean std. dev. +0 10001 1 1 total 1.0 0.095039 + material group in group out nuclide mean std. dev. +0 10001 1 1 total 0.276654 0.033287 + material group in group out nuclide mean std. dev. +0 10001 1 1 total 0.276654 0.044414 material group out nuclide mean std. dev. 0 10001 1 total 0.0 0.0 material group out nuclide mean std. dev. @@ -190,6 +206,14 @@ 0 10002 1 1 total 1.0 0.056867 material group in group out nuclide mean std. dev. 0 10002 1 1 total 0.0 0.0 + material group in group out nuclide mean std. dev. +0 10002 1 1 total 1.0 0.056867 + material group in group out nuclide mean std. dev. +0 10002 1 1 total 1.0 0.056867 + material group in group out nuclide mean std. dev. +0 10002 1 1 total 0.489924 0.069059 + material group in group out nuclide mean std. dev. +0 10002 1 1 total 0.489924 0.08592 material group out nuclide mean std. dev. 0 10002 1 total 0.0 0.0 material group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat index 9103a4b96..e8f917499 100644 --- a/tests/test_mgxs_library_distribcell/inputs_true.dat +++ b/tests/test_mgxs_library_distribcell/inputs_true.dat @@ -302,44 +302,47 @@ + total - nu-fission + scatter analog + total - nu-fission + scatter analog total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + scatter + tracklength + total - flux - tracklength + scatter + analog - + total - inverse-velocity - tracklength + scatter-1 + analog @@ -352,14 +355,15 @@ total - prompt-nu-fission + scatter tracklength + total - flux + scatter analog @@ -367,69 +371,64 @@ total - prompt-nu-fission + nu-scatter analog + total - flux - tracklength + scatter + analog - - + total - delayed-nu-fission - tracklength + nu-scatter-1 + analog - total - delayed-nu-fission + nu-fission analog - total - delayed-nu-fission + nu-fission analog total - nu-fission - tracklength + prompt-nu-fission + analog - - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength - total - decay-rate + inverse-velocity tracklength @@ -437,9 +436,100 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat index d6ed76bc5..8dfab8d3a 100644 --- a/tests/test_mgxs_library_distribcell/results_true.dat +++ b/tests/test_mgxs_library_distribcell/results_true.dat @@ -32,6 +32,14 @@ 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 1.000834 0.037242 sum(distribcell) 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 total 0.094516 0.0059 + sum(distribcell) 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 total 1.0 0.037213 + sum(distribcell) 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 total 1.0 0.037213 + sum(distribcell) 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 total 0.342636 0.017656 + sum(distribcell) 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 total 0.342954 0.022894 sum(distribcell) group out nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 1.0 0.080455 sum(distribcell) group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat index ad6526fc1..e56317dad 100644 --- a/tests/test_mgxs_library_hdf5/inputs_true.dat +++ b/tests/test_mgxs_library_hdf5/inputs_true.dat @@ -274,46 +274,49 @@ - + + total - nu-fission + scatter analog + total - nu-fission + scatter analog - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total - inverse-velocity + scatter tracklength + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + @@ -325,14 +328,15 @@ total - prompt-nu-fission + scatter tracklength + total - flux + scatter analog @@ -340,69 +344,64 @@ total - prompt-nu-fission + nu-scatter analog + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + total flux tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - total - decay-rate + inverse-velocity tracklength @@ -410,9 +409,100 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + @@ -421,254 +511,165 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - nu-scatter-1 - analog - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - total - fission + flux tracklength total - flux + total tracklength total - fission - tracklength + flux + analog total - flux - tracklength + total + analog - + total - nu-fission - tracklength + scatter-1 + analog total flux - tracklength + analog total - kappa-fission - tracklength + total + analog - + total - flux - tracklength + nu-scatter-1 + analog total - scatter + flux tracklength total - flux - analog + absorption + tracklength total - nu-scatter - analog + flux + tracklength total - flux - analog + absorption + tracklength - total - scatter-P3 - analog + fission + tracklength total flux - analog + tracklength - total - nu-scatter-P3 - analog + fission + tracklength - total - nu-scatter - analog + flux + tracklength - total - scatter - analog + nu-fission + tracklength total flux - analog + tracklength - total - nu-fission - analog + kappa-fission + tracklength - + total - nu-fission - analog + flux + tracklength - + total - nu-fission - analog + scatter + tracklength - + total - prompt-nu-fission + flux analog - + total - prompt-nu-fission + nu-scatter analog @@ -676,34 +677,37 @@ total flux - tracklength + analog + total - inverse-velocity - tracklength + scatter-P3 + analog total flux - tracklength + analog + total - prompt-nu-fission - tracklength + nu-scatter-P3 + analog + total - flux + nu-scatter analog @@ -711,7 +715,7 @@ total - prompt-nu-fission + scatter analog @@ -719,9 +723,185 @@ total flux - tracklength + analog + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + @@ -729,7 +909,7 @@ delayed-nu-fission tracklength - + @@ -737,7 +917,7 @@ delayed-nu-fission analog - + @@ -745,14 +925,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -760,7 +940,7 @@ delayed-nu-fission tracklength - + @@ -768,7 +948,7 @@ delayed-nu-fission tracklength - + @@ -776,14 +956,14 @@ decay-rate tracklength - + total flux analog - + @@ -792,211 +972,39 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - nu-scatter-1 - analog - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - fission - tracklength - - - - - total - flux - tracklength - - - - - total - fission - tracklength - - - - - total - flux - tracklength - - - - - total - nu-fission - tracklength - - - - - total - flux - tracklength - - - - - total - kappa-fission - tracklength - - - - - total - flux - tracklength - - - - - total - scatter - tracklength - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - total - flux - analog - - total - scatter-P3 - analog + flux + tracklength total - flux - analog + total + tracklength - total - nu-scatter-P3 + flux analog - total - nu-scatter + total analog - total - scatter + scatter-1 analog @@ -1009,51 +1017,50 @@ - total - nu-fission + total analog - + total - nu-fission + nu-scatter-1 analog - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + total - inverse-velocity + fission tracklength @@ -1067,7 +1074,7 @@ total - prompt-nu-fission + fission tracklength @@ -1075,15 +1082,14 @@ total flux - analog + tracklength - total - prompt-nu-fission - analog + nu-fission + tracklength @@ -1094,58 +1100,53 @@ - total - delayed-nu-fission + kappa-fission tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + scatter + tracklength total - nu-fission - tracklength + flux + analog - total - delayed-nu-fission - tracklength + nu-scatter + analog - total - delayed-nu-fission - tracklength + flux + analog - + total - decay-rate - tracklength + scatter-P3 + analog @@ -1155,6 +1156,275 @@ analog + + + + total + nu-scatter-P3 + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + analog + + + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat index c67c7c1f0..f5eb2b92e 100644 --- a/tests/test_mgxs_library_hdf5/results_true.dat +++ b/tests/test_mgxs_library_hdf5/results_true.dat @@ -60,6 +60,26 @@ domain=10000 type=nu-fission matrix [4.54366342e-01 0.00000000e+00]] [[3.14909051e-03 0.00000000e+00] [2.74255162e-02 0.00000000e+00]] +domain=10000 type=scatter probability matrix +[[9.97432606e-01 2.56739409e-03] + [2.24215247e-03 9.97757848e-01]] +[[7.82243018e-02 1.25560869e-03] + [2.24310192e-03 4.10531468e-02]] +domain=10000 type=nu-scatter probability matrix +[[9.97432606e-01 2.56739409e-03] + [2.24215247e-03 9.97757848e-01]] +[[7.82243018e-02 1.25560869e-03] + [2.24310192e-03 4.10531468e-02]] +domain=10000 type=consistent scatter matrix +[[3.32987194e-01 9.94653712e-04] + [8.87128136e-04 3.79756741e-01]] +[[3.73090623e-02 4.89318749e-04] + [8.89289900e-04 3.01139605e-02]] +domain=10000 type=consistent nu-scatter matrix +[[3.32987194e-01 9.94653712e-04] + [8.87128136e-04 3.79756741e-01]] +[[4.80886244e-02 8.40606499e-04] + [1.53780011e-03 3.42124888e-02]] domain=10000 type=chi [1.00000000e+00 0.00000000e+00] [4.60705493e-02 0.00000000e+00] @@ -226,6 +246,26 @@ domain=10001 type=nu-fission matrix [0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] +domain=10001 type=scatter probability matrix +[[1.00000000e+00 0.00000000e+00] + [0.00000000e+00 1.00000000e+00]] +[[1.08778697e-01 0.00000000e+00] + [0.00000000e+00 1.42427173e-01]] +domain=10001 type=nu-scatter probability matrix +[[1.00000000e+00 0.00000000e+00] + [0.00000000e+00 1.00000000e+00]] +[[1.08778697e-01 0.00000000e+00] + [0.00000000e+00 1.42427173e-01]] +domain=10001 type=consistent scatter matrix +[[2.70706971e-01 0.00000000e+00] + [0.00000000e+00 3.06542088e-01]] +[[3.82655052e-02 0.00000000e+00] + [0.00000000e+00 5.27278829e-02]] +domain=10001 type=consistent nu-scatter matrix +[[2.70706971e-01 0.00000000e+00] + [0.00000000e+00 3.06542088e-01]] +[[5.11595827e-02 0.00000000e+00] + [0.00000000e+00 6.74582654e-02]] domain=10001 type=chi [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] @@ -392,6 +432,26 @@ domain=10002 type=nu-fission matrix [0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] +domain=10002 type=scatter probability matrix +[[9.53271028e-01 4.67289720e-02] + [2.17817469e-04 9.99782183e-01]] +[[3.60184962e-02 2.54736726e-03] + [2.18820864e-04 1.35884974e-01]] +domain=10002 type=nu-scatter probability matrix +[[9.53271028e-01 4.67289720e-02] + [2.17817469e-04 9.99782183e-01]] +[[3.60184962e-02 2.54736726e-03] + [2.18820864e-04 1.35884974e-01]] +domain=10002 type=consistent scatter matrix +[[2.51505773e-01 3.10225138e-02] + [4.40143026e-04 1.47923453e+00]] +[[4.18067487e-02 2.23201039e-03] + [4.44773843e-04 3.55391574e-01]] +domain=10002 type=consistent nu-scatter matrix +[[2.51505773e-01 3.10225138e-02] + [4.40143026e-04 1.47923453e+00]] +[[4.84234821e-02 3.06407542e-03] + [7.65033031e-04 4.49126759e-01]] domain=10002 type=chi [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 421f4d8c7..6f6ecb7ac 100644 --- a/tests/test_mgxs_library_mesh/inputs_true.dat +++ b/tests/test_mgxs_library_mesh/inputs_true.dat @@ -539,44 +539,47 @@ + total - nu-fission + scatter analog + total - nu-fission + scatter analog total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + scatter + tracklength + total - flux - tracklength + scatter + analog - + total - inverse-velocity - tracklength + scatter-1 + analog @@ -589,14 +592,15 @@ total - prompt-nu-fission + scatter tracklength + total - flux + scatter analog @@ -604,69 +608,64 @@ total - prompt-nu-fission + nu-scatter analog + total - flux - tracklength + scatter + analog - - + total - delayed-nu-fission - tracklength + nu-scatter-1 + analog - total - delayed-nu-fission + nu-fission analog - total - delayed-nu-fission + nu-fission analog total - nu-fission - tracklength + prompt-nu-fission + analog - - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength - total - decay-rate + inverse-velocity tracklength @@ -674,9 +673,100 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat index b39a1ea8c..d04ab3d35 100644 --- a/tests/test_mgxs_library_mesh/results_true.dat +++ b/tests/test_mgxs_library_mesh/results_true.dat @@ -106,6 +106,30 @@ 1 1 2 1 1 1 total 0.017348 0.008786 2 2 1 1 1 1 total 0.020409 0.003354 3 2 2 1 1 1 total 0.011105 0.003806 + mesh 1 group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 total 1.0 0.153265 +1 1 2 1 1 1 total 1.0 0.454973 +2 2 1 1 1 1 total 1.0 0.146747 +3 2 2 1 1 1 total 1.0 0.141824 + mesh 1 group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 total 1.0 0.153265 +1 1 2 1 1 1 total 1.0 0.454973 +2 2 1 1 1 1 total 1.0 0.146747 +3 2 2 1 1 1 total 1.0 0.141824 + mesh 1 group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 total 0.385281 0.140163 +1 1 2 1 1 1 total 0.381031 0.407858 +2 2 1 1 1 1 total 0.429729 0.130705 +3 2 2 1 1 1 total 0.373069 0.127649 + mesh 1 group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 total 0.385281 0.170507 +1 1 2 1 1 1 total 0.381031 0.495567 +2 2 1 1 1 1 total 0.429729 0.164992 +3 2 2 1 1 1 total 0.373069 0.154944 mesh 1 group out nuclide mean std. dev. x y z 0 1 1 1 1 total 1.0 0.135958 diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat index ad6526fc1..e56317dad 100644 --- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat @@ -274,46 +274,49 @@ - + + total - nu-fission + scatter analog + total - nu-fission + scatter analog - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total - inverse-velocity + scatter tracklength + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + @@ -325,14 +328,15 @@ total - prompt-nu-fission + scatter tracklength + total - flux + scatter analog @@ -340,69 +344,64 @@ total - prompt-nu-fission + nu-scatter analog + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + total flux tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - total - decay-rate + inverse-velocity tracklength @@ -410,9 +409,100 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + @@ -421,254 +511,165 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - nu-scatter-1 - analog - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - total - fission + flux tracklength total - flux + total tracklength total - fission - tracklength + flux + analog total - flux - tracklength + total + analog - + total - nu-fission - tracklength + scatter-1 + analog total flux - tracklength + analog total - kappa-fission - tracklength + total + analog - + total - flux - tracklength + nu-scatter-1 + analog total - scatter + flux tracklength total - flux - analog + absorption + tracklength total - nu-scatter - analog + flux + tracklength total - flux - analog + absorption + tracklength - total - scatter-P3 - analog + fission + tracklength total flux - analog + tracklength - total - nu-scatter-P3 - analog + fission + tracklength - total - nu-scatter - analog + flux + tracklength - total - scatter - analog + nu-fission + tracklength total flux - analog + tracklength - total - nu-fission - analog + kappa-fission + tracklength - + total - nu-fission - analog + flux + tracklength - + total - nu-fission - analog + scatter + tracklength - + total - prompt-nu-fission + flux analog - + total - prompt-nu-fission + nu-scatter analog @@ -676,34 +677,37 @@ total flux - tracklength + analog + total - inverse-velocity - tracklength + scatter-P3 + analog total flux - tracklength + analog + total - prompt-nu-fission - tracklength + nu-scatter-P3 + analog + total - flux + nu-scatter analog @@ -711,7 +715,7 @@ total - prompt-nu-fission + scatter analog @@ -719,9 +723,185 @@ total flux - tracklength + analog + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + @@ -729,7 +909,7 @@ delayed-nu-fission tracklength - + @@ -737,7 +917,7 @@ delayed-nu-fission analog - + @@ -745,14 +925,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -760,7 +940,7 @@ delayed-nu-fission tracklength - + @@ -768,7 +948,7 @@ delayed-nu-fission tracklength - + @@ -776,14 +956,14 @@ decay-rate tracklength - + total flux analog - + @@ -792,211 +972,39 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - total - analog - - - - - total - nu-scatter-1 - analog - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - fission - tracklength - - - - - total - flux - tracklength - - - - - total - fission - tracklength - - - - - total - flux - tracklength - - - - - total - nu-fission - tracklength - - - - - total - flux - tracklength - - - - - total - kappa-fission - tracklength - - - - - total - flux - tracklength - - - - - total - scatter - tracklength - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - total - flux - analog - - total - scatter-P3 - analog + flux + tracklength total - flux - analog + total + tracklength - total - nu-scatter-P3 + flux analog - total - nu-scatter + total analog - total - scatter + scatter-1 analog @@ -1009,51 +1017,50 @@ - total - nu-fission + total analog - + total - nu-fission + nu-scatter-1 analog - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + total - inverse-velocity + fission tracklength @@ -1067,7 +1074,7 @@ total - prompt-nu-fission + fission tracklength @@ -1075,15 +1082,14 @@ total flux - analog + tracklength - total - prompt-nu-fission - analog + nu-fission + tracklength @@ -1094,58 +1100,53 @@ - total - delayed-nu-fission + kappa-fission tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + scatter + tracklength total - nu-fission - tracklength + flux + analog - total - delayed-nu-fission - tracklength + nu-scatter + analog - total - delayed-nu-fission - tracklength + flux + analog - + total - decay-rate - tracklength + scatter-P3 + analog @@ -1155,6 +1156,275 @@ analog + + + + total + nu-scatter-P3 + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + analog + + + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + total + scatter-1 + analog + + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + + + + + + total + scatter + analog + + + + + total + nu-scatter-1 + analog + + + + + total + nu-fission + analog + + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + + + + total + flux + analog + + diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat index 7ed890855..6158447d1 100644 --- a/tests/test_mgxs_library_no_nuclides/results_true.dat +++ b/tests/test_mgxs_library_no_nuclides/results_true.dat @@ -72,6 +72,26 @@ 2 10000 1 2 total 0.000000 0.000000 1 10000 2 1 total 0.454366 0.027426 0 10000 2 2 total 0.000000 0.000000 + material group in group out nuclide mean std. dev. +3 10000 1 1 total 0.997433 0.078224 +2 10000 1 2 total 0.002567 0.001256 +1 10000 2 1 total 0.002242 0.002243 +0 10000 2 2 total 0.997758 0.041053 + material group in group out nuclide mean std. dev. +3 10000 1 1 total 0.997433 0.078224 +2 10000 1 2 total 0.002567 0.001256 +1 10000 2 1 total 0.002242 0.002243 +0 10000 2 2 total 0.997758 0.041053 + material group in group out nuclide mean std. dev. +3 10000 1 1 total 0.332987 0.037309 +2 10000 1 2 total 0.000995 0.000489 +1 10000 2 1 total 0.000887 0.000889 +0 10000 2 2 total 0.379757 0.030114 + material group in group out nuclide mean std. dev. +3 10000 1 1 total 0.332987 0.048089 +2 10000 1 2 total 0.000995 0.000841 +1 10000 2 1 total 0.000887 0.001538 +0 10000 2 2 total 0.379757 0.034212 material group out nuclide mean std. dev. 1 10000 1 total 1.0 0.046071 0 10000 2 total 0.0 0.000000 @@ -240,6 +260,26 @@ 2 10001 1 2 total 0.0 0.0 1 10001 2 1 total 0.0 0.0 0 10001 2 2 total 0.0 0.0 + material group in group out nuclide mean std. dev. +3 10001 1 1 total 1.0 0.108779 +2 10001 1 2 total 0.0 0.000000 +1 10001 2 1 total 0.0 0.000000 +0 10001 2 2 total 1.0 0.142427 + material group in group out nuclide mean std. dev. +3 10001 1 1 total 1.0 0.108779 +2 10001 1 2 total 0.0 0.000000 +1 10001 2 1 total 0.0 0.000000 +0 10001 2 2 total 1.0 0.142427 + material group in group out nuclide mean std. dev. +3 10001 1 1 total 0.270707 0.038266 +2 10001 1 2 total 0.000000 0.000000 +1 10001 2 1 total 0.000000 0.000000 +0 10001 2 2 total 0.306542 0.052728 + material group in group out nuclide mean std. dev. +3 10001 1 1 total 0.270707 0.051160 +2 10001 1 2 total 0.000000 0.000000 +1 10001 2 1 total 0.000000 0.000000 +0 10001 2 2 total 0.306542 0.067458 material group out nuclide mean std. dev. 1 10001 1 total 0.0 0.0 0 10001 2 total 0.0 0.0 @@ -408,6 +448,26 @@ 2 10002 1 2 total 0.0 0.0 1 10002 2 1 total 0.0 0.0 0 10002 2 2 total 0.0 0.0 + material group in group out nuclide mean std. dev. +3 10002 1 1 total 0.953271 0.036018 +2 10002 1 2 total 0.046729 0.002547 +1 10002 2 1 total 0.000218 0.000219 +0 10002 2 2 total 0.999782 0.135885 + material group in group out nuclide mean std. dev. +3 10002 1 1 total 0.953271 0.036018 +2 10002 1 2 total 0.046729 0.002547 +1 10002 2 1 total 0.000218 0.000219 +0 10002 2 2 total 0.999782 0.135885 + material group in group out nuclide mean std. dev. +3 10002 1 1 total 0.251506 0.041807 +2 10002 1 2 total 0.031023 0.002232 +1 10002 2 1 total 0.000440 0.000445 +0 10002 2 2 total 1.479235 0.355392 + material group in group out nuclide mean std. dev. +3 10002 1 1 total 0.251506 0.048423 +2 10002 1 2 total 0.031023 0.003064 +1 10002 2 1 total 0.000440 0.000765 +0 10002 2 2 total 1.479235 0.449127 material group out nuclide mean std. dev. 1 10002 1 total 0.0 0.0 0 10002 2 total 0.0 0.0 diff --git a/tests/test_mgxs_library_nuclides/inputs_true.dat b/tests/test_mgxs_library_nuclides/inputs_true.dat index 74dfc7b2e..bc08b9115 100644 --- a/tests/test_mgxs_library_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_nuclides/inputs_true.dat @@ -274,46 +274,49 @@ - + + U234 U235 U238 O16 - nu-fission + scatter analog + U234 U235 U238 O16 - nu-fission + scatter analog - - - U234 U235 U238 O16 - prompt-nu-fission - analog - - - - - U234 U235 U238 O16 - prompt-nu-fission - analog - - total flux tracklength - + U234 U235 U238 O16 - inverse-velocity + scatter tracklength + + + + + U234 U235 U238 O16 + scatter + analog + + + + + U234 U235 U238 O16 + scatter-1 + analog + @@ -325,14 +328,15 @@ U234 U235 U238 O16 - prompt-nu-fission + scatter tracklength - total - flux + + U234 U235 U238 O16 + scatter analog @@ -340,257 +344,254 @@ U234 U235 U238 O16 - prompt-nu-fission + nu-scatter analog - + - total - flux - tracklength + + U234 U235 U238 O16 + scatter + analog - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - tracklength - - - - - total - flux - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - analog - - - + - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-1 - analog - - - - - total - flux - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 + U234 U235 U238 O16 nu-scatter-1 analog + + + + U234 U235 U238 O16 + nu-fission + analog + + + + + U234 U235 U238 O16 + nu-fission + analog + + + + + U234 U235 U238 O16 + prompt-nu-fission + analog + + + + + U234 U235 U238 O16 + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + U234 U235 U238 O16 + inverse-velocity + tracklength + - + total flux tracklength - + - Zr90 Zr91 Zr92 Zr94 Zr96 - absorption + U234 U235 U238 O16 + prompt-nu-fission tracklength - + total flux - tracklength + analog - + - Zr90 Zr91 Zr92 Zr94 Zr96 - absorption - tracklength + + U234 U235 U238 O16 + prompt-nu-fission + analog - Zr90 Zr91 Zr92 Zr94 Zr96 - fission + total + flux tracklength - total - flux + Zr90 Zr91 Zr92 Zr94 Zr96 + total tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - fission - tracklength + total + flux + analog - total - flux - tracklength + Zr90 Zr91 Zr92 Zr94 Zr96 + total + analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - tracklength + scatter-1 + analog total flux - tracklength + analog Zr90 Zr91 Zr92 Zr94 Zr96 - kappa-fission - tracklength + total + analog - - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter-1 + analog - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + total + flux tracklength - total - flux - analog + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption + tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter - analog + total + flux + tracklength - total - flux - analog + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption + tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 - analog + fission + tracklength total flux - analog + tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P3 - analog + fission + tracklength - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter - analog + total + flux + tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - analog + nu-fission + tracklength total flux - analog + tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog + kappa-fission + tracklength - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog + + total + flux + tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog + scatter + tracklength - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + + total + flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + nu-scatter analog @@ -598,34 +599,37 @@ total flux - tracklength + analog + Zr90 Zr91 Zr92 Zr94 Zr96 - inverse-velocity - tracklength + scatter-P3 + analog total flux - tracklength + analog + Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - tracklength + nu-scatter-P3 + analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter analog @@ -633,214 +637,218 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + scatter analog - + total flux - tracklength + analog - + - H1 O16 B10 B11 - total - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog - + - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter analog - + - H1 O16 B10 B11 - total + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter analog - - - H1 O16 B10 B11 - scatter-1 - analog - - - + total flux - analog + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + tracklength - + - H1 O16 B10 B11 - total + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter analog - + - H1 O16 B10 B11 - nu-scatter-1 + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-1 analog - + total flux tracklength - + - H1 O16 B10 B11 - absorption - tracklength - - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - absorption - tracklength - - - - - H1 O16 B10 B11 - fission - tracklength - - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - fission - tracklength - - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - nu-fission - tracklength - - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - kappa-fission - tracklength - - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength - - + + - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter analog - - + + - H1 O16 B10 B11 + + Zr90 Zr91 Zr92 Zr94 Zr96 nu-scatter analog - - + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter-1 + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog + + + total flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission analog - - H1 O16 B10 B11 - scatter-P3 - analog + total + flux + tracklength + + + H1 O16 B10 B11 + total + tracklength + + total flux analog - - - - - H1 O16 B10 B11 - nu-scatter-P3 - analog - - H1 O16 B10 B11 - nu-scatter + total analog - H1 O16 B10 B11 - scatter + scatter-1 analog @@ -853,51 +861,50 @@ - H1 O16 B10 B11 - nu-fission + total analog - + H1 O16 B10 B11 - nu-fission + nu-scatter-1 analog - - - H1 O16 B10 B11 - nu-fission - analog - - - - - H1 O16 B10 B11 - prompt-nu-fission - analog - - - - - H1 O16 B10 B11 - prompt-nu-fission - analog - - total flux tracklength + + + + H1 O16 B10 B11 + absorption + tracklength + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + absorption + tracklength + H1 O16 B10 B11 - inverse-velocity + fission tracklength @@ -911,7 +918,7 @@ H1 O16 B10 B11 - prompt-nu-fission + fission tracklength @@ -919,9 +926,272 @@ total flux - analog + tracklength + + + H1 O16 B10 B11 + nu-fission + tracklength + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + kappa-fission + tracklength + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + scatter + tracklength + + + + + total + flux + analog + + + + + H1 O16 B10 B11 + nu-scatter + analog + + + + + total + flux + analog + + + + + + H1 O16 B10 B11 + scatter-P3 + analog + + + + + total + flux + analog + + + + + + H1 O16 B10 B11 + nu-scatter-P3 + analog + + + + + + H1 O16 B10 B11 + nu-scatter + analog + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + total + flux + analog + + + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + scatter + tracklength + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + H1 O16 B10 B11 + scatter-1 + analog + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + scatter + tracklength + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + + H1 O16 B10 B11 + nu-scatter + analog + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + H1 O16 B10 B11 + nu-scatter-1 + analog + + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + H1 O16 B10 B11 + prompt-nu-fission + analog + + + + + H1 O16 B10 B11 + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + diff --git a/tests/test_mgxs_library_nuclides/results_true.dat b/tests/test_mgxs_library_nuclides/results_true.dat index 595394ad2..3fa814577 100644 --- a/tests/test_mgxs_library_nuclides/results_true.dat +++ b/tests/test_mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -b91cd851e23046bed070866f56e03cb95d92025dbaf4d7e12dad553fc391cd812c2c6cb7584e9a10af113d728631dd10a079717418eefd57b676b847c3261c80 \ No newline at end of file +830113ee8be5f5a9941a2e1b97d8fc0049dbde0a7860c2ebf3aadfa4811ca58663fefbfea5f01e8793b1bfe52ac060b3631cafd959203d158d20af94ed318743 \ No newline at end of file From 0ac66b94bb2517ee6cb04f5a3a182d0e2d26d8e7 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 28 Feb 2017 07:33:45 -0500 Subject: [PATCH 16/40] More consolidation of consistent scattering matrices per updates made by @nelsonag --- openmc/mgxs/library.py | 3 +- openmc/mgxs/mgxs.py | 366 +++++++++++------------------------------ 2 files changed, 100 insertions(+), 269 deletions(-) diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index c0f8488a7..627fb2508 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -512,8 +512,7 @@ class Library(object): mgxs.tally_trigger = self.tally_trigger # Specify whether to use a transport ('P0') correction - if isinstance(mgxs, openmc.mgxs.ScatterMatrixXS) and not \ - isinstance(mgxs, openmc.mgxs.ConsistentScatterMatrixXS): + if isinstance(mgxs, openmc.mgxs.ScatterMatrixXS): mgxs.correction = self.correction mgxs.scatter_format = self.scatter_format mgxs.legendre_order = self.legendre_order diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index d4cb40b3d..93fc462b7 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -732,11 +732,13 @@ class MGXS(object): elif mgxs_type == 'scatter probability matrix': mgxs = ScatterProbabilityMatrix(domain, domain_type, energy_groups) elif mgxs_type == 'nu-scatter probability matrix': - mgxs = NuScatterProbabilityMatrix(domain, domain_type, energy_groups) + mgxs = ScatterProbabilityMatrix( + domain, domain_type, energy_groups, nu=False) elif mgxs_type == 'consistent scatter matrix': mgxs = ConsistentScatterMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'consistent nu-scatter matrix': - mgxs = ConsistentNuScatterMatrixXS(domain, domain_type, energy_groups) + mgxs = ConsistentScatterMatrixXS( + domain, domain_type, energy_groups, nu=False) elif mgxs_type == 'nu-fission matrix': mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'chi': @@ -2710,10 +2712,6 @@ class TransportXS(MGXS): super(TransportXS, self).__init__(domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - if not nu: - self._rxn_type = 'transport' - else: - self._rxn_type = 'nu-transport' self._estimator = 'analog' self._valid_estimators = ['analog'] self.nu = nu @@ -2769,6 +2767,10 @@ class TransportXS(MGXS): def nu(self, nu): cv.check_type('nu', nu, bool) self._nu = nu + if not nu: + self._rxn_type = 'transport' + else: + self._rxn_type = 'nu-transport' class AbsorptionXS(MGXS): @@ -3175,15 +3177,9 @@ class FissionXS(MGXS): super(FissionXS, self).__init__(domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - if not prompt: - if not nu: - self._rxn_type = 'fission' - else: - self._rxn_type = 'nu-fission' - self.nu = nu - else: - self._rxn_type = 'prompt-nu-fission' - self.nu = True + self._nu = False + self._prompt = False + self.nu = nu self.prompt = prompt def __deepcopy__(self, memo): @@ -3204,11 +3200,25 @@ class FissionXS(MGXS): def nu(self, nu): cv.check_type('nu', nu, bool) self._nu = nu + if not self.prompt: + if not self.nu: + self._rxn_type = 'fission' + else: + self._rxn_type = 'nu-fission' + else: + self._rxn_type = 'prompt-nu-fission' @prompt.setter def prompt(self, prompt): cv.check_type('prompt', prompt, bool) self._prompt = prompt + if not self.prompt: + if not self.nu: + self._rxn_type = 'fission' + else: + self._rxn_type = 'nu-fission' + else: + self._rxn_type = 'prompt-nu-fission' class KappaFissionXS(MGXS): @@ -3462,19 +3472,12 @@ class ScatterXS(MGXS): """ - def __init__(self, domain=None, domain_type=None, groups=None, nu=False, - by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, + num_azimuthal=1, nu=False): super(ScatterXS, self).__init__(domain, domain_type, - groups, by_nuclide, name, num_polar, - num_azimuthal) - if not nu: - self._rxn_type = 'scatter' - else: - self._rxn_type = 'nu-scatter' - # Only analog estimators are valid so change from the defaults - # to reflect this - self._estimator = 'analog' - self._valid_estimators = ['analog'] + groups, by_nuclide, name, + num_polar, num_azimuthal) self.nu = nu def __deepcopy__(self, memo): @@ -3490,7 +3493,12 @@ class ScatterXS(MGXS): def nu(self, nu): cv.check_type('nu', nu, bool) self._nu = nu - + if not nu: + self._rxn_type = 'scatter' + else: + self._rxn_type = 'nu-scatter' + self._estimator = 'analog' + self._valid_estimators = ['analog'] class ScatterMatrixXS(MatrixMGXS): r"""A scattering matrix multi-group cross section with the cosine of the @@ -3641,17 +3649,12 @@ class ScatterMatrixXS(MatrixMGXS): """ - def __init__(self, domain=None, domain_type=None, groups=None, nu=False, - by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, + num_azimuthal=1, nu=False): super(ScatterMatrixXS, self).__init__(domain, domain_type, groups, by_nuclide, name, - num_azimuthal) - if not nu: - self._rxn_type = 'scatter' - self._hdf5_key = 'scatter matrix' - else: - self._rxn_type = 'nu-scatter' - self._hdf5_key = 'nu-scatter matrix' + num_polar, num_azimuthal) self._correction = 'P0' self._scatter_format = 'legendre' self._legendre_order = 0 @@ -3769,6 +3772,12 @@ class ScatterMatrixXS(MatrixMGXS): def nu(self, nu): cv.check_type('nu', nu, bool) self._nu = nu + if not nu: + self._rxn_type = 'scatter' + self._hdf5_key = 'scatter matrix' + else: + self._rxn_type = 'nu-scatter' + self._hdf5_key = 'nu-scatter matrix' @correction.setter def correction(self, correction): @@ -4680,13 +4689,6 @@ class ScatterProbabilityMatrix(MatrixMGXS): domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - if not nu: - self._rxn_type = 'scatter' - self._hdf5_key = 'scatter probability matrix' - else: - self._rxn_type = 'nu-scatter' - self._hdf5_key = 'nu-scatter probability matrix' - self._estimator = 'analog' self._valid_estimators = ['analog'] self.nu = nu @@ -4742,6 +4744,12 @@ class ScatterProbabilityMatrix(MatrixMGXS): def nu(self, nu): cv.check_type('nu', nu, bool) self._nu = nu + if not nu: + self._rxn_type = 'scatter' + self._hdf5_key = 'scatter probability matrix' + else: + self._rxn_type = 'nu-scatter' + self._hdf5_key = 'nu-scatter probability matrix' @add_metaclass(ABCMeta) @@ -5047,11 +5055,14 @@ class ConvolvedMGXS(MGXS): # NOTE: This is necessary for micro cross-sections which require # the isotopic number densities as computed by OpenMC if self.domain_type == 'cell' or self.domain_type == 'distribcell': - self.domain = statepoint.summary.get_cell_by_id(self.domain.id) + all_cells = statepoint.summary.geometry.get_all_cells() + self.domain = all_cells[self.domain.id] elif self.domain_type == 'universe': - self.domain = statepoint.summary.get_universe_by_id(self.domain.id) + all_univs = statepoint.summary.get_all_universes() + self.domain = all_univs[self.domain.id] elif self.domain_type == 'material': - self.domain = statepoint.summary.get_material_by_id(self.domain.id) + all_mats = statepoint.summary.get_all_materials() + self.domain = all_mats[self.domain.id] elif self.domain_type == 'mesh': self.domain = statepoint.meshes[self.domain.id] else: @@ -5244,19 +5255,20 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): """ - def __init__(self, domain=None, domain_type=None, groups=None, nu=False, - by_nuclide=False, name='', num_polar=1, num_azimuthal=1): + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, + num_azimuthal=1, nu=False): super(ConsistentScatterMatrixXS, self).__init__( - domain, domain_type, groups, nu, by_nuclide, - name, num_polar, num_azimuthal) + domain, domain_type, groups, by_nuclide=by_nuclide, + name=name, num_polar=num_polar, num_azimuthal=num_azimuthal) - if not nu: - self._hdf5_key = 'consistent scatter matrix' - else: - self._hdf5_key = 'consistent nu-scatter matrix' + self._rxn_type = 'h' + self._rxn_type + self.nu = nu # Initialize each MGXS used by the convolution - self._mgxs = [ScatterXS(), ScatterProbabilityMatrix()] + self._mgxs = \ + [ScatterXS(), ScatterProbabilityMatrix(), MultiplicityMatrixXS()] # Assign parameters to each MGXS in the convlution for mgxs in self.mgxs: @@ -5272,9 +5284,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): mgxs.energy_groups = groups mgxs.num_polar = num_polar mgxs.num_azimuthal = num_azimuthal - - # FIXME: Implement nu setter to propagate to nu to convolution MGXS - + @property def scores(self): scores = super(ConsistentScatterMatrixXS, self).scores @@ -5303,10 +5313,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # Add key for transport correction tally if self.correction == 'P0' and self.legendre_order == 0: - if self.nu: - tally_keys += ['nu-scatter-1'] - else: - tally_keys += ['scatter-1'] + tally_keys += ['{}-1'.format(self.rxn_type)] return tally_keys @@ -5318,10 +5325,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # Add in the transport correction tally if self.correction == 'P0' and self.legendre_order == 0: - if self.nu: - tally_key = 'nu-scatter-1' - else: - tally_key = 'scatter-1' + tally_key = '{}-1'.format(self.rxn_type) # Create a domain Filter object filter_type = _DOMAIN_TO_FILTER[self.domain_type] @@ -5344,9 +5348,9 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # If this is a by-nuclide cross-section, add nuclides to Tally if self.by_nuclide: - self._tallies['scatter-1'].nuclides += self.get_nuclides() + self._tallies[tally_key].nuclides += self.get_nuclides() else: - self._tallies['scatter-1'].nuclides.append('total') + self._tallies[tally_key].nuclides.append('total') return self._tallies @@ -5358,6 +5362,10 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): def probability_matrix(self): return self.mgxs[1] + @property + def multiplicity_matrix(self): + return self.mgxs[2] + @property def rxn_rate_tally(self): raise NotImplementedError('The reaction rate tally is not well defined ') @@ -5372,9 +5380,9 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): # If using P0 correction subtract scatter-1 from the diagonal if self.correction == 'P0' and self.legendre_order == 0: - flux = self.tallies['scatter : flux'] - scatter_p0 = self.tallies['scatter : scatter'] - scatter_p1 = self.tallies['scatter-1'] + flux = self.tallies['{} : flux'.format(self.rxn_type)] + scatter_p0 = self.tallies['{0} : {0}'.format(self.rxn_type)] + scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) energy_filter = copy.deepcopy(energy_filter) @@ -5385,11 +5393,30 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): self._xs_tally = \ self.scatter_xs.xs_tally * self.probability_matrix.xs_tally + + if self.nu: + self._xs_tally *= self.multiplicity_matrix.xs_tally + self._xs_tally -= correction self._compute_xs() return self._xs_tally + @ScatterMatrixXS.nu.setter + def nu(self, nu): + cv.check_type('nu', nu, bool) + self._nu = nu + + if not nu: + self._rxn_type = 'scatter' + self._hdf5_key = 'consistent scatter matrix' + else: + self._rxn_type = 'nu-scatter' + self._hdf5_key = 'consistent nu-scatter matrix' + + for mgxs in self.mgxs: + mgxs.nu = nu + def get_condensed_xs(self, coarse_groups): condense_xs = \ super(ConsistentScatterMatrixXS, self).get_condensed_xs(coarse_groups) @@ -5409,201 +5436,6 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): return avg_xs -class ConsistentNuScatterMatrixXS(ConsistentScatterMatrixXS): - r"""A scattering-production matrix multi-group cross section computed as - the product of the scattering-production cross section and group-to-group - scattering-production probabilities. - - This class is a variation of the :class:`NuScatterMatrixXS` which computes - the scattering-production matrix as the convolution product of - :class:`ScatterXS`, :class:`NuScatterProbabilityMatrix` and - :class:`MultiplicityMatrixXS`. Unlike the :class:`NuScatterMatrixXS`, this - scattering-production matrix is computed from the scattering cross section - which uses a tracklength estimator. This ensures that reaction rate balance - is exactly preserved with a :class:`TotalXS` computed using a tracklength - estimator. - - This class can be used for both OpenMC input generation and tally data - post-processing to compute spatially-homogenized and energy-integrated - multi-group cross sections for multi-group neutronics calculations. At a - minimum, one needs to set the - :attr:`ConsistentNuScatterMatrixXS.energy_groups` and - :attr:`ConsistentNuScatterMatrixXS.domain` properties. Tallies for the flux - and appropriate reaction rates over the specified domain are generated - automatically via the :attr:`ConsistentNuScatterMatrixXS.tallies` property, - which can then be appended to a :class:`openmc.Tallies` instance. - - For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the - necessary data to compute multi-group cross sections from a - :class:`openmc.StatePoint` instance. The derived multi-group cross section - can then be obtained from the :attr:`ConsistentNuScatterMatrixXS.xs_tally` - property. - - The calculation of the scattering-production matrix is the same as that for - :class:`ConsistentScatterMatrixXS` except that the scattering multiplicity - is accounted for. - - Parameters - ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh - The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - The domain type for spatial homogenization - groups : openmc.mgxs.EnergyGroups - The energy group structure for energy condensation - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - name : str, optional - Name of the multi-group cross section. Used as a label to identify - tallies in OpenMC 'tallies.xml' file. - num_polar : Integral, optional - Number of equi-width polar angle bins for angle discretization; - defaults to one bin - num_azimuthal : Integral, optional - Number of equi-width azimuthal angle bins for angle discretization; - defaults to one bin - - Attributes - ---------- - correction : 'P0' or None - Apply the P0 correction to scattering matrices if set to 'P0'; this is - used only if :attr:`ConsistentNuScatterMatrixXS.scatter_format` is - 'legendre' - scatter_format : {'legendre', or 'histogram'} - Representation of the angular scattering distribution (default is - 'legendre') - legendre_order : int - The highest Legendre moment in the scattering matrix; this is used if - :attr:`ConsistentScatterNuMatrixXS.scatter_format` is 'legendre'. - (default is 0) - histogram_bins : int - The number of equally-spaced bins for the histogram representation of - the angular scattering distribution; this is used if - :attr:`ConsistentScatterNuMatrixXS.scatter_format` is 'histogram'. - (default is 16) - name : str, optional - Name of the multi-group cross section - rxn_type : str - Reaction type (e.g., 'total', 'nu-fission', etc.) - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - domain : Material or Cell or Universe or Mesh - Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - Domain type for spatial homogenization - energy_groups : openmc.mgxs.EnergyGroups - Energy group structure for energy condensation - num_polar : Integral - Number of equi-width polar angle bins for angle discretization - num_azimuthal : Integral - Number of equi-width azimuthal angle bins for angle discretization - tally_trigger : openmc.Trigger - An (optional) tally precision trigger given to each tally used to - compute the cross section - scores : list of str - The scores in each tally used to compute the multi-group cross section - filters : list of openmc.Filter - The filters in each tally used to compute the multi-group cross section - tally_keys : list of str - The keys into the tallies dictionary for each tally used to compute - the multi-group cross section - 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 - are strings listed in the :attr:`ConsistentScatterNuMatrixXS.tally_keys` - property - and values are instances of :class:`openmc.Tally`. - rxn_rate_tally : openmc.Tally - Derived tally for the reaction rate tally used in the numerator to - compute the multi-group cross section. This attribute is None - unless the multi-group cross section has been computed. - xs_tally : openmc.Tally - Derived tally for the multi-group cross section. This attribute - is None unless the multi-group cross section has been computed. - num_subdomains : int - The number of subdomains is unity for 'material', 'cell' and 'universe' - domain types. This is equal to the number of cell instances - for 'distribcell' domain types (it is equal to unity prior to loading - tally data from a statepoint file). - num_nuclides : int - The number of nuclides for which the multi-group cross section is - being tracked. This is unity if the by_nuclide attribute is False. - nuclides : Iterable of str or 'sum' - The optional user-specified nuclides for which to compute cross - sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides - are not specified by the user, all nuclides in the spatial domain - are included. This attribute is 'sum' if by_nuclide is false. - sparse : bool - Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format - for compressed data storage - loaded_sp : bool - Whether or not a statepoint file has been loaded with tally data - derived : bool - Whether or not the MGXS is merged from one or more other MGXS - hdf5_key : str - The key used to index multi-group cross sections in an HDF5 data store - - """ - - def __init__(self, domain=None, domain_type=None, groups=None, - by_nuclide=False, name='', num_polar=1, num_azimuthal=1): - super(ConsistentNuScatterMatrixXS, self).__init__( - domain, domain_type, groups, by_nuclide, - name, num_polar, num_azimuthal) - - self._rxn_type = 'nu-scatter' - self._hdf5_key = 'consistent nu-scatter matrix' - self._mgxs = [ScatterXS(), NuScatterProbabilityMatrix(), MultiplicityMatrixXS()] - - # Assign parameters to each MGXS in the convlution - for mgxs in self.mgxs: - mgxs.name = name - mgxs.by_nuclide = by_nuclide - - if domain_type is not None: - mgxs.domain_type = domain_type - if domain is not None: - mgxs.domain = domain - if groups is not None: - mgxs.energy_groups = groups - mgxs.num_polar = num_polar - mgxs.num_azimuthal = num_azimuthal - - @property - def multiplicity_matrix(self): - return self.mgxs[2] - - @property - def xs_tally(self): - if self._xs_tally is None: - if self.tallies is None: - msg = 'Unable to get xs_tally since tallies have ' \ - 'not been loaded from a statepoint' - raise ValueError(msg) - - # If using P0 correction subtract scatter-1 from the diagonal - if self.correction == 'P0' and self.legendre_order == 0: - flux = self.tallies['scatter : flux'] - scatter_p0 = self.tallies['scatter : scatter'] - scatter_p1 = self.tallies['scatter-1'] - - energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) - energy_filter = copy.deepcopy(energy_filter) - scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) - correction = scatter_p1 / flux - else: - correction = 0. - - self._xs_tally = \ - self.scatter_xs.xs_tally * self.probability_matrix.xs_tally - self._xs_tally *= self.multiplicity_matrix.xs_tally - self._xs_tally -= correction - self._compute_xs() - - return self._xs_tally - - class NuFissionMatrixXS(MatrixMGXS): r"""A fission production matrix multi-group cross section. From e2f60119a0e7d46295fd92e030b5558cc078f74f Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 28 Feb 2017 11:07:10 -0500 Subject: [PATCH 17/40] Fixed a few docstrings in openmc.mgxs --- docs/source/pythonapi/index.rst | 8 ---- openmc/mgxs/mgxs.py | 69 ++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/docs/source/pythonapi/index.rst b/docs/source/pythonapi/index.rst index 313c7a0f0..4ec2cdbba 100644 --- a/docs/source/pythonapi/index.rst +++ b/docs/source/pythonapi/index.rst @@ -127,7 +127,6 @@ respectively. openmc.get_hexagonal_prism openmc.get_rectangular_prism ->>>>>>> upstream/develop Constructing Tallies -------------------- @@ -288,20 +287,13 @@ Multi-group Cross Sections openmc.mgxs.CaptureXS openmc.mgxs.Chi openmc.mgxs.ChiPrompt - openmc.mgxs.ConsistentNuScatterMatrixXS openmc.mgxs.ConsistentScatterMatrixXS openmc.mgxs.ConvolvedMGXS openmc.mgxs.FissionXS openmc.mgxs.InverseVelocity openmc.mgxs.KappaFissionXS openmc.mgxs.MultiplicityMatrixXS - openmc.mgxs.NuFissionXS openmc.mgxs.NuFissionMatrixXS - openmc.mgxs.NuScatterXS - openmc.mgxs.NuScatterMatrixXS - openmc.mgxs.NuScatterProbabilityMatrix - openmc.mgxs.PromptNuFissionXS - openmc.mgxs.PromptNuFissionMatrixXS openmc.mgxs.ScatterXS openmc.mgxs.ScatterMatrixXS openmc.mgxs.ScatterProbabilityMatrix diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 93fc462b7..b0e383bc0 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -125,7 +125,7 @@ class MGXS(object): post-processing to compute spatially-homogenized and energy-integrated multi-group cross sections for multi-group neutronics calculations. - NOTE: Users should instantiate the subclasses of this abstract class. + .. note:: Users should instantiate the subclasses of this abstract class. Parameters ---------- @@ -894,7 +894,7 @@ class MGXS(object): This method is needed to compute cross section data from tallies in an OpenMC StatePoint object. - NOTE: The statepoint must first be linked with an OpenMC Summary object. + .. note:: The statepoint must be linked with an OpenMC Summary object. Parameters ---------- @@ -1642,7 +1642,7 @@ class MGXS(object): nuclides and cross section type. Two datasets for the mean and standard deviation are stored for each subdomain entry in the HDF5 file. - NOTE: This requires the h5py Python package. + .. note:: This requires the h5py Python package. Parameters ---------- @@ -1988,7 +1988,7 @@ class MatrixMGXS(MGXS): post-processing to compute spatially-homogenized and energy-integrated multi-group cross sections for multi-group neutronics calculations. - NOTE: Users should instantiate the subclasses of this abstract class. + .. note:: Users should instantiate the subclasses of this abstract class. Parameters ---------- @@ -3389,9 +3389,6 @@ class ScatterXS(MGXS): The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation - nu : bool - If True, the cross section data will include neutron multiplication; - defaults to False by_nuclide : bool If true, computes cross sections for each nuclide in domain name : str, optional @@ -3403,6 +3400,9 @@ class ScatterXS(MGXS): num_azimuthal : Integral, optional Number of equi-width azimuthal angle bins for angle discretization; defaults to one bin + nu : bool + If True, the cross section data will include neutron multiplication; + defaults to False Attributes ---------- @@ -3553,9 +3553,6 @@ class ScatterMatrixXS(MatrixMGXS): The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation - nu : bool - If True, the cross section data will include neutron multiplication; - defaults to False by_nuclide : bool If true, computes cross sections for each nuclide in domain name : str, optional @@ -3567,6 +3564,9 @@ class ScatterMatrixXS(MatrixMGXS): num_azimuthal : Integral, optional Number of equi-width azimuthal angle bins for angle discretization; defaults to one bin + nu : bool + If True, the cross section data will include neutron multiplication; + defaults to False Attributes ---------- @@ -3837,7 +3837,7 @@ class ScatterMatrixXS(MatrixMGXS): This method is needed to compute cross section data from tallies in an OpenMC StatePoint object. - NOTE: The statepoint must first be linked with an OpenMC Summary object. + .. note:: The statepoint must be linked with an OpenMC Summary object. Parameters ---------- @@ -3959,9 +3959,9 @@ class ScatterMatrixXS(MatrixMGXS): (3rd dimension), nuclides (4th dimension), and moments/histograms (5th dimension). - NOTE: The scattering moments are not multiplied by the :math:`(2l+1)/2` - prefactor in the expansion of the scattering source into Legendre - moments in the neutron transport equation. + .. note:: The scattering moments are not multiplied by the + :math:`(2l+1)/2` prefactor in the expansion of the scattering source + into Legendre moments in the neutron transport equation. Parameters ---------- @@ -4599,9 +4599,6 @@ class ScatterProbabilityMatrix(MatrixMGXS): The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation - nu : bool - If True, the cross section data will include neutron multiplication; - defaults to False by_nuclide : bool If true, computes cross sections for each nuclide in domain name : str, optional @@ -4613,6 +4610,9 @@ class ScatterProbabilityMatrix(MatrixMGXS): num_azimuthal : Integral, optional Number of equi-width azimuthal angle bins for angle discretization; defaults to one bin + nu : bool + If True, the cross section data will include neutron multiplication; + defaults to False Attributes ---------- @@ -4693,7 +4693,10 @@ class ScatterProbabilityMatrix(MatrixMGXS): self._valid_estimators = ['analog'] self.nu = nu - # FIXME: Add __deepcopy__ + def __deepcopy__(self, memo): + clone = super(ScatterProbabilityMatrixXS, self).__deepcopy__(memo) + clone._nu = self.nu + return clone @property def nu(self): @@ -4761,7 +4764,7 @@ class ConvolvedMGXS(MGXS): post-processing to compute spatially-homogenized and energy-integrated multi-group cross sections for multi-group neutronics calculations. - NOTE: Users should instantiate the subclasses of this abstract class. + .. note:: Users should instantiate the subclasses of this abstract class. Parameters ---------- @@ -5029,7 +5032,7 @@ class ConvolvedMGXS(MGXS): This method is needed to compute cross section data from tallies in an OpenMC StatePoint object. - NOTE: The statepoint must first be linked with an OpenMC Summary object. + .. note:: The statepoint must be linked with an OpenMC Summary object. Parameters ---------- @@ -5171,6 +5174,9 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): num_azimuthal : Integral, optional Number of equi-width azimuthal angle bins for angle discretization; defaults to one bin + nu : bool + If True, the cross section data will include neutron multiplication; + defaults to False Attributes ---------- @@ -5194,6 +5200,8 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): Name of the multi-group cross section rxn_type : str Reaction type (e.g., 'total', 'nu-fission', etc.) + nu : bool + If True, the cross section data will include neutron multiplication by_nuclide : bool If true, computes cross sections for each nuclide in domain domain : Material or Cell or Universe or Mesh @@ -5262,8 +5270,6 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): domain, domain_type, groups, by_nuclide=by_nuclide, name=name, num_polar=num_polar, num_azimuthal=num_azimuthal) - self._rxn_type = 'h' - self._rxn_type self.nu = nu # Initialize each MGXS used by the convolution @@ -5284,7 +5290,7 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): mgxs.energy_groups = groups mgxs.num_polar = num_polar mgxs.num_azimuthal = num_azimuthal - + @property def scores(self): scores = super(ConsistentScatterMatrixXS, self).scores @@ -5486,6 +5492,9 @@ class NuFissionMatrixXS(MatrixMGXS): num_azimuthal : Integral, optional Number of equi-width azimuthal angle bins for angle discretization; defaults to one bin + prompt : bool + If true, computes cross sections which only includes prompt neutrons; + defaults to False which includes prompt and delayed in total Attributes ---------- @@ -5493,6 +5502,8 @@ class NuFissionMatrixXS(MatrixMGXS): Name of the multi-group cross section rxn_type : str Reaction type (e.g., 'total', 'nu-fission', etc.) + prompt : bool + If true, computes cross sections which only includes prompt neutrons by_nuclide : bool If true, computes cross sections for each nuclide in domain domain : Material or Cell or Universe or Mesh @@ -5553,9 +5564,9 @@ class NuFissionMatrixXS(MatrixMGXS): """ - def __init__(self, domain=None, domain_type=None, - groups=None, by_nuclide=False, name='', num_polar=1, - num_azimuthal=1): + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, + num_azimuthal=1, prompt=False): super(NuFissionMatrixXS, self).__init__(domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) @@ -5792,6 +5803,12 @@ class Chi(MGXS): def prompt(self, prompt): cv.check_type('prompt', prompt, bool) self._prompt = prompt + if not self.prompt: + self._rxn_type = 'nu-fission' + self._hdf5_key = 'nu-fission matrix' + else: + self._rxn_type = 'prompt-nu-fission' + self._hdf5_key = 'prompt-nu-fission matrix' def get_homogenized_mgxs(self, other_mgxs): """Construct a homogenized mgxs with other MGXS objects. From a1f4ffe44dd53e32ec5f9c55cf5cf43209191887 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 28 Feb 2017 11:46:22 -0500 Subject: [PATCH 18/40] Updated test suite for conslidated consistent scattering matrices --- openmc/mgxs/mgxs.py | 42 +- .../inputs_true.dat | 654 ++++++++++-------- .../results_true.dat | 8 +- .../inputs_true.dat | 122 ++-- .../results_true.dat | 4 +- tests/test_mgxs_library_hdf5/inputs_true.dat | 654 ++++++++++-------- tests/test_mgxs_library_hdf5/results_true.dat | 24 +- .../test_mgxs_library_hdf5.py | 2 +- tests/test_mgxs_library_mesh/inputs_true.dat | 122 ++-- tests/test_mgxs_library_mesh/results_true.dat | 8 +- .../inputs_true.dat | 654 ++++++++++-------- .../results_true.dat | 20 +- .../inputs_true.dat | 558 ++++++++------- .../results_true.dat | 2 +- 14 files changed, 1558 insertions(+), 1316 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index b0e383bc0..2e7b7afda 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -733,12 +733,12 @@ class MGXS(object): mgxs = ScatterProbabilityMatrix(domain, domain_type, energy_groups) elif mgxs_type == 'nu-scatter probability matrix': mgxs = ScatterProbabilityMatrix( - domain, domain_type, energy_groups, nu=False) + domain, domain_type, energy_groups, nu=True) elif mgxs_type == 'consistent scatter matrix': mgxs = ConsistentScatterMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'consistent nu-scatter matrix': mgxs = ConsistentScatterMatrixXS( - domain, domain_type, energy_groups, nu=False) + domain, domain_type, energy_groups, nu=True) elif mgxs_type == 'nu-fission matrix': mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'chi': @@ -4694,7 +4694,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): self.nu = nu def __deepcopy__(self, memo): - clone = super(ScatterProbabilityMatrixXS, self).__deepcopy__(memo) + clone = super(ScatterProbabilityMatrix, self).__deepcopy__(memo) clone._nu = self.nu return clone @@ -5057,15 +5057,13 @@ class ConvolvedMGXS(MGXS): # Override the domain object that loaded from an OpenMC summary file # NOTE: This is necessary for micro cross-sections which require # the isotopic number densities as computed by OpenMC - if self.domain_type == 'cell' or self.domain_type == 'distribcell': - all_cells = statepoint.summary.geometry.get_all_cells() - self.domain = all_cells[self.domain.id] + geom = statepoint.summary.geometry + if self.domain_type in ('cell', 'distribcell'): + self.domain = geom.get_all_cells()[self.domain.id] elif self.domain_type == 'universe': - all_univs = statepoint.summary.get_all_universes() - self.domain = all_univs[self.domain.id] + self.domain = geom.get_all_universes()[self.domain.id] elif self.domain_type == 'material': - all_mats = statepoint.summary.get_all_materials() - self.domain = all_mats[self.domain.id] + self.domain = geom.get_all_materials()[self.domain.id] elif self.domain_type == 'mesh': self.domain = statepoint.meshes[self.domain.id] else: @@ -5408,6 +5406,26 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): return self._xs_tally + @ScatterMatrixXS.correction.setter + def correction(self, correction): + ScatterMatrixXS.correction = correction + self.mgxs[2].correction = correction + + @ScatterMatrixXS.scatter_format.setter + def scatter_format(self, scatter_format): + ScatterMatrixXS.scatter_format = scatter_format + self.mgxs[1].scatter_format = scatter_format + + @ScatterMatrixXS.legendre_order.setter + def legendre_order(self, legendre_order): + ScatterMatrixXS.legendre_order = legendre_order + self.mgxs[1].legendre_order = legendre_order + + @ScatterMatrixXS.histogram_bins.setter + def histogram_bins(self, histogram_bins): + ScatterMatrixXS.histogram_bins = histogram_bins + self.mgxs[1].histogram_bins = histogram_bins + @ScatterMatrixXS.nu.setter def nu(self, nu): cv.check_type('nu', nu, bool) @@ -5805,10 +5823,10 @@ class Chi(MGXS): self._prompt = prompt if not self.prompt: self._rxn_type = 'nu-fission' - self._hdf5_key = 'nu-fission matrix' + self._hdf5_key = 'chi' else: self._rxn_type = 'prompt-nu-fission' - self._hdf5_key = 'prompt-nu-fission matrix' + self._hdf5_key = 'chi-prompt' def get_homogenized_mgxs(self, other_mgxs): """Construct a homogenized mgxs with other MGXS objects. diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat index e56317dad..518663028 100644 --- a/tests/test_mgxs_library_condense/inputs_true.dat +++ b/tests/test_mgxs_library_condense/inputs_true.dat @@ -285,7 +285,7 @@ total - scatter + nu-scatter analog @@ -312,26 +312,13 @@ + total - scatter-1 + nu-scatter analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - @@ -339,10 +326,23 @@ scatter analog + + + + total + scatter-1 + analog + + + + + total + flux + analog + - total nu-scatter analog @@ -352,57 +352,59 @@ total - scatter + nu-scatter analog + total - nu-scatter-1 + nu-scatter analog - + + total - nu-fission + scatter analog total - nu-fission + nu-scatter-1 analog total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog - + total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -415,7 +417,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -423,9 +425,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -433,14 +449,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -448,7 +464,7 @@ delayed-nu-fission tracklength - + @@ -456,7 +472,7 @@ delayed-nu-fission analog - + @@ -464,45 +480,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + @@ -511,75 +527,61 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - total flux - analog + tracklength total total - analog + tracklength - + total - scatter-1 + flux analog total - flux + total analog - + total - total + scatter-1 analog - + total - nu-scatter-1 + flux analog total - flux - tracklength + total + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -599,14 +601,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -627,7 +629,7 @@ total - nu-fission + fission tracklength @@ -641,7 +643,7 @@ total - kappa-fission + nu-fission tracklength @@ -655,7 +657,7 @@ total - scatter + kappa-fission tracklength @@ -663,14 +665,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -682,9 +684,8 @@ - total - scatter-P3 + nu-scatter analog @@ -699,15 +700,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -715,14 +715,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -730,15 +731,14 @@ total - nu-fission + scatter analog - total - scatter + flux analog @@ -746,52 +746,55 @@ total - scatter + nu-fission analog + total - flux - tracklength + scatter + analog + total - scatter - tracklength + nu-scatter + analog - - - - total - scatter - analog - - - - - total - scatter-1 - analog - - total flux tracklength - + total scatter tracklength + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + @@ -801,6 +804,27 @@ analog + + + total + scatter-1 + analog + + + + + total + flux + analog + + + + + total + nu-scatter + analog + + @@ -808,7 +832,15 @@ nu-scatter analog - + + + + + total + nu-scatter + analog + + @@ -816,83 +848,54 @@ scatter analog - + total nu-scatter-1 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - + total - flux - tracklength + nu-fission + analog - + total - inverse-velocity - tracklength + nu-fission + analog - + total - flux - tracklength + prompt-nu-fission + analog - + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength - total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -903,33 +906,31 @@ - total - delayed-nu-fission + prompt-nu-fission tracklength - - + total - delayed-nu-fission + flux analog - + total - delayed-nu-fission + prompt-nu-fission analog total - nu-fission + flux tracklength @@ -941,6 +942,29 @@ tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + @@ -948,7 +972,15 @@ delayed-nu-fission tracklength - + + + + + total + delayed-nu-fission + tracklength + + @@ -956,14 +988,14 @@ decay-rate tracklength - + total flux analog - + @@ -972,123 +1004,95 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + + total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - total - fission + flux tracklength total - flux + absorption tracklength total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + fission tracklength @@ -1102,7 +1106,7 @@ total - kappa-fission + fission tracklength @@ -1116,7 +1120,7 @@ total - scatter + nu-fission tracklength @@ -1124,29 +1128,28 @@ total flux - analog + tracklength total - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + scatter + tracklength @@ -1158,17 +1161,15 @@ - total - nu-scatter-P3 + nu-scatter analog - total - nu-scatter + flux analog @@ -1176,7 +1177,7 @@ total - scatter + scatter-P3 analog @@ -1191,7 +1192,7 @@ total - nu-fission + nu-scatter-P3 analog @@ -1199,7 +1200,7 @@ total - scatter + nu-scatter analog @@ -1215,14 +1216,15 @@ total flux - tracklength + analog + total - scatter - tracklength + nu-fission + analog @@ -1234,9 +1236,10 @@ + total - scatter-1 + nu-scatter analog @@ -1281,75 +1284,77 @@ total - nu-scatter-1 + scatter-1 analog - + total - nu-fission + flux analog - + total - nu-fission + nu-scatter analog - + + total - prompt-nu-fission + nu-scatter analog + total - prompt-nu-fission + nu-scatter analog + total - flux - tracklength + scatter + analog - + total - inverse-velocity - tracklength + nu-scatter-1 + analog - + total - flux - tracklength + nu-fission + analog - + total - prompt-nu-fission - tracklength + nu-fission + analog - + total - flux + prompt-nu-fission analog - total prompt-nu-fission @@ -1364,49 +1369,45 @@ - total - delayed-nu-fission + inverse-velocity tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + prompt-nu-fission + tracklength total - nu-fission - tracklength + flux + analog - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength @@ -1414,17 +1415,64 @@ total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat index 429caef14..06edc733c 100644 --- a/tests/test_mgxs_library_condense/results_true.dat +++ b/tests/test_mgxs_library_condense/results_true.dat @@ -39,7 +39,7 @@ material group in group out nuclide mean std. dev. 0 10000 1 1 total 0.341361 0.031842 material group in group out nuclide mean std. dev. -0 10000 1 1 total 0.341361 0.040919 +0 10000 1 1 total 0.343079 0.043498 material group out nuclide mean std. dev. 0 10000 1 total 1.0 0.046071 material group out nuclide mean std. dev. @@ -125,8 +125,8 @@ 0 10001 1 1 total 1.0 0.095039 material group in group out nuclide mean std. dev. 0 10001 1 1 total 0.276654 0.033287 - material group in group out nuclide mean std. dev. -0 10001 1 1 total 0.276654 0.044414 + material group in group out nuclide mean std. dev. +0 10001 1 1 total 0.27737 0.051266 material group out nuclide mean std. dev. 0 10001 1 total 0.0 0.0 material group out nuclide mean std. dev. @@ -213,7 +213,7 @@ material group in group out nuclide mean std. dev. 0 10002 1 1 total 0.489924 0.069059 material group in group out nuclide mean std. dev. -0 10002 1 1 total 0.489924 0.08592 +0 10002 1 1 total 0.492997 0.086399 material group out nuclide mean std. dev. 0 10002 1 total 0.0 0.0 material group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat index e8f917499..5a64f7af1 100644 --- a/tests/test_mgxs_library_distribcell/inputs_true.dat +++ b/tests/test_mgxs_library_distribcell/inputs_true.dat @@ -312,7 +312,7 @@ total - scatter + nu-scatter analog @@ -339,26 +339,13 @@ + total - scatter-1 + nu-scatter analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - @@ -366,10 +353,23 @@ scatter analog + + + + total + scatter-1 + analog + + + + + total + flux + analog + - total nu-scatter analog @@ -379,57 +379,59 @@ total - scatter + nu-scatter analog + total - nu-scatter-1 + nu-scatter analog + total - nu-fission + scatter analog total - nu-fission + nu-scatter-1 analog total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -442,7 +444,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -450,9 +452,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -460,14 +476,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -475,7 +491,7 @@ delayed-nu-fission tracklength - + @@ -483,7 +499,7 @@ delayed-nu-fission analog - + @@ -491,45 +507,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat index 8dfab8d3a..14893f083 100644 --- a/tests/test_mgxs_library_distribcell/results_true.dat +++ b/tests/test_mgxs_library_distribcell/results_true.dat @@ -35,11 +35,11 @@ sum(distribcell) 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 total 1.0 0.037213 sum(distribcell) 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 total 1.0 0.037213 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 1.0 0.037208 sum(distribcell) 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 total 0.342636 0.017656 sum(distribcell) 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 total 0.342954 0.022894 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 0.340468 0.025369 sum(distribcell) group out nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 1.0 0.080455 sum(distribcell) group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat index e56317dad..518663028 100644 --- a/tests/test_mgxs_library_hdf5/inputs_true.dat +++ b/tests/test_mgxs_library_hdf5/inputs_true.dat @@ -285,7 +285,7 @@ total - scatter + nu-scatter analog @@ -312,26 +312,13 @@ + total - scatter-1 + nu-scatter analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - @@ -339,10 +326,23 @@ scatter analog + + + + total + scatter-1 + analog + + + + + total + flux + analog + - total nu-scatter analog @@ -352,57 +352,59 @@ total - scatter + nu-scatter analog + total - nu-scatter-1 + nu-scatter analog - + + total - nu-fission + scatter analog total - nu-fission + nu-scatter-1 analog total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog - + total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -415,7 +417,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -423,9 +425,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -433,14 +449,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -448,7 +464,7 @@ delayed-nu-fission tracklength - + @@ -456,7 +472,7 @@ delayed-nu-fission analog - + @@ -464,45 +480,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + @@ -511,75 +527,61 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - total flux - analog + tracklength total total - analog + tracklength - + total - scatter-1 + flux analog total - flux + total analog - + total - total + scatter-1 analog - + total - nu-scatter-1 + flux analog total - flux - tracklength + total + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -599,14 +601,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -627,7 +629,7 @@ total - nu-fission + fission tracklength @@ -641,7 +643,7 @@ total - kappa-fission + nu-fission tracklength @@ -655,7 +657,7 @@ total - scatter + kappa-fission tracklength @@ -663,14 +665,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -682,9 +684,8 @@ - total - scatter-P3 + nu-scatter analog @@ -699,15 +700,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -715,14 +715,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -730,15 +731,14 @@ total - nu-fission + scatter analog - total - scatter + flux analog @@ -746,52 +746,55 @@ total - scatter + nu-fission analog + total - flux - tracklength + scatter + analog + total - scatter - tracklength + nu-scatter + analog - - - - total - scatter - analog - - - - - total - scatter-1 - analog - - total flux tracklength - + total scatter tracklength + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + @@ -801,6 +804,27 @@ analog + + + total + scatter-1 + analog + + + + + total + flux + analog + + + + + total + nu-scatter + analog + + @@ -808,7 +832,15 @@ nu-scatter analog - + + + + + total + nu-scatter + analog + + @@ -816,83 +848,54 @@ scatter analog - + total nu-scatter-1 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - + total - flux - tracklength + nu-fission + analog - + total - inverse-velocity - tracklength + nu-fission + analog - + total - flux - tracklength + prompt-nu-fission + analog - + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength - total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -903,33 +906,31 @@ - total - delayed-nu-fission + prompt-nu-fission tracklength - - + total - delayed-nu-fission + flux analog - + total - delayed-nu-fission + prompt-nu-fission analog total - nu-fission + flux tracklength @@ -941,6 +942,29 @@ tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + @@ -948,7 +972,15 @@ delayed-nu-fission tracklength - + + + + + total + delayed-nu-fission + tracklength + + @@ -956,14 +988,14 @@ decay-rate tracklength - + total flux analog - + @@ -972,123 +1004,95 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + + total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - total - fission + flux tracklength total - flux + absorption tracklength total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + fission tracklength @@ -1102,7 +1106,7 @@ total - kappa-fission + fission tracklength @@ -1116,7 +1120,7 @@ total - scatter + nu-fission tracklength @@ -1124,29 +1128,28 @@ total flux - analog + tracklength total - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + scatter + tracklength @@ -1158,17 +1161,15 @@ - total - nu-scatter-P3 + nu-scatter analog - total - nu-scatter + flux analog @@ -1176,7 +1177,7 @@ total - scatter + scatter-P3 analog @@ -1191,7 +1192,7 @@ total - nu-fission + nu-scatter-P3 analog @@ -1199,7 +1200,7 @@ total - scatter + nu-scatter analog @@ -1215,14 +1216,15 @@ total flux - tracklength + analog + total - scatter - tracklength + nu-fission + analog @@ -1234,9 +1236,10 @@ + total - scatter-1 + nu-scatter analog @@ -1281,75 +1284,77 @@ total - nu-scatter-1 + scatter-1 analog - + total - nu-fission + flux analog - + total - nu-fission + nu-scatter analog - + + total - prompt-nu-fission + nu-scatter analog + total - prompt-nu-fission + nu-scatter analog + total - flux - tracklength + scatter + analog - + total - inverse-velocity - tracklength + nu-scatter-1 + analog - + total - flux - tracklength + nu-fission + analog - + total - prompt-nu-fission - tracklength + nu-fission + analog - + total - flux + prompt-nu-fission analog - total prompt-nu-fission @@ -1364,49 +1369,45 @@ - total - delayed-nu-fission + inverse-velocity tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + prompt-nu-fission + tracklength total - nu-fission - tracklength + flux + analog - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength @@ -1414,17 +1415,64 @@ total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat index f5eb2b92e..4a8578b6d 100644 --- a/tests/test_mgxs_library_hdf5/results_true.dat +++ b/tests/test_mgxs_library_hdf5/results_true.dat @@ -76,10 +76,10 @@ domain=10000 type=consistent scatter matrix [[3.73090623e-02 4.89318749e-04] [8.89289900e-04 3.01139605e-02]] domain=10000 type=consistent nu-scatter matrix -[[3.32987194e-01 9.94653712e-04] - [8.87128136e-04 3.79756741e-01]] -[[4.80886244e-02 8.40606499e-04] - [1.53780011e-03 3.42124888e-02]] +[[3.32465997e-01 9.88930322e-04] + [9.24639842e-04 3.96145576e-01]] +[[5.08819059e-02 8.36973463e-04] + [1.60212263e-03 2.87181296e-02]] domain=10000 type=chi [1.00000000e+00 0.00000000e+00] [4.60705493e-02 0.00000000e+00] @@ -262,10 +262,10 @@ domain=10001 type=consistent scatter matrix [[3.82655052e-02 0.00000000e+00] [0.00000000e+00 5.27278829e-02]] domain=10001 type=consistent nu-scatter matrix -[[2.70706971e-01 0.00000000e+00] - [0.00000000e+00 3.06542088e-01]] -[[5.11595827e-02 0.00000000e+00] - [0.00000000e+00 6.74582654e-02]] +[[2.71891125e-01 0.00000000e+00] + [0.00000000e+00 3.07477884e-01]] +[[5.90732661e-02 0.00000000e+00] + [0.00000000e+00 7.57666234e-02]] domain=10001 type=chi [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] @@ -448,10 +448,10 @@ domain=10002 type=consistent scatter matrix [[4.18067487e-02 2.23201039e-03] [4.44773843e-04 3.55391574e-01]] domain=10002 type=consistent nu-scatter matrix -[[2.51505773e-01 3.10225138e-02] - [4.40143026e-04 1.47923453e+00]] -[[4.84234821e-02 3.06407542e-03] - [7.65033031e-04 4.49126759e-01]] +[[2.58651993e-01 3.13677176e-02] + [4.43343102e-04 1.48230049e+00]] +[[4.56422796e-02 2.98774961e-03] + [7.71125112e-04 4.71762821e-01]] domain=10002 type=chi [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] diff --git a/tests/test_mgxs_library_hdf5/test_mgxs_library_hdf5.py b/tests/test_mgxs_library_hdf5/test_mgxs_library_hdf5.py index 9197f549c..3c657981b 100644 --- a/tests/test_mgxs_library_hdf5/test_mgxs_library_hdf5.py +++ b/tests/test_mgxs_library_hdf5/test_mgxs_library_hdf5.py @@ -59,7 +59,7 @@ class MGXSTestHarness(PyAPITestHarness): # Export the MGXS Library to an HDF5 file self.mgxs_lib.build_hdf5_store(directory='.') - + # Open the MGXS HDF5 file f = h5py.File('mgxs.h5', 'r') diff --git a/tests/test_mgxs_library_mesh/inputs_true.dat b/tests/test_mgxs_library_mesh/inputs_true.dat index 6f6ecb7ac..3f719e7b0 100644 --- a/tests/test_mgxs_library_mesh/inputs_true.dat +++ b/tests/test_mgxs_library_mesh/inputs_true.dat @@ -549,7 +549,7 @@ total - scatter + nu-scatter analog @@ -576,26 +576,13 @@ + total - scatter-1 + nu-scatter analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - @@ -603,10 +590,23 @@ scatter analog + + + + total + scatter-1 + analog + + + + + total + flux + analog + - total nu-scatter analog @@ -616,57 +616,59 @@ total - scatter + nu-scatter analog + total - nu-scatter-1 + nu-scatter analog + total - nu-fission + scatter analog total - nu-fission + nu-scatter-1 analog total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -679,7 +681,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -687,9 +689,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -697,14 +713,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -712,7 +728,7 @@ delayed-nu-fission tracklength - + @@ -720,7 +736,7 @@ delayed-nu-fission analog - + @@ -728,45 +744,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat index d04ab3d35..23a1fce0f 100644 --- a/tests/test_mgxs_library_mesh/results_true.dat +++ b/tests/test_mgxs_library_mesh/results_true.dat @@ -126,10 +126,10 @@ 3 2 2 1 1 1 total 0.373069 0.127649 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.385281 0.170507 -1 1 2 1 1 1 total 0.381031 0.495567 -2 2 1 1 1 1 total 0.429729 0.164992 -3 2 2 1 1 1 total 0.373069 0.154944 +0 1 1 1 1 1 total 0.391249 0.172830 +1 1 2 1 1 1 total 0.366825 0.473935 +2 2 1 1 1 1 total 0.436538 0.175458 +3 2 2 1 1 1 total 0.380998 0.149007 mesh 1 group out nuclide mean std. dev. x y z 0 1 1 1 1 total 1.0 0.135958 diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat index e56317dad..518663028 100644 --- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat @@ -285,7 +285,7 @@ total - scatter + nu-scatter analog @@ -312,26 +312,13 @@ + total - scatter-1 + nu-scatter analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - @@ -339,10 +326,23 @@ scatter analog + + + + total + scatter-1 + analog + + + + + total + flux + analog + - total nu-scatter analog @@ -352,57 +352,59 @@ total - scatter + nu-scatter analog + total - nu-scatter-1 + nu-scatter analog - + + total - nu-fission + scatter analog total - nu-fission + nu-scatter-1 analog total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog - + total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -415,7 +417,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -423,9 +425,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -433,14 +449,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -448,7 +464,7 @@ delayed-nu-fission tracklength - + @@ -456,7 +472,7 @@ delayed-nu-fission analog - + @@ -464,45 +480,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + @@ -511,75 +527,61 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - total flux - analog + tracklength total total - analog + tracklength - + total - scatter-1 + flux analog total - flux + total analog - + total - total + scatter-1 analog - + total - nu-scatter-1 + flux analog total - flux - tracklength + total + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -599,14 +601,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -627,7 +629,7 @@ total - nu-fission + fission tracklength @@ -641,7 +643,7 @@ total - kappa-fission + nu-fission tracklength @@ -655,7 +657,7 @@ total - scatter + kappa-fission tracklength @@ -663,14 +665,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -682,9 +684,8 @@ - total - scatter-P3 + nu-scatter analog @@ -699,15 +700,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -715,14 +715,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -730,15 +731,14 @@ total - nu-fission + scatter analog - total - scatter + flux analog @@ -746,52 +746,55 @@ total - scatter + nu-fission analog + total - flux - tracklength + scatter + analog + total - scatter - tracklength + nu-scatter + analog - - - - total - scatter - analog - - - - - total - scatter-1 - analog - - total flux tracklength - + total scatter tracklength + + + + + total + scatter + analog + + + + + + total + nu-scatter + analog + @@ -801,6 +804,27 @@ analog + + + total + scatter-1 + analog + + + + + total + flux + analog + + + + + total + nu-scatter + analog + + @@ -808,7 +832,15 @@ nu-scatter analog - + + + + + total + nu-scatter + analog + + @@ -816,83 +848,54 @@ scatter analog - + total nu-scatter-1 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - + total - flux - tracklength + nu-fission + analog - + total - inverse-velocity - tracklength + nu-fission + analog - + total - flux - tracklength + prompt-nu-fission + analog - + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength - total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -903,33 +906,31 @@ - total - delayed-nu-fission + prompt-nu-fission tracklength - - + total - delayed-nu-fission + flux analog - + total - delayed-nu-fission + prompt-nu-fission analog total - nu-fission + flux tracklength @@ -941,6 +942,29 @@ tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + @@ -948,7 +972,15 @@ delayed-nu-fission tracklength - + + + + + total + delayed-nu-fission + tracklength + + @@ -956,14 +988,14 @@ decay-rate tracklength - + total flux analog - + @@ -972,123 +1004,95 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + + total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - - - - total - flux - tracklength - - - - - total - absorption - tracklength - - - - - total - flux - tracklength - - - - - total - absorption - tracklength - total - fission + flux tracklength total - flux + absorption tracklength total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + fission tracklength @@ -1102,7 +1106,7 @@ total - kappa-fission + fission tracklength @@ -1116,7 +1120,7 @@ total - scatter + nu-fission tracklength @@ -1124,29 +1128,28 @@ total flux - analog + tracklength total - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + scatter + tracklength @@ -1158,17 +1161,15 @@ - total - nu-scatter-P3 + nu-scatter analog - total - nu-scatter + flux analog @@ -1176,7 +1177,7 @@ total - scatter + scatter-P3 analog @@ -1191,7 +1192,7 @@ total - nu-fission + nu-scatter-P3 analog @@ -1199,7 +1200,7 @@ total - scatter + nu-scatter analog @@ -1215,14 +1216,15 @@ total flux - tracklength + analog + total - scatter - tracklength + nu-fission + analog @@ -1234,9 +1236,10 @@ + total - scatter-1 + nu-scatter analog @@ -1281,75 +1284,77 @@ total - nu-scatter-1 + scatter-1 analog - + total - nu-fission + flux analog - + total - nu-fission + nu-scatter analog - + + total - prompt-nu-fission + nu-scatter analog + total - prompt-nu-fission + nu-scatter analog + total - flux - tracklength + scatter + analog - + total - inverse-velocity - tracklength + nu-scatter-1 + analog - + total - flux - tracklength + nu-fission + analog - + total - prompt-nu-fission - tracklength + nu-fission + analog - + total - flux + prompt-nu-fission analog - total prompt-nu-fission @@ -1364,49 +1369,45 @@ - total - delayed-nu-fission + inverse-velocity tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + prompt-nu-fission + tracklength total - nu-fission - tracklength + flux + analog - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength @@ -1414,17 +1415,64 @@ total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat index 6158447d1..430fb6a33 100644 --- a/tests/test_mgxs_library_no_nuclides/results_true.dat +++ b/tests/test_mgxs_library_no_nuclides/results_true.dat @@ -88,10 +88,10 @@ 1 10000 2 1 total 0.000887 0.000889 0 10000 2 2 total 0.379757 0.030114 material group in group out nuclide mean std. dev. -3 10000 1 1 total 0.332987 0.048089 -2 10000 1 2 total 0.000995 0.000841 -1 10000 2 1 total 0.000887 0.001538 -0 10000 2 2 total 0.379757 0.034212 +3 10000 1 1 total 0.332466 0.050882 +2 10000 1 2 total 0.000989 0.000837 +1 10000 2 1 total 0.000925 0.001602 +0 10000 2 2 total 0.396146 0.028718 material group out nuclide mean std. dev. 1 10000 1 total 1.0 0.046071 0 10000 2 total 0.0 0.000000 @@ -276,10 +276,10 @@ 1 10001 2 1 total 0.000000 0.000000 0 10001 2 2 total 0.306542 0.052728 material group in group out nuclide mean std. dev. -3 10001 1 1 total 0.270707 0.051160 +3 10001 1 1 total 0.271891 0.059073 2 10001 1 2 total 0.000000 0.000000 1 10001 2 1 total 0.000000 0.000000 -0 10001 2 2 total 0.306542 0.067458 +0 10001 2 2 total 0.307478 0.075767 material group out nuclide mean std. dev. 1 10001 1 total 0.0 0.0 0 10001 2 total 0.0 0.0 @@ -464,10 +464,10 @@ 1 10002 2 1 total 0.000440 0.000445 0 10002 2 2 total 1.479235 0.355392 material group in group out nuclide mean std. dev. -3 10002 1 1 total 0.251506 0.048423 -2 10002 1 2 total 0.031023 0.003064 -1 10002 2 1 total 0.000440 0.000765 -0 10002 2 2 total 1.479235 0.449127 +3 10002 1 1 total 0.258652 0.045642 +2 10002 1 2 total 0.031368 0.002988 +1 10002 2 1 total 0.000443 0.000771 +0 10002 2 2 total 1.482300 0.471763 material group out nuclide mean std. dev. 1 10002 1 total 0.0 0.0 0 10002 2 total 0.0 0.0 diff --git a/tests/test_mgxs_library_nuclides/inputs_true.dat b/tests/test_mgxs_library_nuclides/inputs_true.dat index bc08b9115..2fa360ede 100644 --- a/tests/test_mgxs_library_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_nuclides/inputs_true.dat @@ -285,7 +285,7 @@ U234 U235 U238 O16 - scatter + nu-scatter analog @@ -312,26 +312,13 @@ + U234 U235 U238 O16 - scatter-1 + nu-scatter analog - - - total - flux - tracklength - - - - - U234 U235 U238 O16 - scatter - tracklength - - @@ -339,10 +326,23 @@ scatter analog + + + + U234 U235 U238 O16 + scatter-1 + analog + + + + + total + flux + analog + - U234 U235 U238 O16 nu-scatter analog @@ -352,57 +352,59 @@ U234 U235 U238 O16 - scatter + nu-scatter analog + U234 U235 U238 O16 - nu-scatter-1 + nu-scatter analog - + + U234 U235 U238 O16 - nu-fission + scatter analog U234 U235 U238 O16 - nu-fission + nu-scatter-1 analog U234 U235 U238 O16 - prompt-nu-fission + nu-fission analog U234 U235 U238 O16 - prompt-nu-fission + nu-fission analog - - total - flux - tracklength + + U234 U235 U238 O16 + prompt-nu-fission + analog - + U234 U235 U238 O16 - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -415,7 +417,7 @@ U234 U235 U238 O16 - prompt-nu-fission + inverse-velocity tracklength @@ -423,9 +425,23 @@ total flux - analog + tracklength + + + U234 U235 U238 O16 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -433,75 +449,61 @@ prompt-nu-fission analog - - - - total - flux - tracklength - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - tracklength - total flux - analog + tracklength Zr90 Zr91 Zr92 Zr94 Zr96 total - analog + tracklength - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-1 - analog - - total flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 total analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-1 + scatter-1 + analog + + + + + total + flux analog - total - flux - tracklength + Zr90 Zr91 Zr92 Zr94 Zr96 + total + analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - absorption - tracklength + nu-scatter-1 + analog @@ -520,15 +522,15 @@ - Zr90 Zr91 Zr92 Zr94 Zr96 - fission + total + flux tracklength - total - flux + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption tracklength @@ -549,7 +551,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + fission tracklength @@ -563,7 +565,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - kappa-fission + nu-fission tracklength @@ -577,7 +579,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + kappa-fission tracklength @@ -585,14 +587,14 @@ total flux - analog + tracklength Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter - analog + scatter + tracklength @@ -604,9 +606,8 @@ - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 + nu-scatter analog @@ -621,15 +622,14 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P3 + scatter-P3 analog - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + total + flux analog @@ -637,14 +637,15 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-scatter-P3 analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter analog @@ -652,15 +653,14 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + scatter analog - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + total + flux analog @@ -668,52 +668,55 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-fission analog - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + analog + Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - tracklength + nu-scatter + analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-1 - analog - - total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + analog + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter + analog + @@ -723,6 +726,27 @@ analog + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-1 + analog + + + + + total + flux + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter + analog + + @@ -730,7 +754,15 @@ nu-scatter analog - + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter + analog + + @@ -738,77 +770,77 @@ scatter analog - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-scatter-1 analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - inverse-velocity - tracklength + nu-fission + analog - - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog - + Zr90 Zr91 Zr92 Zr94 Zr96 prompt-nu-fission - tracklength + analog total flux - analog + tracklength + + + Zr90 Zr91 Zr92 Zr94 Zr96 + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -816,123 +848,95 @@ prompt-nu-fission analog - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - total - tracklength - - - - - total - flux - analog - - - - - H1 O16 B10 B11 - total - analog - + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + total + tracklength + + + + + total + flux + analog + + + + + H1 O16 B10 B11 + total + analog + + H1 O16 B10 B11 scatter-1 analog - + total flux analog - + H1 O16 B10 B11 total analog - + H1 O16 B10 B11 nu-scatter-1 analog - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - absorption - tracklength - - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - absorption - tracklength - - H1 O16 B10 B11 - fission + total + flux tracklength - total - flux + H1 O16 B10 B11 + absorption tracklength - H1 O16 B10 B11 - fission + total + flux tracklength - total - flux + H1 O16 B10 B11 + absorption tracklength H1 O16 B10 B11 - nu-fission + fission tracklength @@ -946,7 +950,7 @@ H1 O16 B10 B11 - kappa-fission + fission tracklength @@ -960,7 +964,7 @@ H1 O16 B10 B11 - scatter + nu-fission tracklength @@ -968,29 +972,28 @@ total flux - analog + tracklength H1 O16 B10 B11 - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - H1 O16 B10 B11 - scatter-P3 - analog + scatter + tracklength @@ -1002,17 +1005,15 @@ - H1 O16 B10 B11 - nu-scatter-P3 + nu-scatter analog - - H1 O16 B10 B11 - nu-scatter + total + flux analog @@ -1020,7 +1021,7 @@ H1 O16 B10 B11 - scatter + scatter-P3 analog @@ -1035,7 +1036,7 @@ H1 O16 B10 B11 - nu-fission + nu-scatter-P3 analog @@ -1043,7 +1044,7 @@ H1 O16 B10 B11 - scatter + nu-scatter analog @@ -1059,14 +1060,15 @@ total flux - tracklength + analog + H1 O16 B10 B11 - scatter - tracklength + nu-fission + analog @@ -1078,9 +1080,10 @@ + H1 O16 B10 B11 - scatter-1 + nu-scatter analog @@ -1125,73 +1128,118 @@ H1 O16 B10 B11 - nu-scatter-1 + scatter-1 analog - - H1 O16 B10 B11 - nu-fission + + total + flux analog + + + H1 O16 B10 B11 + nu-scatter + analog + + + + + + H1 O16 B10 B11 + nu-scatter + analog + + + + + + H1 O16 B10 B11 + nu-scatter + analog + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + H1 O16 B10 B11 + nu-scatter-1 + analog + + + + + H1 O16 B10 B11 + nu-fission + analog + + H1 O16 B10 B11 nu-fission analog - + H1 O16 B10 B11 prompt-nu-fission analog - + H1 O16 B10 B11 prompt-nu-fission analog - + total flux tracklength - + H1 O16 B10 B11 inverse-velocity tracklength - + total flux tracklength - + H1 O16 B10 B11 prompt-nu-fission tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_nuclides/results_true.dat b/tests/test_mgxs_library_nuclides/results_true.dat index 3fa814577..73f40d67d 100644 --- a/tests/test_mgxs_library_nuclides/results_true.dat +++ b/tests/test_mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -830113ee8be5f5a9941a2e1b97d8fc0049dbde0a7860c2ebf3aadfa4811ca58663fefbfea5f01e8793b1bfe52ac060b3631cafd959203d158d20af94ed318743 \ No newline at end of file +5c57e011264efb348fa333166e42da34f564feb2c2507f89c72fadb1056ed871e251911800fe3976cac9c66fa456edb63ee3bc0c4a40d8d82abe2c58c6cc3128 \ No newline at end of file From 29eb239760279d8bffd90348264d5a6065761c61 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 1 Mar 2017 11:04:23 -0500 Subject: [PATCH 19/40] Fixed issues in consistent scattering matrices per comments by @paulromano and @nelsonag --- openmc/mgxs/mgxs.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 2e7b7afda..5b26c05cb 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3960,8 +3960,9 @@ class ScatterMatrixXS(MatrixMGXS): (5th dimension). .. note:: The scattering moments are not multiplied by the - :math:`(2l+1)/2` prefactor in the expansion of the scattering source - into Legendre moments in the neutron transport equation. + :math:`(2\ell+1)/2` prefactor in the expansion of the + scattering source into Legendre moments in the neutron + transport equation. Parameters ---------- @@ -4569,7 +4570,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): For a spatial domain :math:`V`, incoming energy group :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, - the group-to-group scatterin probabilities are calculated as: + the group-to-group scattering probabilities are calculated as: .. math:: @@ -4648,7 +4649,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): 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 - are strings listed in the :attr:`MultiplicityMatrixXS.tally_keys` + are strings listed in the :attr:`ScatterProbabilityMatrix.tally_keys` property and values are instances of :class:`openmc.Tally`. rxn_rate_tally : openmc.Tally Derived tally for the reaction rate tally used in the numerator to @@ -4682,9 +4683,9 @@ class ScatterProbabilityMatrix(MatrixMGXS): """ - def __init__(self, domain=None, domain_type=None, groups=None, nu=False, - prompt=False, by_nuclide=False, name='', num_polar=1, - num_azimuthal=1): + def __init__(self, domain=None, domain_type=None, groups=None, + by_nuclide=False, name='', num_polar=1, + num_azimuthal=1, nu=False): super(ScatterProbabilityMatrix, self).__init__( domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) From b03fdb9a02ad250d12f816667380d1870f8b9261 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 1 Mar 2017 13:18:34 -0500 Subject: [PATCH 20/40] Fixed Python 3.5 issue with dereferencing a list of Filters in openmc.mgxs --- openmc/mgxs/mgxs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 5b26c05cb..108301389 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -5343,7 +5343,8 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): self._tallies[tally_key] = openmc.Tally(name=self.name) self._tallies[tally_key].estimator = 'analog' self._tallies[tally_key].scores = [self.scores[-1]] - self._tallies[tally_key].filters = [domain_filter, *self.filters[-1]] + self._tallies[tally_key].filters = [domain_filter] + self._tallies[tally_key].filters.extend(self.filters[-1]) # If a tally trigger was specified, add it to each tally if self.tally_trigger: From 1dc199e2f43db10b97d1d0d7d0fbda7940d75b8a Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 2 Mar 2017 09:35:46 -0500 Subject: [PATCH 21/40] Added Legendre moments back to consistent scattering matrix --- openmc/mgxs/mgxs.py | 703 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 688 insertions(+), 15 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 108301389..621ca554a 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4617,6 +4617,18 @@ class ScatterProbabilityMatrix(MatrixMGXS): Attributes ---------- + scatter_format : {'legendre', or 'histogram'} + Representation of the angular scattering distribution (default is + 'legendre') + legendre_order : int + The highest Legendre moment in the scattering matrix; this is used if + :attr:`ScatterProbabilityMatrix.scatter_format` is 'legendre'. + (default is 0) + histogram_bins : int + The number of equally-spaced bins for the histogram representation of + the angular scattering distribution; this is used if + :attr:`ScatterProbabilityMatrix.scatter_format` is 'histogram'. + (default is 16) name : str, optional Name of the multi-group cross section rxn_type : str @@ -4690,26 +4702,60 @@ class ScatterProbabilityMatrix(MatrixMGXS): domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) + self._scatter_format = 'legendre' + self._legendre_order = 0 + self._histogram_bins = 16 self._estimator = 'analog' self._valid_estimators = ['analog'] self.nu = nu def __deepcopy__(self, memo): clone = super(ScatterProbabilityMatrix, self).__deepcopy__(memo) + clone._scatter_format = self.scatter_format + clone._legendre_order = self.legendre_order + clone._histogram_bins = self.histogram_bins clone._nu = self.nu return clone + @property + def _dont_squeeze(self): + """Create a tuple of axes which should not be removed during the get_xs + process + """ + if self.num_polar > 1 or self.num_azimuthal > 1: + if self.scatter_format == 'histogram': + return (0, 1, 3, 4, 5) + else: + return (0, 1, 3, 4) + else: + if self.scatter_format == 'histogram': + return (1, 2, 3) + else: + return (1, 2) + + @property + def scatter_format(self): + return self._scatter_format + + @property + def legendre_order(self): + return self._legendre_order + + @property + def histogram_bins(self): + return self._histogram_bins + @property def nu(self): return self._nu - + @property def scores(self): - if self.nu: - return ['nu-scatter'] - else: - return ['scatter'] - + if self.scatter_format == 'legendre': + return ['{}-P{}'.format(self.rxn_type, self.legendre_order)] + elif self.scatter_format == 'histogram': + return [self.rxn_type] + @property def filters(self): # Create the non-domain specific Filters for the Tallies @@ -4721,29 +4767,66 @@ class ScatterProbabilityMatrix(MatrixMGXS): @property def rxn_rate_tally(self): + if self._rxn_rate_tally is None: - self._rxn_rate_tally = self.tallies[self.rxn_type] + if self.scatter_format == 'legendre': + tally_key = '{}-P{}'.format(self.rxn_type, + self.legendre_order) + self._rxn_rate_tally = self.tallies[tally_key] + elif self.scatter_format == 'histogram': + self._rxn_rate_tally = self.tallies[self.rxn_type] + self._rxn_rate_tally.sparse = self.sparse + return self._rxn_rate_tally @property def xs_tally(self): if self._xs_tally is None: - energyout_bins = \ - [self.energy_groups.get_group_bounds(i) for i in range(self.num_groups, 0, -1)] - norm = self.rxn_rate_tally.summation( + energyout_bins = [self.energy_groups.get_group_bounds(i) + for i in range(self.num_groups, 0, -1)] + norm = self.rxn_rate_tally.get_slice( + scores=['{}-0'.format(self.rxn_type)]) + norm = norm.summation( filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] # Compute the group-to-group probailities - self._xs_tally = self.tallies[self.rxn_type] / norm + tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) + self._xs_tally = self.tallies[tally_key] / norm super(ScatterProbabilityMatrix, self)._compute_xs() return self._xs_tally + @scatter_format.setter + def scatter_format(self, scatter_format): + cv.check_value('scatter_format', scatter_format, MU_TREATMENTS) + self._scatter_format = scatter_format + + @legendre_order.setter + def legendre_order(self, legendre_order): + cv.check_type('legendre_order', legendre_order, Integral) + cv.check_greater_than('legendre_order', legendre_order, 0, + equality=True) + cv.check_less_than('legendre_order', legendre_order, _MAX_LEGENDRE, + equality=True) + + if self.scatter_format == 'histogram': + msg = 'The legendre order will be ignored since the ' \ + 'scatter format is set to histogram' + warnings.warn(msg) + + self._legendre_order = legendre_order + + @histogram_bins.setter + def histogram_bins(self, histogram_bins): + cv.check_type('histogram_bins', histogram_bins, Integral) + cv.check_greater_than('histogram_bins', histogram_bins, 0) + self._histogram_bins = histogram_bins + @nu.setter def nu(self, nu): cv.check_type('nu', nu, bool) @@ -4755,6 +4838,552 @@ class ScatterProbabilityMatrix(MatrixMGXS): self._rxn_type = 'nu-scatter' self._hdf5_key = 'nu-scatter probability matrix' + def load_from_statepoint(self, statepoint): + """Extracts tallies in an OpenMC StatePoint with the data needed to + compute multi-group cross sections. + + This method is needed to compute cross section data from tallies + in an OpenMC StatePoint object. + + .. note:: The statepoint must be linked with an OpenMC Summary object. + + Parameters + ---------- + statepoint : openmc.StatePoint + An OpenMC StatePoint object with tally data + + Raises + ------ + ValueError + When this method is called with a statepoint that has not been + linked with a summary object. + + """ + + # Clear any tallies previously loaded from a statepoint + if self.loaded_sp: + self._tallies = None + self._xs_tally = None + self._rxn_rate_tally = None + self._loaded_sp = False + + if self.scatter_format == 'legendre': + # Expand scores to match the format in the statepoint + # e.g., "scatter-P2" -> "scatter-0", "scatter-1", "scatter-2" + tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) + self.tallies[tally_key].scores = \ + [self.rxn_type + '-{}'.format(i) + for i in range(self.legendre_order + 1)] + elif self.scatter_format == 'histogram': + self.tallies[self.rxn_type].scores = [self.rxn_type] + + super(ScatterProbabilityMatrix, self).load_from_statepoint(statepoint) + + def get_slice(self, nuclides=[], in_groups=[], out_groups=[], + legendre_order='same'): + """Build a sliced ScatterProbabilityMatrix for the specified nuclides + and energy groups. + + This method constructs a new MGXS to encapsulate a subset of the data + represented by this MGXS. The subset of data to include in the tally + slice is determined by the nuclides and energy groups specified in + the input parameters. + + Parameters + ---------- + nuclides : list of str + A list of nuclide name strings + (e.g., ['U235', 'U238']; default is []) + in_groups : list of int + A list of incoming energy group indices starting at 1 for the high + energies (e.g., [1, 2, 3]; default is []) + out_groups : list of int + A list of outgoing energy group indices starting at 1 for the high + energies (e.g., [1, 2, 3]; default is []) + legendre_order : int or 'same' + The highest Legendre moment in the sliced MGXS. If order is 'same' + then the sliced MGXS will have the same Legendre moments as the + original MGXS (default). If order is an integer less than the + original MGXS' order, then only those Legendre moments up to that + order will be included in the sliced MGXS. + + Returns + ------- + openmc.mgxs.MatrixMGXS + A new MatrixMGXS which encapsulates the subset of data requested + for the nuclide(s) and/or energy group(s) requested in the + parameters. + + """ + + # Call super class method and null out derived tallies + slice_xs = \ + super(ScatterProbabilityMatrix, self).get_slice(nuclides, in_groups) + slice_xs._rxn_rate_tally = None + slice_xs._xs_tally = None + + # Slice the Legendre order if needed + if legendre_order != 'same' and self.scatter_format == 'legendre': + cv.check_type('legendre_order', legendre_order, Integral) + cv.check_less_than('legendre_order', legendre_order, + self.legendre_order, equality=True) + slice_xs.legendre_order = legendre_order + + # Slice the scattering tally + tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) + expand_scores = \ + [self.rxn_type + '-{}'.format(i) + for i in range(self.legendre_order + 1)] + slice_xs.tallies[tally_key] = \ + slice_xs.tallies[tally_key].get_slice(scores=expand_scores) + + # Slice outgoing energy groups if needed + if len(out_groups) != 0: + filter_bins = [] + for group in out_groups: + group_bounds = self.energy_groups.get_group_bounds(group) + filter_bins.append(group_bounds) + filter_bins = [tuple(filter_bins)] + + # Slice each of the tallies across energyout groups + for tally_type, tally in slice_xs.tallies.items(): + if tally.contains_filter(openmc.EnergyoutFilter): + tally_slice = tally.get_slice( + filters=[openmc.EnergyoutFilter], filter_bins=filter_bins) + slice_xs.tallies[tally_type] = tally_slice + + slice_xs.sparse = self.sparse + return slice_xs + + def get_xs(self, in_groups='all', out_groups='all', + subdomains='all', nuclides='all', moment='all', + xs_type='macro', order_groups='increasing', + row_column='inout', value='mean', squeeze=True): + r"""Returns an array of multi-group cross sections. + + This method constructs a 5D NumPy array for the requested + multi-group cross section data for one or more subdomains + (1st dimension), energy groups in (2nd dimension), energy groups out + (3rd dimension), nuclides (4th dimension), and moments/histograms + (5th dimension). + + Parameters + ---------- + in_groups : Iterable of Integral or 'all' + Incoming energy groups of interest. Defaults to 'all'. + out_groups : Iterable of Integral or 'all' + Outgoing energy groups of interest. Defaults to 'all'. + subdomains : Iterable of Integral or 'all' + Subdomain IDs of interest. Defaults to 'all'. + nuclides : Iterable of str or 'all' or 'sum' + A list of nuclide name strings (e.g., ['U235', 'U238']). The + special string 'all' will return the cross sections for all nuclides + in the spatial domain. The special string 'sum' will return the + cross section summed over all nuclides. Defaults to 'all'. + moment : int or 'all' + The scattering matrix moment to return. All moments will be + returned if the moment is 'all' (default); otherwise, a specific + moment will be returned. + xs_type: {'macro', 'micro'} + Return the macro or micro cross section in units of cm^-1 or barns. + Defaults to 'macro'. + order_groups: {'increasing', 'decreasing'} + Return the cross section indexed according to increasing or + decreasing energy groups (decreasing or increasing energies). + Defaults to 'increasing'. + row_column: {'inout', 'outin'} + Return the cross section indexed first by incoming group and + second by outgoing group ('inout'), or vice versa ('outin'). + Defaults to 'inout'. + value : {'mean', 'std_dev', 'rel_err'} + A string for the type of value to return. Defaults to 'mean'. + squeeze : bool + A boolean representing whether to eliminate the extra dimensions + of the multi-dimensional array to be returned. Defaults to True. + + Returns + ------- + numpy.ndarray + A NumPy array of the multi-group cross section indexed in the order + each group and subdomain is listed in the parameters. + + Raises + ------ + ValueError + When this method is called before the multi-group cross section is + computed from tally data. + + """ + + cv.check_value('value', value, ['mean', 'std_dev', 'rel_err']) + cv.check_value('xs_type', xs_type, ['macro', 'micro']) + + # FIXME: Unable to get microscopic xs for mesh domain because the mesh + # cells do not know the nuclide densities in each mesh cell. + if self.domain_type == 'mesh' and xs_type == 'micro': + msg = 'Unable to get micro xs for mesh domain since the mesh ' \ + 'cells do not know the nuclide densities in each mesh cell.' + raise ValueError(msg) + + filters = [] + filter_bins = [] + + # Construct a collection of the domain filter bins + if not isinstance(subdomains, string_types): + cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=3) + filters.append(_DOMAIN_TO_FILTER[self.domain_type]) + subdomain_bins = [] + for subdomain in subdomains: + subdomain_bins.append(subdomain) + filter_bins.append(tuple(subdomain_bins)) + + # Construct list of energy group bounds tuples for all requested groups + if not isinstance(in_groups, string_types): + cv.check_iterable_type('groups', in_groups, Integral) + filters.append(openmc.EnergyFilter) + energy_bins = [] + for group in in_groups: + energy_bins.append( + (self.energy_groups.get_group_bounds(group),)) + filter_bins.append(tuple(energy_bins)) + + # Construct list of energy group bounds tuples for all requested groups + if not isinstance(out_groups, string_types): + cv.check_iterable_type('groups', out_groups, Integral) + for group in out_groups: + filters.append(openmc.EnergyoutFilter) + filter_bins.append((self.energy_groups.get_group_bounds(group),)) + + # Construct CrossScore for requested scattering moment + if moment != 'all' and self.scatter_format == 'legendre': + cv.check_type('moment', moment, Integral) + cv.check_greater_than('moment', moment, 0, equality=True) + cv.check_less_than( + 'moment', moment, self.legendre_order, equality=True) + scores = [self.xs_tally.scores[moment]] + else: + scores = [] + + # Construct a collection of the nuclides to retrieve from the xs tally + if self.by_nuclide: + if nuclides == 'all' or nuclides == 'sum' or nuclides == ['sum']: + query_nuclides = self.get_nuclides() + else: + query_nuclides = nuclides + else: + query_nuclides = ['total'] + + # Use tally summation if user requested the sum for all nuclides + if nuclides == 'sum' or nuclides == ['sum']: + xs_tally = self.xs_tally.summation(nuclides=query_nuclides) + xs = xs_tally.get_values(scores=scores, filters=filters, + filter_bins=filter_bins, value=value) + else: + xs = self.xs_tally.get_values(scores=scores, filters=filters, + filter_bins=filter_bins, + nuclides=query_nuclides, value=value) + + # Divide by atom number densities for microscopic cross sections + if xs_type == 'micro': + if self.by_nuclide: + densities = self.get_nuclide_densities(nuclides) + else: + densities = self.get_nuclide_densities('sum') + if value == 'mean' or value == 'std_dev': + xs /= densities[np.newaxis, :, np.newaxis] + + # Convert and nans to zero + xs = np.nan_to_num(xs) + + if in_groups == 'all': + num_in_groups = self.num_groups + else: + num_in_groups = len(in_groups) + + if out_groups == 'all': + num_out_groups = self.num_groups + else: + num_out_groups = len(out_groups) + + if self.scatter_format == 'histogram': + num_mu_bins = self.histogram_bins + else: + num_mu_bins = 1 + + # Reshape tally data array with separate axes for domain and energy + # Accomodate the polar and azimuthal bins if needed + num_subdomains = int(xs.shape[0] / (num_mu_bins * num_in_groups * + num_out_groups * self.num_polar * + self.num_azimuthal)) + if self.num_polar > 1 or self.num_azimuthal > 1: + if self.scatter_format == 'histogram': + new_shape = (self.num_polar, self.num_azimuthal, + num_subdomains, num_in_groups, num_out_groups, + num_mu_bins) + else: + new_shape = (self.num_polar, self.num_azimuthal, + num_subdomains, num_in_groups, num_out_groups) + new_shape += xs.shape[1:] + xs = np.reshape(xs, new_shape) + + # Transpose the scattering matrix if requested by user + if row_column == 'outin': + xs = np.swapaxes(xs, 3, 4) + + # Reverse data if user requested increasing energy groups since + # tally data is stored in order of increasing energies + if order_groups == 'increasing': + xs = xs[:, :, :, ::-1, ::-1, ...] + else: + if self.scatter_format == 'histogram': + new_shape = (num_subdomains, num_in_groups, num_out_groups, + num_mu_bins) + else: + new_shape = (num_subdomains, num_in_groups, num_out_groups) + new_shape += xs.shape[1:] + xs = np.reshape(xs, new_shape) + + # Transpose the scattering matrix if requested by user + if row_column == 'outin': + xs = np.swapaxes(xs, 1, 2) + + # Reverse data if user requested increasing energy groups since + # tally data is stored in order of increasing energies + if order_groups == 'increasing': + xs = xs[:, ::-1, ::-1, ...] + + if squeeze: + # We want to squeeze out everything but the angles, in_groups, + # out_groups, and, if needed, num_mu_bins dimension. These must + # not be squeezed so 1-group, 1-angle problems have the correct + # shape. + xs = self._squeeze_xs(xs) + return xs + + def get_pandas_dataframe(self, groups='all', nuclides='all', moment='all', + xs_type='macro', distribcell_paths=True): + """Build a Pandas DataFrame for the MGXS data. + + This method leverages :meth:`openmc.Tally.get_pandas_dataframe`, but + renames the columns with terminology appropriate for cross section data. + + Parameters + ---------- + groups : Iterable of Integral or 'all' + Energy groups of interest. Defaults to 'all'. + nuclides : Iterable of str or 'all' or 'sum' + The nuclides of the cross-sections to include in the dataframe. This + may be a list of nuclide name strings (e.g., ['U235', 'U238']). + The special string 'all' will include the cross sections for all + nuclides in the spatial domain. The special string 'sum' will + include the cross sections summed over all nuclides. Defaults + to 'all'. + moment : int or 'all' + The scattering matrix moment to return. All moments will be + returned if the moment is 'all' (default); otherwise, a specific + moment will be returned. + xs_type: {'macro', 'micro'} + Return macro or micro cross section in units of cm^-1 or barns. + Defaults to 'macro'. + distribcell_paths : bool, optional + Construct columns for distribcell tally filters (default is True). + The geometric information in the Summary object is embedded into a + Multi-index column with a geometric "path" to each distribcell + instance. + + Returns + ------- + pandas.DataFrame + A Pandas DataFrame for the cross section data. + + Raises + ------ + ValueError + When this method is called before the multi-group cross section is + computed from tally data. + + """ + + df = super(ScatterProbabilityMatrix, self).get_pandas_dataframe( + groups, nuclides, xs_type, distribcell_paths) + + if self.scatter_format == 'legendre': + # Add a moment column to dataframe + if self.legendre_order > 0: + # Insert a column corresponding to the Legendre moments + moments = ['P{}'.format(i) + for i in range(self.legendre_order + 1)] + moments = np.tile(moments, int(df.shape[0] / len(moments))) + df['moment'] = moments + + # Place the moment column before the mean column + columns = df.columns.tolist() + mean_index \ + = [i for i, s in enumerate(columns) if 'mean' in s][0] + if self.domain_type == 'mesh': + df = df[columns[:mean_index] + [('moment', '')] + + columns[mean_index:-1]] + else: + df = df[columns[:mean_index] + ['moment'] + + columns[mean_index:-1]] + + # Select rows corresponding to requested scattering moment + if moment != 'all': + cv.check_type('moment', moment, Integral) + cv.check_greater_than('moment', moment, 0, equality=True) + cv.check_less_than( + 'moment', moment, self.legendre_order, equality=True) + df = df[df['moment'] == 'P{}'.format(moment)] + + return df + + def print_xs(self, subdomains='all', nuclides='all', + xs_type='macro', moment=0): + """Prints a string representation for the multi-group cross section. + + Parameters + ---------- + subdomains : Iterable of Integral or 'all' + The subdomain IDs of the cross sections to include in the report. + Defaults to 'all'. + nuclides : Iterable of str or 'all' or 'sum' + The nuclides of the cross-sections to include in the report. This + may be a list of nuclide name strings (e.g., ['U235', 'U238']). + The special string 'all' will report the cross sections for all + nuclides in the spatial domain. The special string 'sum' will report + the cross sections summed over all nuclides. Defaults to 'all'. + xs_type: {'macro', 'micro'} + Return the macro or micro cross section in units of cm^-1 or barns. + Defaults to 'macro'. + moment : int + The scattering moment to print (default is 0) + + """ + + # Construct a collection of the subdomains to report + if not isinstance(subdomains, string_types): + cv.check_iterable_type('subdomains', subdomains, Integral) + elif self.domain_type == 'distribcell': + subdomains = np.arange(self.num_subdomains, dtype=np.int) + elif self.domain_type == 'mesh': + xyz = [range(1, x + 1) for x in self.domain.dimension] + subdomains = list(itertools.product(*xyz)) + else: + subdomains = [self.domain.id] + + # Construct a collection of the nuclides to report + if self.by_nuclide: + if nuclides == 'all': + nuclides = self.get_nuclides() + if nuclides == 'sum': + nuclides = ['sum'] + else: + cv.check_iterable_type('nuclides', nuclides, string_types) + else: + nuclides = ['sum'] + + cv.check_value('xs_type', xs_type, ['macro', 'micro']) + + if self.scatter_format == 'legendre': + rxn_type = '{0} (P{1})'.format(self.rxn_type, moment) + else: + rxn_type = self.rxn_type + + # Build header for string with type and domain info + string = 'Multi-Group XS\n' + string += '{0: <16}=\t{1}\n'.format('\tReaction Type', rxn_type) + string += '{0: <16}=\t{1}\n'.format('\tDomain Type', self.domain_type) + string += '{0: <16}=\t{1}\n'.format('\tDomain ID', self.domain.id) + + # Generate the header for an individual XS + xs_header = '\tCross Sections [{0}]:'.format(self.get_units(xs_type)) + + # If cross section data has not been computed, only print string header + if self.tallies is None: + print(string) + return + + string += '{0: <16}\n'.format('\tEnergy Groups:') + template = '{0: <12}Group {1} [{2: <10} - {3: <10}eV]\n' + + # Loop over energy groups ranges + for group in range(1, self.num_groups + 1): + bounds = self.energy_groups.get_group_bounds(group) + string += template.format('', group, bounds[0], bounds[1]) + + # Set polar and azimuthal bins if necessary + if self.num_polar > 1 or self.num_azimuthal > 1: + pol_bins = np.linspace(0., np.pi, num=self.num_polar + 1, + endpoint=True) + azi_bins = np.linspace(-np.pi, np.pi, num=self.num_azimuthal + 1, + endpoint=True) + + # Loop over all subdomains + for subdomain in subdomains: + + if self.domain_type == 'distribcell' or self.domain_type == 'mesh': + string += '{0: <16}=\t{1}\n'.format('\tSubdomain', subdomain) + + # Loop over all Nuclides + for nuclide in nuclides: + + # Build header for nuclide type + if xs_type != 'sum': + string += '{0: <16}=\t{1}\n'.format('\tNuclide', nuclide) + + # Build header for cross section type + string += '{0: <16}\n'.format(xs_header) + template = '{0: <12}Group {1} -> Group {2}:\t\t' + + average_xs = self.get_xs(nuclides=[nuclide], + subdomains=[subdomain], + xs_type=xs_type, value='mean', + moment=moment) + rel_err_xs = self.get_xs(nuclides=[nuclide], + subdomains=[subdomain], + xs_type=xs_type, value='rel_err', + moment=moment) + rel_err_xs = rel_err_xs * 100. + + if self.num_polar > 1 or self.num_azimuthal > 1: + # Loop over polar, azi, and in/out energy group ranges + for pol in range(len(pol_bins) - 1): + pol_low, pol_high = pol_bins[pol: pol + 2] + for azi in range(len(azi_bins) - 1): + azi_low, azi_high = azi_bins[azi: azi + 2] + string += '\t\tPolar Angle: [{0:5f} - {1:5f}]'.format( + pol_low, pol_high) + \ + '\tAzimuthal Angle: [{0:5f} - {1:5f}]'.format( + azi_low, azi_high) + '\n' + for in_group in range(1, self.num_groups + 1): + for out_group in range(1, self.num_groups + 1): + string += '\t' + template.format('', + in_group, + out_group) + string += '{0:.2e} +/- {1:.2e}%'.format( + average_xs[pol, azi, in_group - 1, + out_group - 1], + rel_err_xs[pol, azi, in_group - 1, + out_group - 1]) + string += '\n' + string += '\n' + string += '\n' + else: + # Loop over incoming/outgoing energy groups ranges + for in_group in range(1, self.num_groups + 1): + for out_group in range(1, self.num_groups + 1): + string += template.format('', in_group, out_group) + string += '{0:.2e} +/- {1:.2e}%'.format( + average_xs[in_group - 1, out_group - 1], + rel_err_xs[in_group - 1, out_group - 1]) + string += '\n' + string += '\n' + string += '\n' + string += '\n' + string += '\n' + + print(string) + @add_metaclass(ABCMeta) class ConvolvedMGXS(MGXS): @@ -5112,6 +5741,7 @@ class ConvolvedMGXS(MGXS): class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): +#class ConsistentScatterMatrixXS(ScatterMatrixXS, ConvolvedMGXS): r"""A scattering matrix multi-group cross section computed as the product of the scatter cross section and group-to-group scattering probabilities. @@ -5410,22 +6040,22 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): @ScatterMatrixXS.correction.setter def correction(self, correction): - ScatterMatrixXS.correction = correction + ScatterMatrixXS.correction.fset(self, correction) self.mgxs[2].correction = correction @ScatterMatrixXS.scatter_format.setter def scatter_format(self, scatter_format): - ScatterMatrixXS.scatter_format = scatter_format + ScatterMatrixXS.scatter_format.fset(self, scatter_format) self.mgxs[1].scatter_format = scatter_format @ScatterMatrixXS.legendre_order.setter def legendre_order(self, legendre_order): - ScatterMatrixXS.legendre_order = legendre_order + ScatterMatrixXS.legendre_order.fset(self, legendre_order) self.mgxs[1].legendre_order = legendre_order @ScatterMatrixXS.histogram_bins.setter def histogram_bins(self, histogram_bins): - ScatterMatrixXS.histogram_bins = histogram_bins + ScatterMatrixXS.histogram_bins.fset(self, histogram_bins) self.mgxs[1].histogram_bins = histogram_bins @ScatterMatrixXS.nu.setter @@ -5443,6 +6073,49 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): for mgxs in self.mgxs: mgxs.nu = nu + def load_from_statepoint(self, statepoint): + """Extracts tallies in an OpenMC StatePoint with the data needed to + compute multi-group cross sections. + + This method is needed to compute cross section data from tallies + in an OpenMC StatePoint object. + + .. note:: The statepoint must be linked with an OpenMC Summary object. + + Parameters + ---------- + statepoint : openmc.StatePoint + An OpenMC StatePoint object with tally data + + Raises + ------ + ValueError + When this method is called with a statepoint that has not been + linked with a summary object. + + """ + + # Clear any tallies previously loaded from a statepoint + if self.loaded_sp: + self._tallies = None + self._xs_tally = None + self._rxn_rate_tally = None + self._loaded_sp = False + + if self.scatter_format == 'legendre': + # Expand scores to match the format in the statepoint + # e.g., "scatter-P2" -> "scatter-0", "scatter-1", "scatter-2" + tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) + tally_key = \ + '{} probability matrix : {}'.format(self.rxn_type, tally_key) + self.tallies[tally_key].scores = \ + [self.rxn_type + '-{}'.format(i) + for i in range(self.legendre_order + 1)] + elif self.scatter_format == 'histogram': + self.tallies[self.rxn_type].scores = [self.rxn_type] + + super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) + def get_condensed_xs(self, coarse_groups): condense_xs = \ super(ConsistentScatterMatrixXS, self).get_condensed_xs(coarse_groups) From 6d092292bc18fe63377a6bac34251da9ff0d4e4b Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 2 Mar 2017 09:49:54 -0500 Subject: [PATCH 22/40] Updated test results with Legendre moments for consistent scattering matrices --- openmc/mgxs/mgxs.py | 23 +- .../inputs_true.dat | 676 ++++++++---------- .../results_true.dat | 42 +- .../inputs_true.dat | 110 ++- .../results_true.dat | 14 +- tests/test_mgxs_library_hdf5/inputs_true.dat | 676 ++++++++---------- tests/test_mgxs_library_hdf5/results_true.dat | 84 ++- tests/test_mgxs_library_mesh/inputs_true.dat | 110 ++- tests/test_mgxs_library_mesh/results_true.dat | 48 +- .../inputs_true.dat | 676 ++++++++---------- .../results_true.dat | 132 +++- .../inputs_true.dat | 514 ++++++------- .../results_true.dat | 2 +- 13 files changed, 1538 insertions(+), 1569 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 621ca554a..c34f0b9fe 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4574,10 +4574,11 @@ class ScatterProbabilityMatrix(MatrixMGXS): .. math:: - \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr + \langle \sigma_{s,\ell,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega - \int_{E_g}^{E_{g-1}} dE \; \sigma_s (r, E' - \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ + \int_{E_g}^{E_{g-1}} dE \; P_\ell (\Omega \cdot \Omega') + \sigma_{s} (r, E' \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', + \Omega')\\ \langle \sigma_{s,g'} \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega \int_{0}^{\infty} dE \; \sigma_s (r, E' @@ -4586,11 +4587,19 @@ class ScatterProbabilityMatrix(MatrixMGXS): \sigma_{s,g'\rightarrow g} \phi \rangle}{\langle \sigma_{s,g'} \phi \rangle} + .. math:: - This class can also be used to gather a prompt-nu-fission cross section - (which only includes the contributions from prompt neutrons). This is - accomplished by setting the :attr:`NuFissionMatrixXS.prompt` attribute to - `True`. + \langle \sigma_{s,\ell,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr + \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega + \int_{E_g}^{E_{g-1}} dE \; P_\ell (\Omega \cdot \Omega') \sigma_s (r, E' + \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ + \langle \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega + \int_{E_g}^{E_{g-1}} dE \; \psi (r, E, \Omega) \\ + \sigma_{s,\ell,g'\rightarrow g} &= \frac{\langle + \sigma_{s,\ell,g'\rightarrow g} \phi \rangle}{\langle \phi \rangle} + + To incorporate the effect of neutron multiplication from (n,xn) reactions + in the above probaility matrix, the `nu` parameter can be set to `True`. Parameters ---------- diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat index 518663028..f99014ee2 100644 --- a/tests/test_mgxs_library_condense/inputs_true.dat +++ b/tests/test_mgxs_library_condense/inputs_true.dat @@ -277,7 +277,7 @@ total - scatter + scatter-P0 analog @@ -285,7 +285,7 @@ total - nu-scatter + nu-scatter-P0 analog @@ -307,7 +307,7 @@ total - scatter + scatter-P3 analog @@ -328,23 +328,24 @@ - + total - scatter-1 + flux analog total - flux + nu-scatter analog + total - nu-scatter + nu-scatter-P3 analog @@ -360,51 +361,50 @@ total - nu-scatter + scatter analog - - + total - scatter + nu-fission analog total - nu-scatter-1 + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -417,31 +417,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -449,14 +435,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -464,7 +450,7 @@ delayed-nu-fission tracklength - + @@ -472,7 +458,7 @@ delayed-nu-fission analog - + @@ -480,30 +466,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -511,14 +497,14 @@ decay-rate tracklength - + total flux analog - + @@ -527,62 +513,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -601,14 +601,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -629,7 +629,7 @@ total - fission + nu-fission tracklength @@ -643,7 +643,7 @@ total - nu-fission + kappa-fission tracklength @@ -657,7 +657,7 @@ total - kappa-fission + scatter tracklength @@ -665,14 +665,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -684,8 +684,9 @@ + total - nu-scatter + scatter-P3 analog @@ -700,14 +701,15 @@ total - scatter-P3 + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -715,15 +717,14 @@ total - nu-scatter-P3 + scatter analog - total - nu-scatter + flux analog @@ -731,14 +732,15 @@ total - scatter + nu-fission analog + total - flux + scatter-P0 analog @@ -746,39 +748,39 @@ total - nu-fission + nu-scatter-P0 analog - - - - total - scatter - analog - - - - - - total - nu-scatter - analog - - total flux tracklength - + total scatter tracklength + + + + + total + scatter-P3 + analog + + + + + + total + nu-scatter + analog + @@ -790,113 +792,112 @@ - total - nu-scatter + flux analog - total - scatter + nu-scatter analog + total - scatter-1 + nu-scatter-P3 analog + total - flux + nu-scatter analog + total - nu-scatter + scatter analog - - + total - nu-scatter + nu-fission analog - total - nu-scatter + nu-fission analog - - + total - scatter + prompt-nu-fission analog total - nu-scatter-1 + prompt-nu-fission analog - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + @@ -906,31 +907,33 @@ + total - prompt-nu-fission + delayed-nu-fission tracklength - + + total - flux + delayed-nu-fission analog - + total - prompt-nu-fission + delayed-nu-fission analog total - flux + nu-fission tracklength @@ -944,43 +947,12 @@ - + total delayed-nu-fission - analog + tracklength - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -988,14 +960,14 @@ decay-rate tracklength - + total flux analog - + @@ -1004,95 +976,123 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + + + + + total + fission + tracklength + total - absorption + flux tracklength total - flux + fission tracklength total - absorption + flux tracklength total - fission + nu-fission tracklength @@ -1106,7 +1106,7 @@ total - fission + kappa-fission tracklength @@ -1120,7 +1120,7 @@ total - nu-fission + scatter tracklength @@ -1128,28 +1128,29 @@ total flux - tracklength + analog total - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + total - scatter - tracklength + scatter-P3 + analog @@ -1161,15 +1162,17 @@ + total - nu-scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -1177,7 +1180,7 @@ total - scatter-P3 + scatter analog @@ -1192,7 +1195,7 @@ total - nu-scatter-P3 + nu-fission analog @@ -1200,7 +1203,7 @@ total - nu-scatter + scatter-P0 analog @@ -1208,7 +1211,7 @@ total - scatter + nu-scatter-P0 analog @@ -1216,22 +1219,21 @@ total flux - analog + tracklength - total - nu-fission - analog + scatter + tracklength total - scatter + scatter-P3 analog @@ -1245,23 +1247,23 @@ + total - flux - tracklength + scatter + analog total - scatter - tracklength + flux + analog - total - scatter + nu-scatter analog @@ -1269,7 +1271,7 @@ total - nu-scatter + nu-scatter-P3 analog @@ -1277,47 +1279,10 @@ total - scatter + nu-scatter analog - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter - analog - - @@ -1325,36 +1290,72 @@ scatter analog - - - - total - nu-scatter-1 - analog - - + total nu-fission analog - + total nu-fission analog - + total prompt-nu-fission analog + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + total prompt-nu-fission @@ -1368,49 +1369,6 @@ tracklength - - - total - inverse-velocity - tracklength - - - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - - - - total - flux - analog - - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - @@ -1418,7 +1376,7 @@ delayed-nu-fission tracklength - + @@ -1426,7 +1384,7 @@ delayed-nu-fission analog - + @@ -1434,14 +1392,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1449,7 +1407,7 @@ delayed-nu-fission tracklength - + @@ -1457,7 +1415,7 @@ delayed-nu-fission tracklength - + @@ -1465,14 +1423,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat index 06edc733c..bb84ee16a 100644 --- a/tests/test_mgxs_library_condense/results_true.dat +++ b/tests/test_mgxs_library_condense/results_true.dat @@ -36,10 +36,16 @@ 0 10000 1 1 total 1.0 0.066111 material group in group out nuclide mean std. dev. 0 10000 1 1 total 1.0 0.066111 - material group in group out nuclide mean std. dev. -0 10000 1 1 total 0.341361 0.031842 - material group in group out nuclide mean std. dev. -0 10000 1 1 total 0.343079 0.043498 + material group in group out nuclide moment mean std. dev. +0 10000 1 1 total P0 0.388721 0.031279 +1 10000 1 1 total P1 0.046155 0.006407 +2 10000 1 1 total P2 0.017957 0.003039 +3 10000 1 1 total P3 0.006618 0.002480 + material group in group out nuclide moment mean std. dev. +0 10000 1 1 total P0 0.389304 0.043096 +1 10000 1 1 total P1 0.046224 0.007316 +2 10000 1 1 total P2 0.017984 0.003336 +3 10000 1 1 total P3 0.006628 0.002534 material group out nuclide mean std. dev. 0 10000 1 total 1.0 0.046071 material group out nuclide mean std. dev. @@ -123,10 +129,16 @@ 0 10001 1 1 total 1.0 0.095039 material group in group out nuclide mean std. dev. 0 10001 1 1 total 1.0 0.095039 - material group in group out nuclide mean std. dev. -0 10001 1 1 total 0.276654 0.033287 - material group in group out nuclide mean std. dev. -0 10001 1 1 total 0.27737 0.051266 + material group in group out nuclide moment mean std. dev. +0 10001 1 1 total P0 0.309384 0.032376 +1 10001 1 1 total P1 0.030756 0.007617 +2 10001 1 1 total P2 0.018997 0.004420 +3 10001 1 1 total P3 0.006263 0.003364 + material group in group out nuclide moment mean std. dev. +0 10001 1 1 total P0 0.307987 0.050720 +1 10001 1 1 total P1 0.030617 0.008524 +2 10001 1 1 total P2 0.018911 0.005015 +3 10001 1 1 total P3 0.006235 0.003442 material group out nuclide mean std. dev. 0 10001 1 total 0.0 0.0 material group out nuclide mean std. dev. @@ -210,10 +222,16 @@ 0 10002 1 1 total 1.0 0.056867 material group in group out nuclide mean std. dev. 0 10002 1 1 total 1.0 0.056867 - material group in group out nuclide mean std. dev. -0 10002 1 1 total 0.489924 0.069059 - material group in group out nuclide mean std. dev. -0 10002 1 1 total 0.492997 0.086399 + material group in group out nuclide moment mean std. dev. +0 10002 1 1 total P0 0.898938 0.067118 +1 10002 1 1 total P1 0.408384 0.028127 +2 10002 1 1 total P2 0.142591 0.010824 +3 10002 1 1 total P3 0.008696 0.003588 + material group in group out nuclide moment mean std. dev. +0 10002 1 1 total P0 0.903415 0.084918 +1 10002 1 1 total P1 0.410417 0.036718 +2 10002 1 1 total P2 0.143301 0.013612 +3 10002 1 1 total P3 0.008739 0.003640 material group out nuclide mean std. dev. 0 10002 1 total 0.0 0.0 material group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat index 5a64f7af1..3ab849a56 100644 --- a/tests/test_mgxs_library_distribcell/inputs_true.dat +++ b/tests/test_mgxs_library_distribcell/inputs_true.dat @@ -304,7 +304,7 @@ total - scatter + scatter-P0 analog @@ -312,7 +312,7 @@ total - nu-scatter + nu-scatter-P0 analog @@ -334,7 +334,7 @@ total - scatter + scatter-P3 analog @@ -355,23 +355,24 @@ - + total - scatter-1 + flux analog total - flux + nu-scatter analog + total - nu-scatter + nu-scatter-P3 analog @@ -387,51 +388,50 @@ total - nu-scatter + scatter analog - total - scatter + nu-fission analog total - nu-scatter-1 + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -444,7 +444,7 @@ total - inverse-velocity + prompt-nu-fission tracklength @@ -452,54 +452,40 @@ total flux - tracklength + analog + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength + - total - prompt-nu-fission - analog + delayed-nu-fission + tracklength + total - flux - tracklength + delayed-nu-fission + analog - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - @@ -507,30 +493,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -538,14 +524,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat index 14893f083..bf98ad688 100644 --- a/tests/test_mgxs_library_distribcell/results_true.dat +++ b/tests/test_mgxs_library_distribcell/results_true.dat @@ -36,10 +36,16 @@ 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 1.0 0.037213 sum(distribcell) 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 total 1.0 0.037208 - sum(distribcell) 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 total 0.342636 0.017656 - sum(distribcell) 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 total 0.340468 0.025369 + sum(distribcell) group in group out nuclide moment mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P0 0.390797 0.016955 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P1 0.047641 0.005091 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P2 0.015866 0.003708 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P3 0.005430 0.003170 + sum(distribcell) group in group out nuclide moment mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P0 0.387654 0.024885 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P1 0.047226 0.005527 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P2 0.015740 0.003750 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P3 0.005392 0.003157 sum(distribcell) group out nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 1.0 0.080455 sum(distribcell) group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat index 518663028..f99014ee2 100644 --- a/tests/test_mgxs_library_hdf5/inputs_true.dat +++ b/tests/test_mgxs_library_hdf5/inputs_true.dat @@ -277,7 +277,7 @@ total - scatter + scatter-P0 analog @@ -285,7 +285,7 @@ total - nu-scatter + nu-scatter-P0 analog @@ -307,7 +307,7 @@ total - scatter + scatter-P3 analog @@ -328,23 +328,24 @@ - + total - scatter-1 + flux analog total - flux + nu-scatter analog + total - nu-scatter + nu-scatter-P3 analog @@ -360,51 +361,50 @@ total - nu-scatter + scatter analog - - + total - scatter + nu-fission analog total - nu-scatter-1 + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -417,31 +417,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -449,14 +435,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -464,7 +450,7 @@ delayed-nu-fission tracklength - + @@ -472,7 +458,7 @@ delayed-nu-fission analog - + @@ -480,30 +466,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -511,14 +497,14 @@ decay-rate tracklength - + total flux analog - + @@ -527,62 +513,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -601,14 +601,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -629,7 +629,7 @@ total - fission + nu-fission tracklength @@ -643,7 +643,7 @@ total - nu-fission + kappa-fission tracklength @@ -657,7 +657,7 @@ total - kappa-fission + scatter tracklength @@ -665,14 +665,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -684,8 +684,9 @@ + total - nu-scatter + scatter-P3 analog @@ -700,14 +701,15 @@ total - scatter-P3 + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -715,15 +717,14 @@ total - nu-scatter-P3 + scatter analog - total - nu-scatter + flux analog @@ -731,14 +732,15 @@ total - scatter + nu-fission analog + total - flux + scatter-P0 analog @@ -746,39 +748,39 @@ total - nu-fission + nu-scatter-P0 analog - - - - total - scatter - analog - - - - - - total - nu-scatter - analog - - total flux tracklength - + total scatter tracklength + + + + + total + scatter-P3 + analog + + + + + + total + nu-scatter + analog + @@ -790,113 +792,112 @@ - total - nu-scatter + flux analog - total - scatter + nu-scatter analog + total - scatter-1 + nu-scatter-P3 analog + total - flux + nu-scatter analog + total - nu-scatter + scatter analog - - + total - nu-scatter + nu-fission analog - total - nu-scatter + nu-fission analog - - + total - scatter + prompt-nu-fission analog total - nu-scatter-1 + prompt-nu-fission analog - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + @@ -906,31 +907,33 @@ + total - prompt-nu-fission + delayed-nu-fission tracklength - + + total - flux + delayed-nu-fission analog - + total - prompt-nu-fission + delayed-nu-fission analog total - flux + nu-fission tracklength @@ -944,43 +947,12 @@ - + total delayed-nu-fission - analog + tracklength - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -988,14 +960,14 @@ decay-rate tracklength - + total flux analog - + @@ -1004,95 +976,123 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + + + + + total + fission + tracklength + total - absorption + flux tracklength total - flux + fission tracklength total - absorption + flux tracklength total - fission + nu-fission tracklength @@ -1106,7 +1106,7 @@ total - fission + kappa-fission tracklength @@ -1120,7 +1120,7 @@ total - nu-fission + scatter tracklength @@ -1128,28 +1128,29 @@ total flux - tracklength + analog total - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + total - scatter - tracklength + scatter-P3 + analog @@ -1161,15 +1162,17 @@ + total - nu-scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -1177,7 +1180,7 @@ total - scatter-P3 + scatter analog @@ -1192,7 +1195,7 @@ total - nu-scatter-P3 + nu-fission analog @@ -1200,7 +1203,7 @@ total - nu-scatter + scatter-P0 analog @@ -1208,7 +1211,7 @@ total - scatter + nu-scatter-P0 analog @@ -1216,22 +1219,21 @@ total flux - analog + tracklength - total - nu-fission - analog + scatter + tracklength total - scatter + scatter-P3 analog @@ -1245,23 +1247,23 @@ + total - flux - tracklength + scatter + analog total - scatter - tracklength + flux + analog - total - scatter + nu-scatter analog @@ -1269,7 +1271,7 @@ total - nu-scatter + nu-scatter-P3 analog @@ -1277,47 +1279,10 @@ total - scatter + nu-scatter analog - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter - analog - - @@ -1325,36 +1290,72 @@ scatter analog - - - - total - nu-scatter-1 - analog - - + total nu-fission analog - + total nu-fission analog - + total prompt-nu-fission analog + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + total prompt-nu-fission @@ -1368,49 +1369,6 @@ tracklength - - - total - inverse-velocity - tracklength - - - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - - - - total - flux - analog - - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - @@ -1418,7 +1376,7 @@ delayed-nu-fission tracklength - + @@ -1426,7 +1384,7 @@ delayed-nu-fission analog - + @@ -1434,14 +1392,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1449,7 +1407,7 @@ delayed-nu-fission tracklength - + @@ -1457,7 +1415,7 @@ delayed-nu-fission tracklength - + @@ -1465,14 +1423,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat index 4a8578b6d..3f7797bf1 100644 --- a/tests/test_mgxs_library_hdf5/results_true.dat +++ b/tests/test_mgxs_library_hdf5/results_true.dat @@ -71,15 +71,27 @@ domain=10000 type=nu-scatter probability matrix [[7.82243018e-02 1.25560869e-03] [2.24310192e-03 4.10531468e-02]] domain=10000 type=consistent scatter matrix -[[3.32987194e-01 9.94653712e-04] - [8.87128136e-04 3.79756741e-01]] -[[3.73090623e-02 4.89318749e-04] - [8.89289900e-04 3.01139605e-02]] +[[[3.86422967e-01 5.21704775e-02 2.01849914e-02 9.53256688e-03] + [9.94653712e-04 -2.08433942e-04 -1.03964400e-04 2.35646553e-04]] + + [[8.87128136e-04 -7.36559899e-04 4.73756321e-04 -1.64539748e-04] + [3.94772020e-01 1.58130798e-02 6.11300510e-03 -1.00731826e-02]]] +[[[3.66286904e-02 7.76748968e-03 3.13767806e-03 2.32683668e-03] + [4.89318749e-04 1.50458419e-04 1.85500930e-04 1.29783344e-04]] + + [[8.89289900e-04 7.38354757e-04 4.74910776e-04 1.64940700e-04] + [2.98710064e-02 4.44330993e-03 1.01307463e-02 1.00367467e-02]]] domain=10000 type=consistent nu-scatter matrix -[[3.32465997e-01 9.88930322e-04] - [9.24639842e-04 3.96145576e-01]] -[[5.08819059e-02 8.36973463e-04] - [1.60212263e-03 2.87181296e-02]] +[[[3.84199430e-01 5.18702806e-02 2.00688439e-02 9.47771503e-03] + [9.88930322e-04 -2.07234582e-04 -1.03366173e-04 2.34290606e-04]] + + [[9.24639842e-04 -7.67704913e-04 4.93788836e-04 -1.71497217e-04] + [4.11464730e-01 1.64817268e-02 6.37149004e-03 -1.04991213e-02]]] +[[[5.04005137e-02 9.04259889e-03 3.61169756e-03 2.46795126e-03] + [8.36973463e-04 2.06752354e-04 1.97694759e-04 2.06602832e-04]] + + [[1.60212263e-03 1.33020162e-03 8.55587476e-04 2.97153075e-04] + [2.84588375e-02 4.60349295e-03 1.05573088e-02 1.04561824e-02]]] domain=10000 type=chi [1.00000000e+00 0.00000000e+00] [4.60705493e-02 0.00000000e+00] @@ -257,15 +269,27 @@ domain=10001 type=nu-scatter probability matrix [[1.08778697e-01 0.00000000e+00] [0.00000000e+00 1.42427173e-01]] domain=10001 type=consistent scatter matrix -[[2.70706971e-01 0.00000000e+00] - [0.00000000e+00 3.06542088e-01]] -[[3.82655052e-02 0.00000000e+00] - [0.00000000e+00 5.27278829e-02]] +[[[3.12162675e-01 3.84813069e-02 2.08815337e-02 8.01673640e-03] + [0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]] + + [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] + [2.95421002e-01 -1.11817183e-02 8.81141444e-03 -3.26075959e-03]]] +[[[3.72534018e-02 8.74305413e-03 4.83468235e-03 3.77642682e-03] + [0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]] + + [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] + [5.02358893e-02 1.61616720e-02 1.14951123e-02 7.31312479e-03]]] domain=10001 type=consistent nu-scatter matrix -[[2.71891125e-01 0.00000000e+00] - [0.00000000e+00 3.07477884e-01]] -[[5.90732661e-02 0.00000000e+00] - [0.00000000e+00 7.57666234e-02]] +[[[3.10120713e-01 3.82295876e-02 2.07449405e-02 7.96429620e-03] + [0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]] + + [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] + [2.96264249e-01 -1.12136353e-02 8.83656566e-03 -3.27006707e-03]]] +[[[5.84608636e-02 1.03230576e-02 5.67743887e-03 3.92760936e-03] + [0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]] + + [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] + [7.40187611e-02 1.63372534e-02 1.16408402e-02 7.35838382e-03]]] domain=10001 type=chi [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] @@ -443,15 +467,27 @@ domain=10002 type=nu-scatter probability matrix [[3.60184962e-02 2.54736726e-03] [2.18820864e-04 1.35884974e-01]] domain=10002 type=consistent scatter matrix -[[2.51505773e-01 3.10225138e-02] - [4.40143026e-04 1.47923453e+00]] -[[4.18067487e-02 2.23201039e-03] - [4.44773843e-04 3.55391574e-01]] +[[[6.32859281e-01 3.76972649e-01 1.50714804e-01 9.04734705e-03] + [3.10225138e-02 8.66134326e-03 -2.53964096e-03 -3.74315061e-03]] + + [[4.40143026e-04 3.97073448e-04 3.17256062e-04 2.12303394e-04] + [2.02025649e+00 5.06259696e-01 1.10372136e-01 2.48080660e-02]]] +[[[3.81421848e-02 2.37145043e-02 1.06635009e-02 3.86848985e-03] + [2.23201039e-03 9.99377011e-04 1.00968851e-03 8.26439590e-04]] + + [[4.44773843e-04 4.01251123e-04 3.20593966e-04 2.14537073e-04] + [3.52193929e-01 7.91402819e-02 1.84875925e-02 8.77085752e-03]]] domain=10002 type=consistent nu-scatter matrix -[[2.58651993e-01 3.13677176e-02] - [4.43343102e-04 1.48230049e+00]] -[[4.56422796e-02 2.98774961e-03] - [7.71125112e-04 4.71762821e-01]] +[[[6.39901439e-01 3.81167422e-01 1.52391887e-01 9.14802163e-03] + [3.13677176e-02 8.75772258e-03 -2.56790088e-03 -3.78480261e-03]] + + [[4.43343102e-04 3.99960386e-04 3.19562684e-04 2.13846954e-04] + [2.03494484e+00 5.09940477e-01 1.11174601e-01 2.49884339e-02]]] +[[[4.26392749e-02 2.63117825e-02 1.16194647e-02 3.92016710e-03] + [2.98774961e-03 1.14887360e-03 1.03342895e-03 8.68386243e-04]] + + [[7.71125112e-04 6.95667747e-04 5.55828678e-04 3.71952908e-04] + [4.68587349e-01 1.10634806e-01 2.50303502e-02 9.60120658e-03]]] domain=10002 type=chi [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 3f719e7b0..aca103a8a 100644 --- a/tests/test_mgxs_library_mesh/inputs_true.dat +++ b/tests/test_mgxs_library_mesh/inputs_true.dat @@ -541,7 +541,7 @@ total - scatter + scatter-P0 analog @@ -549,7 +549,7 @@ total - nu-scatter + nu-scatter-P0 analog @@ -571,7 +571,7 @@ total - scatter + scatter-P3 analog @@ -592,23 +592,24 @@ - + total - scatter-1 + flux analog total - flux + nu-scatter analog + total - nu-scatter + nu-scatter-P3 analog @@ -624,51 +625,50 @@ total - nu-scatter + scatter analog - total - scatter + nu-fission analog total - nu-scatter-1 + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -681,7 +681,7 @@ total - inverse-velocity + prompt-nu-fission tracklength @@ -689,54 +689,40 @@ total flux - tracklength + analog + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength + - total - prompt-nu-fission - analog + delayed-nu-fission + tracklength + total - flux - tracklength + delayed-nu-fission + analog - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - @@ -744,30 +730,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -775,14 +761,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat index 23a1fce0f..786ab8fec 100644 --- a/tests/test_mgxs_library_mesh/results_true.dat +++ b/tests/test_mgxs_library_mesh/results_true.dat @@ -118,18 +118,42 @@ 1 1 2 1 1 1 total 1.0 0.454973 2 2 1 1 1 1 total 1.0 0.146747 3 2 2 1 1 1 total 1.0 0.141824 - mesh 1 group in group out nuclide mean std. dev. - x y z -0 1 1 1 1 1 total 0.385281 0.140163 -1 1 2 1 1 1 total 0.381031 0.407858 -2 2 1 1 1 1 total 0.429729 0.130705 -3 2 2 1 1 1 total 0.373069 0.127649 - mesh 1 group in group out nuclide mean std. dev. - x y z -0 1 1 1 1 1 total 0.391249 0.172830 -1 1 2 1 1 1 total 0.366825 0.473935 -2 2 1 1 1 1 total 0.436538 0.175458 -3 2 2 1 1 1 total 0.380998 0.149007 + mesh 1 group in group out nuclide moment mean std. dev. + x y z +0 1 1 1 1 1 total P0 0.633490 0.135514 +1 1 1 1 1 1 total P1 0.245219 0.051009 +2 1 1 1 1 1 total P2 0.091493 0.017479 +3 1 1 1 1 1 total P3 0.013124 0.004906 +4 1 2 1 1 1 total P0 0.618705 0.392783 +5 1 2 1 1 1 total P1 0.232972 0.149703 +6 1 2 1 1 1 total P2 0.073396 0.049002 +7 1 2 1 1 1 total P3 -0.003195 0.010229 +8 2 1 1 1 1 total P0 0.686150 0.126578 +9 2 1 1 1 1 total P1 0.257252 0.047890 +10 2 1 1 1 1 total P2 0.094522 0.018315 +11 2 1 1 1 1 total P3 0.016676 0.005187 +12 2 2 1 1 1 total P0 0.619269 0.124057 +13 2 2 1 1 1 total P1 0.242153 0.048064 +14 2 2 1 1 1 total P2 0.087677 0.018646 +15 2 2 1 1 1 total P3 0.019785 0.014168 + mesh 1 group in group out nuclide moment mean std. dev. + x y z +0 1 1 1 1 1 total P0 0.638348 0.169129 +1 1 1 1 1 1 total P1 0.247099 0.064297 +2 1 1 1 1 1 total P2 0.092195 0.022758 +3 1 1 1 1 1 total P3 0.013224 0.005359 +4 1 2 1 1 1 total P0 0.588378 0.462704 +5 1 2 1 1 1 total P1 0.221552 0.175616 +6 1 2 1 1 1 total P2 0.069798 0.056753 +7 1 2 1 1 1 total P3 -0.003039 0.009829 +8 2 1 1 1 1 total P0 0.698373 0.171880 +9 2 1 1 1 1 total P1 0.261835 0.064773 +10 2 1 1 1 1 total P2 0.096206 0.024355 +11 2 1 1 1 1 total P3 0.016973 0.005960 +12 2 2 1 1 1 total P0 0.625643 0.146236 +13 2 2 1 1 1 total P1 0.244646 0.056797 +14 2 2 1 1 1 total P2 0.088580 0.021648 +15 2 2 1 1 1 total P3 0.019989 0.014515 mesh 1 group out nuclide mean std. dev. x y z 0 1 1 1 1 total 1.0 0.135958 diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat index 518663028..f99014ee2 100644 --- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat @@ -277,7 +277,7 @@ total - scatter + scatter-P0 analog @@ -285,7 +285,7 @@ total - nu-scatter + nu-scatter-P0 analog @@ -307,7 +307,7 @@ total - scatter + scatter-P3 analog @@ -328,23 +328,24 @@ - + total - scatter-1 + flux analog total - flux + nu-scatter analog + total - nu-scatter + nu-scatter-P3 analog @@ -360,51 +361,50 @@ total - nu-scatter + scatter analog - - + total - scatter + nu-fission analog total - nu-scatter-1 + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -417,31 +417,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -449,14 +435,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -464,7 +450,7 @@ delayed-nu-fission tracklength - + @@ -472,7 +458,7 @@ delayed-nu-fission analog - + @@ -480,30 +466,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -511,14 +497,14 @@ decay-rate tracklength - + total flux analog - + @@ -527,62 +513,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -601,14 +601,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -629,7 +629,7 @@ total - fission + nu-fission tracklength @@ -643,7 +643,7 @@ total - nu-fission + kappa-fission tracklength @@ -657,7 +657,7 @@ total - kappa-fission + scatter tracklength @@ -665,14 +665,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -684,8 +684,9 @@ + total - nu-scatter + scatter-P3 analog @@ -700,14 +701,15 @@ total - scatter-P3 + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -715,15 +717,14 @@ total - nu-scatter-P3 + scatter analog - total - nu-scatter + flux analog @@ -731,14 +732,15 @@ total - scatter + nu-fission analog + total - flux + scatter-P0 analog @@ -746,39 +748,39 @@ total - nu-fission + nu-scatter-P0 analog - - - - total - scatter - analog - - - - - - total - nu-scatter - analog - - total flux tracklength - + total scatter tracklength + + + + + total + scatter-P3 + analog + + + + + + total + nu-scatter + analog + @@ -790,113 +792,112 @@ - total - nu-scatter + flux analog - total - scatter + nu-scatter analog + total - scatter-1 + nu-scatter-P3 analog + total - flux + nu-scatter analog + total - nu-scatter + scatter analog - - + total - nu-scatter + nu-fission analog - total - nu-scatter + nu-fission analog - - + total - scatter + prompt-nu-fission analog total - nu-scatter-1 + prompt-nu-fission analog - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + total + prompt-nu-fission + analog + @@ -906,31 +907,33 @@ + total - prompt-nu-fission + delayed-nu-fission tracklength - + + total - flux + delayed-nu-fission analog - + total - prompt-nu-fission + delayed-nu-fission analog total - flux + nu-fission tracklength @@ -944,43 +947,12 @@ - + total delayed-nu-fission - analog + tracklength - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -988,14 +960,14 @@ decay-rate tracklength - + total flux analog - + @@ -1004,95 +976,123 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + + + + + total + fission + tracklength + total - absorption + flux tracklength total - flux + fission tracklength total - absorption + flux tracklength total - fission + nu-fission tracklength @@ -1106,7 +1106,7 @@ total - fission + kappa-fission tracklength @@ -1120,7 +1120,7 @@ total - nu-fission + scatter tracklength @@ -1128,28 +1128,29 @@ total flux - tracklength + analog total - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + total - scatter - tracklength + scatter-P3 + analog @@ -1161,15 +1162,17 @@ + total - nu-scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -1177,7 +1180,7 @@ total - scatter-P3 + scatter analog @@ -1192,7 +1195,7 @@ total - nu-scatter-P3 + nu-fission analog @@ -1200,7 +1203,7 @@ total - nu-scatter + scatter-P0 analog @@ -1208,7 +1211,7 @@ total - scatter + nu-scatter-P0 analog @@ -1216,22 +1219,21 @@ total flux - analog + tracklength - total - nu-fission - analog + scatter + tracklength total - scatter + scatter-P3 analog @@ -1245,23 +1247,23 @@ + total - flux - tracklength + scatter + analog total - scatter - tracklength + flux + analog - total - scatter + nu-scatter analog @@ -1269,7 +1271,7 @@ total - nu-scatter + nu-scatter-P3 analog @@ -1277,47 +1279,10 @@ total - scatter + nu-scatter analog - - - total - scatter-1 - analog - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter - analog - - @@ -1325,36 +1290,72 @@ scatter analog - - - - total - nu-scatter-1 - analog - - + total nu-fission analog - + total nu-fission analog - + total prompt-nu-fission analog + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + total prompt-nu-fission @@ -1368,49 +1369,6 @@ tracklength - - - total - inverse-velocity - tracklength - - - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - - - - total - flux - analog - - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - @@ -1418,7 +1376,7 @@ delayed-nu-fission tracklength - + @@ -1426,7 +1384,7 @@ delayed-nu-fission analog - + @@ -1434,14 +1392,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1449,7 +1407,7 @@ delayed-nu-fission tracklength - + @@ -1457,7 +1415,7 @@ delayed-nu-fission tracklength - + @@ -1465,14 +1423,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat index 430fb6a33..46cc07e31 100644 --- a/tests/test_mgxs_library_no_nuclides/results_true.dat +++ b/tests/test_mgxs_library_no_nuclides/results_true.dat @@ -82,16 +82,40 @@ 2 10000 1 2 total 0.002567 0.001256 1 10000 2 1 total 0.002242 0.002243 0 10000 2 2 total 0.997758 0.041053 - material group in group out nuclide mean std. dev. -3 10000 1 1 total 0.332987 0.037309 -2 10000 1 2 total 0.000995 0.000489 -1 10000 2 1 total 0.000887 0.000889 -0 10000 2 2 total 0.379757 0.030114 - material group in group out nuclide mean std. dev. -3 10000 1 1 total 0.332466 0.050882 -2 10000 1 2 total 0.000989 0.000837 -1 10000 2 1 total 0.000925 0.001602 -0 10000 2 2 total 0.396146 0.028718 + material group in group out nuclide moment mean std. dev. +12 10000 1 1 total P0 0.386423 0.036629 +13 10000 1 1 total P1 0.052170 0.007767 +14 10000 1 1 total P2 0.020185 0.003138 +15 10000 1 1 total P3 0.009533 0.002327 +8 10000 1 2 total P0 0.000995 0.000489 +9 10000 1 2 total P1 -0.000208 0.000150 +10 10000 1 2 total P2 -0.000104 0.000186 +11 10000 1 2 total P3 0.000236 0.000130 +4 10000 2 1 total P0 0.000887 0.000889 +5 10000 2 1 total P1 -0.000737 0.000738 +6 10000 2 1 total P2 0.000474 0.000475 +7 10000 2 1 total P3 -0.000165 0.000165 +0 10000 2 2 total P0 0.394772 0.029871 +1 10000 2 2 total P1 0.015813 0.004443 +2 10000 2 2 total P2 0.006113 0.010131 +3 10000 2 2 total P3 -0.010073 0.010037 + material group in group out nuclide moment mean std. dev. +12 10000 1 1 total P0 0.384199 0.050401 +13 10000 1 1 total P1 0.051870 0.009043 +14 10000 1 1 total P2 0.020069 0.003612 +15 10000 1 1 total P3 0.009478 0.002468 +8 10000 1 2 total P0 0.000989 0.000837 +9 10000 1 2 total P1 -0.000207 0.000207 +10 10000 1 2 total P2 -0.000103 0.000198 +11 10000 1 2 total P3 0.000234 0.000207 +4 10000 2 1 total P0 0.000925 0.001602 +5 10000 2 1 total P1 -0.000768 0.001330 +6 10000 2 1 total P2 0.000494 0.000856 +7 10000 2 1 total P3 -0.000171 0.000297 +0 10000 2 2 total P0 0.411465 0.028459 +1 10000 2 2 total P1 0.016482 0.004603 +2 10000 2 2 total P2 0.006371 0.010557 +3 10000 2 2 total P3 -0.010499 0.010456 material group out nuclide mean std. dev. 1 10000 1 total 1.0 0.046071 0 10000 2 total 0.0 0.000000 @@ -270,16 +294,40 @@ 2 10001 1 2 total 0.0 0.000000 1 10001 2 1 total 0.0 0.000000 0 10001 2 2 total 1.0 0.142427 - material group in group out nuclide mean std. dev. -3 10001 1 1 total 0.270707 0.038266 -2 10001 1 2 total 0.000000 0.000000 -1 10001 2 1 total 0.000000 0.000000 -0 10001 2 2 total 0.306542 0.052728 - material group in group out nuclide mean std. dev. -3 10001 1 1 total 0.271891 0.059073 -2 10001 1 2 total 0.000000 0.000000 -1 10001 2 1 total 0.000000 0.000000 -0 10001 2 2 total 0.307478 0.075767 + material group in group out nuclide moment mean std. dev. +12 10001 1 1 total P0 0.312163 0.037253 +13 10001 1 1 total P1 0.038481 0.008743 +14 10001 1 1 total P2 0.020882 0.004835 +15 10001 1 1 total P3 0.008017 0.003776 +8 10001 1 2 total P0 0.000000 0.000000 +9 10001 1 2 total P1 0.000000 0.000000 +10 10001 1 2 total P2 0.000000 0.000000 +11 10001 1 2 total P3 0.000000 0.000000 +4 10001 2 1 total P0 0.000000 0.000000 +5 10001 2 1 total P1 0.000000 0.000000 +6 10001 2 1 total P2 0.000000 0.000000 +7 10001 2 1 total P3 0.000000 0.000000 +0 10001 2 2 total P0 0.295421 0.050236 +1 10001 2 2 total P1 -0.011182 0.016162 +2 10001 2 2 total P2 0.008811 0.011495 +3 10001 2 2 total P3 -0.003261 0.007313 + material group in group out nuclide moment mean std. dev. +12 10001 1 1 total P0 0.310121 0.058461 +13 10001 1 1 total P1 0.038230 0.010323 +14 10001 1 1 total P2 0.020745 0.005677 +15 10001 1 1 total P3 0.007964 0.003928 +8 10001 1 2 total P0 0.000000 0.000000 +9 10001 1 2 total P1 0.000000 0.000000 +10 10001 1 2 total P2 0.000000 0.000000 +11 10001 1 2 total P3 0.000000 0.000000 +4 10001 2 1 total P0 0.000000 0.000000 +5 10001 2 1 total P1 0.000000 0.000000 +6 10001 2 1 total P2 0.000000 0.000000 +7 10001 2 1 total P3 0.000000 0.000000 +0 10001 2 2 total P0 0.296264 0.074019 +1 10001 2 2 total P1 -0.011214 0.016337 +2 10001 2 2 total P2 0.008837 0.011641 +3 10001 2 2 total P3 -0.003270 0.007358 material group out nuclide mean std. dev. 1 10001 1 total 0.0 0.0 0 10001 2 total 0.0 0.0 @@ -458,16 +506,40 @@ 2 10002 1 2 total 0.046729 0.002547 1 10002 2 1 total 0.000218 0.000219 0 10002 2 2 total 0.999782 0.135885 - material group in group out nuclide mean std. dev. -3 10002 1 1 total 0.251506 0.041807 -2 10002 1 2 total 0.031023 0.002232 -1 10002 2 1 total 0.000440 0.000445 -0 10002 2 2 total 1.479235 0.355392 - material group in group out nuclide mean std. dev. -3 10002 1 1 total 0.258652 0.045642 -2 10002 1 2 total 0.031368 0.002988 -1 10002 2 1 total 0.000443 0.000771 -0 10002 2 2 total 1.482300 0.471763 + material group in group out nuclide moment mean std. dev. +12 10002 1 1 total P0 0.632859 0.038142 +13 10002 1 1 total P1 0.376973 0.023715 +14 10002 1 1 total P2 0.150715 0.010664 +15 10002 1 1 total P3 0.009047 0.003868 +8 10002 1 2 total P0 0.031023 0.002232 +9 10002 1 2 total P1 0.008661 0.000999 +10 10002 1 2 total P2 -0.002540 0.001010 +11 10002 1 2 total P3 -0.003743 0.000826 +4 10002 2 1 total P0 0.000440 0.000445 +5 10002 2 1 total P1 0.000397 0.000401 +6 10002 2 1 total P2 0.000317 0.000321 +7 10002 2 1 total P3 0.000212 0.000215 +0 10002 2 2 total P0 2.020256 0.352194 +1 10002 2 2 total P1 0.506260 0.079140 +2 10002 2 2 total P2 0.110372 0.018488 +3 10002 2 2 total P3 0.024808 0.008771 + material group in group out nuclide moment mean std. dev. +12 10002 1 1 total P0 0.639901 0.042639 +13 10002 1 1 total P1 0.381167 0.026312 +14 10002 1 1 total P2 0.152392 0.011619 +15 10002 1 1 total P3 0.009148 0.003920 +8 10002 1 2 total P0 0.031368 0.002988 +9 10002 1 2 total P1 0.008758 0.001149 +10 10002 1 2 total P2 -0.002568 0.001033 +11 10002 1 2 total P3 -0.003785 0.000868 +4 10002 2 1 total P0 0.000443 0.000771 +5 10002 2 1 total P1 0.000400 0.000696 +6 10002 2 1 total P2 0.000320 0.000556 +7 10002 2 1 total P3 0.000214 0.000372 +0 10002 2 2 total P0 2.034945 0.468587 +1 10002 2 2 total P1 0.509940 0.110635 +2 10002 2 2 total P2 0.111175 0.025030 +3 10002 2 2 total P3 0.024988 0.009601 material group out nuclide mean std. dev. 1 10002 1 total 0.0 0.0 0 10002 2 total 0.0 0.0 diff --git a/tests/test_mgxs_library_nuclides/inputs_true.dat b/tests/test_mgxs_library_nuclides/inputs_true.dat index 2fa360ede..6ee483a57 100644 --- a/tests/test_mgxs_library_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_nuclides/inputs_true.dat @@ -277,7 +277,7 @@ U234 U235 U238 O16 - scatter + scatter-P0 analog @@ -285,7 +285,7 @@ U234 U235 U238 O16 - nu-scatter + nu-scatter-P0 analog @@ -307,7 +307,7 @@ U234 U235 U238 O16 - scatter + scatter-P3 analog @@ -327,26 +327,27 @@ analog - - - U234 U235 U238 O16 - scatter-1 - analog - - total flux analog - + U234 U235 U238 O16 nu-scatter analog + + + + + U234 U235 U238 O16 + nu-scatter-P3 + analog + @@ -360,51 +361,50 @@ U234 U235 U238 O16 - nu-scatter + scatter analog - - + U234 U235 U238 O16 - scatter + nu-fission analog U234 U235 U238 O16 - nu-scatter-1 + nu-fission analog U234 U235 U238 O16 - nu-fission + prompt-nu-fission analog U234 U235 U238 O16 - nu-fission + prompt-nu-fission analog - - U234 U235 U238 O16 - prompt-nu-fission - analog + + total + flux + tracklength - + U234 U235 U238 O16 - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -417,31 +417,17 @@ U234 U235 U238 O16 - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - U234 U235 U238 O16 - prompt-nu-fission - tracklength - - total flux analog - + @@ -449,62 +435,76 @@ prompt-nu-fission analog + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + total + tracklength + total flux - tracklength + analog Zr90 Zr91 Zr92 Zr94 Zr96 total - tracklength + analog - - - total - flux - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - analog - - Zr90 Zr91 Zr92 Zr94 Zr96 scatter-1 analog - + total flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 total analog - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-scatter-1 analog + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption + tracklength + @@ -522,15 +522,15 @@ - total - flux + Zr90 Zr91 Zr92 Zr94 Zr96 + fission tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - absorption + total + flux tracklength @@ -551,7 +551,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - fission + nu-fission tracklength @@ -565,7 +565,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + kappa-fission tracklength @@ -579,7 +579,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - kappa-fission + scatter tracklength @@ -587,14 +587,14 @@ total flux - tracklength + analog Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - tracklength + nu-scatter + analog @@ -606,8 +606,9 @@ + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + scatter-P3 analog @@ -622,14 +623,15 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 + nu-scatter-P3 analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter analog @@ -637,15 +639,14 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P3 + scatter analog - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + total + flux analog @@ -653,14 +654,15 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-fission analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-P0 analog @@ -668,39 +670,39 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + nu-scatter-P0 analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - analog - - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter - analog - - total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-P3 + analog + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter + analog + @@ -712,231 +714,229 @@ - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + total + flux analog - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-scatter analog + Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-1 + nu-scatter-P3 analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter analog + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + scatter analog - - + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + nu-fission analog - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + nu-fission analog - - + Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + prompt-nu-fission analog Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-1 + prompt-nu-fission analog - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 inverse-velocity tracklength - + total flux tracklength + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog + + + + + total + flux + tracklength + - + - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + H1 O16 B10 B11 + total tracklength - + total flux analog - + - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + H1 O16 B10 B11 + total analog - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - total - tracklength - - - - - total - flux - analog - - - - - H1 O16 B10 B11 - total - analog - - H1 O16 B10 B11 scatter-1 analog - + total flux analog - + H1 O16 B10 B11 total analog - + H1 O16 B10 B11 nu-scatter-1 analog - + total flux tracklength + + + + H1 O16 B10 B11 + absorption + tracklength + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + absorption + tracklength + + + + + H1 O16 B10 B11 + fission + tracklength + - H1 O16 B10 B11 - absorption + total + flux tracklength - total - flux + H1 O16 B10 B11 + fission tracklength - H1 O16 B10 B11 - absorption + total + flux tracklength H1 O16 B10 B11 - fission + nu-fission tracklength @@ -950,7 +950,7 @@ H1 O16 B10 B11 - fission + kappa-fission tracklength @@ -964,7 +964,7 @@ H1 O16 B10 B11 - nu-fission + scatter tracklength @@ -972,28 +972,29 @@ total flux - tracklength + analog H1 O16 B10 B11 - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + H1 O16 B10 B11 - scatter - tracklength + scatter-P3 + analog @@ -1005,15 +1006,17 @@ + H1 O16 B10 B11 - nu-scatter + nu-scatter-P3 analog - total - flux + + H1 O16 B10 B11 + nu-scatter analog @@ -1021,7 +1024,7 @@ H1 O16 B10 B11 - scatter-P3 + scatter analog @@ -1036,7 +1039,7 @@ H1 O16 B10 B11 - nu-scatter-P3 + nu-fission analog @@ -1044,7 +1047,7 @@ H1 O16 B10 B11 - nu-scatter + scatter-P0 analog @@ -1052,7 +1055,7 @@ H1 O16 B10 B11 - scatter + nu-scatter-P0 analog @@ -1060,22 +1063,21 @@ total flux - analog + tracklength - H1 O16 B10 B11 - nu-fission - analog + scatter + tracklength H1 O16 B10 B11 - scatter + scatter-P3 analog @@ -1089,23 +1091,23 @@ - total - flux - tracklength + + H1 O16 B10 B11 + scatter + analog - H1 O16 B10 B11 - scatter - tracklength + total + flux + analog - H1 O16 B10 B11 - scatter + nu-scatter analog @@ -1113,7 +1115,7 @@ H1 O16 B10 B11 - nu-scatter + nu-scatter-P3 analog @@ -1121,47 +1123,10 @@ H1 O16 B10 B11 - scatter + nu-scatter analog - - - H1 O16 B10 B11 - scatter-1 - analog - - - - - total - flux - analog - - - - - H1 O16 B10 B11 - nu-scatter - analog - - - - - - H1 O16 B10 B11 - nu-scatter - analog - - - - - - H1 O16 B10 B11 - nu-scatter - analog - - @@ -1169,77 +1134,70 @@ scatter analog - - - - H1 O16 B10 B11 - nu-scatter-1 - analog - - + H1 O16 B10 B11 nu-fission analog - + H1 O16 B10 B11 nu-fission analog - + H1 O16 B10 B11 prompt-nu-fission analog - + H1 O16 B10 B11 prompt-nu-fission analog - + total flux tracklength - + H1 O16 B10 B11 inverse-velocity tracklength - + total flux tracklength - + H1 O16 B10 B11 prompt-nu-fission tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_nuclides/results_true.dat b/tests/test_mgxs_library_nuclides/results_true.dat index 73f40d67d..427a9f3b0 100644 --- a/tests/test_mgxs_library_nuclides/results_true.dat +++ b/tests/test_mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -5c57e011264efb348fa333166e42da34f564feb2c2507f89c72fadb1056ed871e251911800fe3976cac9c66fa456edb63ee3bc0c4a40d8d82abe2c58c6cc3128 \ No newline at end of file +98b6de0cd546baf457c878d9695806ed53d1af1f380e164d1803041947346a54830aef4a30eab1d261abce700a4f45e2f81d6e5f78c124110c0f60601161cf9b \ No newline at end of file From 671a9cf693be3c2d404fcc0909c25deb10256f86 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 2 Mar 2017 10:14:40 -0500 Subject: [PATCH 23/40] Revised equations for consistent scattering matrix --- docs/source/pythonapi/index.rst | 1 + openmc/mgxs/mgxs.py | 55 ++++++++++++++------------------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/docs/source/pythonapi/index.rst b/docs/source/pythonapi/index.rst index 8b4b0b154..e622fb265 100644 --- a/docs/source/pythonapi/index.rst +++ b/docs/source/pythonapi/index.rst @@ -287,6 +287,7 @@ Multi-group Cross Sections openmc.mgxs.MGXS openmc.mgxs.AbsorptionXS openmc.mgxs.CaptureXS + openmc.mgxs.ConsistentScatterMatrixXS openmc.mgxs.Chi openmc.mgxs.FissionXS openmc.mgxs.InverseVelocity diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index df6117794..0509de8bd 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4579,24 +4579,13 @@ class ScatterProbabilityMatrix(MatrixMGXS): \int_{E_g}^{E_{g-1}} dE \; P_\ell (\Omega \cdot \Omega') \sigma_{s} (r, E' \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ - \langle \sigma_{s,g'} \phi \rangle &= \int_{r \in V} dr + \langle \sigma_{s,0,g'} \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega \int_{0}^{\infty} dE \; \sigma_s (r, E' \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ - P_{s,g'\rightarrow g} &= \frac{\langle - \sigma_{s,g'\rightarrow g} \phi \rangle}{\langle - \sigma_{s,g'} \phi \rangle} - - .. math:: - - \langle \sigma_{s,\ell,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr - \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega - \int_{E_g}^{E_{g-1}} dE \; P_\ell (\Omega \cdot \Omega') \sigma_s (r, E' - \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ - \langle \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega - \int_{E_g}^{E_{g-1}} dE \; \psi (r, E, \Omega) \\ - \sigma_{s,\ell,g'\rightarrow g} &= \frac{\langle - \sigma_{s,\ell,g'\rightarrow g} \phi \rangle}{\langle \phi \rangle} + P_{s,\ell,g'\rightarrow g} &= \frac{\langle + \sigma_{s,\ell,g'\rightarrow g} \phi \rangle}{\langle + \sigma_{s,0,g'} \phi \rangle} To incorporate the effect of neutron multiplication from (n,xn) reactions in the above probaility matrix, the `nu` parameter can be set to `True`. @@ -5750,17 +5739,17 @@ class ConvolvedMGXS(MGXS): class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): -#class ConsistentScatterMatrixXS(ScatterMatrixXS, ConvolvedMGXS): r"""A scattering matrix multi-group cross section computed as the product of the scatter cross section and group-to-group scattering probabilities. This class is a variation of the :class:`ScatterMatrixXS` which computes the scattering matrix as the convolution product of :class:`ScatterXS` and - :class:`ScatterProbabilityMatrix`. Unlike the :class:`ScatterMatrixXS`, - this scattering matrix is computed from the scattering cross section which - uses a tracklength estimator. This ensures that reaction rate balance is - exactly preserved with a :class:`TotalXS` computed using a tracklength - estimator. + :class:`ScatterProbabilityMatrix`, and :class:`MultiplicityMatrix` if + multiplication from scattering multiplication is considered (optional). + Unlike the :class:`ScatterMatrixXS`, this scattering matrix is computed + from the scattering cross section which uses a tracklength estimator. + This ensures that reaction rate balance is exactly preserved with a + :class:`TotalXS` computed using a tracklength estimator. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated @@ -5778,20 +5767,24 @@ class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): can then be obtained from the :attr:`ConsistentScatterMatrixXS.xs_tally` property. - For a spatial domain :math:`V`, incoming energy group - :math:`[E_{g'},E_{g'-1}]`, and outgoing energy group :math:`[E_g,E_{g-1}]`, + For a scattering probability matrix :math:`P_{s,\ell,g'\rightarrow g}` and + scattering cross section :math:`\sigma_s (r, E)` for incoming energy group + :math:`[E_{g'},E_{g'-1}]` and outgoing energy group :math:`[E_g,E_{g-1}]`, the Legendre scattering moments are calculated as: .. math:: - \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr - \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega - \int_{E_g}^{E_{g-1}} dE \; \sigma_s (r, E' - \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ - \langle \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega - \int_{E_g}^{E_{g-1}} dE \; \psi (r, E, \Omega) \\ - \sigma_{s,g'\rightarrow g} &= \frac{\langle - \sigma_{s,,g'\rightarrow g} \phi \rangle}{\langle \phi \rangle} + \sigma_{s,\ell,g'\rightarrow g} = \sigma_s (r, E) \times + P_{s,\ell,g'\rightarrow g} + + To incorporate the effect of neutron multiplication from (n,xn) reactions + in the above scattering matrix, the `nu` parameter can be set to `True` + such that the Legendre scattering moments are calculated as: + + .. math:: + + \sigma_{s,\ell,g'\rightarrow g} = \upsilon_{g'\rightarrow g} \times + \sigma_s (r, E) \times P_{s,\ell,g'\rightarrow g} Parameters ---------- From 604bfbfbe13fad210779fe19cad3dd15f20e3e42 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 2 Mar 2017 17:02:08 -0500 Subject: [PATCH 24/40] Added formulation property to ScatterMatrixXS --- openmc/mgxs/mgxs.py | 314 ++++++-- openmc/statepoint.py | 1 - .../inputs_true.dat | 678 ++++++++---------- .../results_true.dat | 24 +- .../inputs_true.dat | 110 ++- .../results_true.dat | 8 +- tests/test_mgxs_library_hdf5/inputs_true.dat | 678 ++++++++---------- tests/test_mgxs_library_hdf5/results_true.dat | 40 +- tests/test_mgxs_library_mesh/inputs_true.dat | 110 ++- tests/test_mgxs_library_mesh/results_true.dat | 32 +- .../inputs_true.dat | 678 ++++++++---------- .../results_true.dat | 80 +-- .../inputs_true.dat | 598 +++++++-------- .../results_true.dat | 2 +- 14 files changed, 1663 insertions(+), 1690 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 0509de8bd..aa2afb8cf 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -482,12 +482,18 @@ class MGXS(object): else: domain_filter = filter_type(self.domain.id) + if isinstance(self.estimator, str): + estimators = [self.estimator] * len(self.scores) + else: + estimators = self.estimator + # Create each Tally needed to compute the multi group cross section - tally_metadata = zip(self.scores, self.tally_keys, self.filters) - for score, key, filters in tally_metadata: + tally_metadata = \ + zip(self.scores, self.tally_keys, self.filters, estimators) + for score, key, filters, estimator in tally_metadata: self._tallies[key] = openmc.Tally(name=self.name) self._tallies[key].scores = [score] - self._tallies[key].estimator = self.estimator + self._tallies[key].estimator = estimator self._tallies[key].filters = [domain_filter] # If a tally trigger was specified, add it to each tally @@ -735,10 +741,11 @@ class MGXS(object): mgxs = ScatterProbabilityMatrix( domain, domain_type, energy_groups, nu=True) elif mgxs_type == 'consistent scatter matrix': - mgxs = ConsistentScatterMatrixXS(domain, domain_type, energy_groups) + mgxs = ScatterMatrixXS(domain, domain_type, energy_groups) + mgxs.formulation = 'consistent' elif mgxs_type == 'consistent nu-scatter matrix': - mgxs = ConsistentScatterMatrixXS( - domain, domain_type, energy_groups, nu=True) + mgxs = ScatterMatrixXS(domain, domain_type, energy_groups, nu=True) + mgxs.formulation = 'consistent' elif mgxs_type == 'nu-fission matrix': mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'chi': @@ -3545,6 +3552,8 @@ class ScatterMatrixXS(MatrixMGXS): To incorporate the effect of neutron multiplication from (n,xn) reactions in the above relation, the `nu` parameter can be set to `True`. + # FIXME: Add equations to reflect alternative formulation + Parameters ---------- domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh @@ -3570,6 +3579,16 @@ class ScatterMatrixXS(MatrixMGXS): Attributes ---------- + formulation : 'simple' or 'consistent' + The calculation approach to use ('simple' by default). The 'simple' + formulation simply divides the group-to-group scattering rates by + the groupwise flux, each computed from analog tally estimators. The + 'consistent' formulation multiplies the groupwise scattering rates + by the group-to-group scatter probability matrix, the former computed + from tracklength tallies and the latter computed from analog tallies. + The 'consistent' formulation is designed to better conserve reaction + rate balance with the total and absorption cross sections computed + using tracklength tally estimators. correction : 'P0' or None Apply the P0 correction to scattering matrices if set to 'P0'; this is used only if :attr:`ScatterMatrixXS.scatter_format` is 'legendre' @@ -3655,6 +3674,7 @@ class ScatterMatrixXS(MatrixMGXS): super(ScatterMatrixXS, self).__init__(domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) + self._formulation = 'simple' self._correction = 'P0' self._scatter_format = 'legendre' self._legendre_order = 0 @@ -3665,6 +3685,7 @@ class ScatterMatrixXS(MatrixMGXS): def __deepcopy__(self, memo): clone = super(ScatterMatrixXS, self).__deepcopy__(memo) + clone._formulation = self.formulation clone._correction = self.correction clone._scatter_format = self.scatter_format clone._legendre_order = self.legendre_order @@ -3689,8 +3710,8 @@ class ScatterMatrixXS(MatrixMGXS): return (1, 2) @property - def nu(self): - return self._nu + def formulation(self): + return self._formulation @property def correction(self): @@ -3709,35 +3730,122 @@ class ScatterMatrixXS(MatrixMGXS): return self._histogram_bins @property - def scores(self): - scores = ['flux'] + def nu(self): + return self._nu - if self.scatter_format == 'legendre': - if self.correction == 'P0' and self.legendre_order == 0: - scores += ['{}-0'.format(self.rxn_type), - '{}-1'.format(self.rxn_type)] + @property + def scores(self): + + if self.formulation == 'simple': + scores = ['flux'] + + if self.scatter_format == 'legendre': + if self.legendre_order == 0: + scores.append('{}-0'.format(self.rxn_type)) + if self.correction: + scores.append('{}-1'.format(self.rxn_type)) + else: + scores.append('{}-P{}'.format(self.rxn_type, self.legendre_order)) + elif self.scatter_format == 'histogram': + scores += [self.rxn_type] + + else: + # Add scores for groupwise scattering cross section + scores = ['flux', 'scatter'] + + # Add scores for group-to-group scattering probability matrix + if self.legendre_order == 0: + scores.append('scatter-0') else: - scores += ['{}-P{}'.format(self.rxn_type, self.legendre_order)] - elif self.scatter_format == 'histogram': - scores += [self.rxn_type] + scores.append('scatter-P{}'.format(self.legendre_order)) + + # Add scores for multiplicity matrix + if self.nu: + scores.extend(['nu-scatter-0', 'scatter-0']) + + # Add scores for transport correction + if self.correction == 'P0' and self.legendre_order == 0: + scores.extend(['{}-1'.format(self.rxn_type), 'flux']) return scores @property - def filters(self): - group_edges = self.energy_groups.group_edges - energy = openmc.EnergyFilter(group_edges) - energyout = openmc.EnergyoutFilter(group_edges) + def tally_keys(self): + if self.formulation == 'simple': + return super(ScatterMatrixXS, self).tally_keys + else: + # Add keys for groupwise scattering cross section + tally_keys = ['flux (tracklength)', 'scatter'] - if self.scatter_format == 'legendre': + # Add keys for group-to-group scattering probability matrix + tally_keys.append('scatter-P{}'.format(self.legendre_order)) + + # Add keys for multiplicity matrix + if self.nu: + tally_keys.extend(['nu-scatter-0', 'scatter-0']) + + # Add keys for transport correction if self.correction == 'P0' and self.legendre_order == 0: - filters = [[energy], [energy, energyout], [energyout]] - else: - filters = [[energy], [energy, energyout]] - elif self.scatter_format == 'histogram': - bins = np.linspace(-1., 1., num=self.histogram_bins + 1, - endpoint=True) - filters = [[energy], [energy, energyout, openmc.MuFilter(bins)]] + tally_keys.extend(['{}-1'.format(self.rxn_type), 'flux (analog)']) + + return tally_keys + + @property + def estimator(self): + if self.formulation == 'simple': + return self._estimator + else: + # Add estimators for groupwise scattering cross section + estimators = ['tracklength', 'tracklength'] + + # Add estimators for group-to-group scattering probabilities + estimators.append('analog') + + # Add estimators for multiplicity matrix + if self.nu: + estimators.extend(['analog', 'analog']) + + # Add estimators for transport correction + if self.correction == 'P0' and self.legendre_order == 0: + estimators.extend(['analog', 'analog']) + + return estimators + + @property + def filters(self): + if self.formulation == 'simple': + group_edges = self.energy_groups.group_edges + energy = openmc.EnergyFilter(group_edges) + energyout = openmc.EnergyoutFilter(group_edges) + + if self.scatter_format == 'legendre': + if self.correction == 'P0' and self.legendre_order == 0: + filters = [[energy], [energy, energyout], [energyout]] + else: + filters = [[energy], [energy, energyout]] + elif self.scatter_format == 'histogram': + bins = np.linspace(-1., 1., num=self.histogram_bins + 1, + endpoint=True) + filters = [[energy], [energy, energyout, openmc.MuFilter(bins)]] + + else: + group_edges = self.energy_groups.group_edges + energy = openmc.EnergyFilter(group_edges) + energyout = openmc.EnergyoutFilter(group_edges) + + # Groupwise scattering cross section + filters = [[energy], [energy]] + + # Group-to-group scattering probability matrix + filters.extend([[energy, energyout], [energy, energyout]]) + + # Multiplicity matrix + if self.nu: + filters.append([energy, energyout]) + + # Add filters for transport correction + if self.correction == 'P0' and self.legendre_order == 0: + filters.append([[energyout]]) return self._add_angle_filters(filters) @@ -3745,39 +3853,128 @@ class ScatterMatrixXS(MatrixMGXS): def rxn_rate_tally(self): if self._rxn_rate_tally is None: - if self.scatter_format == 'legendre': - # If using P0 correction subtract scatter-1 from the diagonal - if self.correction == 'P0' and self.legendre_order == 0: - scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)] - scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] - energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) - energy_filter = copy.deepcopy(energy_filter) - scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) - self._rxn_rate_tally = scatter_p0 - scatter_p1 - # Extract scattering moment reaction rate Tally - else: - tally_key = '{}-P{}'.format(self.rxn_type, - self.legendre_order) - self._rxn_rate_tally = self.tallies[tally_key] - elif self.scatter_format == 'histogram': - # Extract scattering rate distribution tally - self._rxn_rate_tally = self.tallies[self.rxn_type] + if self.formulation == 'simple': + if self.scatter_format == 'legendre': + # If using P0 correction subtract scatter-1 from the diagonal + if self.correction == 'P0' and self.legendre_order == 0: + scatter_p0 = self.tallies['{}-0'.format(self.rxn_type)] + scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] + energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) + energy_filter = copy.deepcopy(energy_filter) + scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) + self._rxn_rate_tally = scatter_p0 - scatter_p1 - self._rxn_rate_tally.sparse = self.sparse + # Extract scattering moment reaction rate Tally + elif self.legendre_order == 0: + tally_key = '{}-{}'.format(self.rxn_type, + self.legendre_order) + self._rxn_rate_tally = self.tallies[tally_key] + else: + tally_key = '{}-P{}'.format(self.rxn_type, + self.legendre_order) + self._rxn_rate_tally = self.tallies[tally_key] + elif self.scatter_format == 'histogram': + # Extract scattering rate distribution tally + self._rxn_rate_tally = self.tallies[self.rxn_type] + + self._rxn_rate_tally.sparse = self.sparse + + else: + msg = 'The reaction rate tally is poorly defined' \ + ' for the consistent formulation' + raise NotImplementedError(msg) return self._rxn_rate_tally + @property + def xs_tally(self): + if self._xs_tally is None: + if self.tallies is None: + msg = 'Unable to get xs_tally since tallies have ' \ + 'not been loaded from a statepoint' + raise ValueError(msg) + + # Use super class method + if self.formulation == 'simple': + self._xs_tally = MGXS.xs_tally.fget(self) + + else: + # Compute groupwise scattering cross section + self._xs_tally = self.tallies['scatter'] / \ + self.tallies['flux (tracklength)'] + + # Compute scattering probability matrix + energyout_bins = [self.energy_groups.get_group_bounds(i) + for i in range(self.num_groups, 0, -1)] + tally_key = 'scatter-P{}'.format(self.legendre_order) + norm = self.tallies[tally_key].get_slice(scores=['scatter-0']) + norm = norm.summation( + filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) + + # Remove the AggregateFilter summed across energyout bins + norm._filters = norm._filters[:2] + + # Multiply by the group-to-group probability matrix + self._xs_tally *= (self.tallies[tally_key] / norm) + + # Multiply by the multiplicity matrix + if self.nu: + numer = self.tallies['nu-scatter-0'] + denom = self.tallies['scatter-0'] + self._xs_tally *= (numer / denom) + + # If using P0 correction subtract scatter-1 from the diagonal + if self.correction == 'P0' and self.legendre_order == 0: + flux = self.tallies['flux (analog)'] + scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] + + energy_filter = flux.find_filter(openmc.EnergyFilter) + energy_filter = copy.deepcopy(energy_filter) + scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) + self._xs_tally -= (scatter_p1 / flux) + + self._compute_xs() + + return self._xs_tally + @nu.setter def nu(self, nu): cv.check_type('nu', nu, bool) self._nu = nu - if not nu: - self._rxn_type = 'scatter' - self._hdf5_key = 'scatter matrix' + + if self.formulation == 'simple': + if not nu: + self._rxn_type = 'scatter' + self._hdf5_key = 'scatter matrix' + else: + self._rxn_type = 'nu-scatter' + self._hdf5_key = 'nu-scatter matrix' else: - self._rxn_type = 'nu-scatter' - self._hdf5_key = 'nu-scatter matrix' + if not nu: + self._rxn_type = 'scatter' + self._hdf5_key = 'consistent scatter matrix' + else: + self._rxn_type = 'nu-scatter' + self._hdf5_key = 'consistent nu-scatter matrix' + + @formulation.setter + def formulation(self, formulation): + cv.check_value('formulation', formulation, ('simple', 'consistent')) + self._formulation = formulation + + if self.formulation == 'simple': + self._valid_estimators = ['analog'] + if not self.nu: + self._hdf5_key = 'scatter matrix' + else: + self._hdf5_key = 'nu-scatter matrix' + else: + self._valid_estimators = ['tracklength'] + if not self.nu: + self._hdf5_key = 'consistent scatter matrix' + else: + self._hdf5_key = 'consistent nu-scatter matrix' @correction.setter def correction(self, correction): @@ -3862,11 +4059,12 @@ class ScatterMatrixXS(MatrixMGXS): if self.scatter_format == 'legendre': # Expand scores to match the format in the statepoint # e.g., "scatter-P2" -> "scatter-0", "scatter-1", "scatter-2" - if self.correction != 'P0' or self.legendre_order != 0: - tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) - self.tallies[tally_key].scores = \ - [self.rxn_type + '-{}'.format(i) - for i in range(self.legendre_order + 1)] + for tally_key, tally in self.tallies.items(): + if 'scatter-P' in tally.scores[0]: + score_prefix = tally.scores[0].split('P')[0] + self.tallies[tally_key].scores = \ + [score_prefix + '{}'.format(i) + for i in range(self.legendre_order + 1)] elif self.scatter_format == 'histogram': self.tallies[self.rxn_type].scores = [self.rxn_type] @@ -4792,7 +4990,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] - # Compute the group-to-group probailities + # Compute the group-to-group probabilities tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) self._xs_tally = self.tallies[tally_key] / norm super(ScatterProbabilityMatrix, self)._compute_xs() diff --git a/openmc/statepoint.py b/openmc/statepoint.py index 4101b066a..8b3be9241 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -1,4 +1,3 @@ -import sys import re import os import warnings diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat index f99014ee2..b4498e9d8 100644 --- a/tests/test_mgxs_library_condense/inputs_true.dat +++ b/tests/test_mgxs_library_condense/inputs_true.dat @@ -313,31 +313,31 @@ - total - nu-scatter - analog + flux + tracklength - total scatter - analog + tracklength + total - flux + scatter-P3 analog + total - nu-scatter + nu-scatter-0 analog @@ -345,52 +345,50 @@ total - nu-scatter-P3 + scatter-0 analog - - + total - nu-scatter + nu-fission analog - total - scatter + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -403,31 +401,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -435,14 +419,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -450,7 +434,7 @@ delayed-nu-fission tracklength - + @@ -458,7 +442,7 @@ delayed-nu-fission analog - + @@ -466,30 +450,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -497,14 +481,14 @@ decay-rate tracklength - + total flux analog - + @@ -513,62 +497,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -587,14 +585,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -615,7 +613,7 @@ total - fission + nu-fission tracklength @@ -629,7 +627,7 @@ total - nu-fission + kappa-fission tracklength @@ -643,7 +641,7 @@ total - kappa-fission + scatter tracklength @@ -651,14 +649,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -670,8 +668,9 @@ + total - nu-scatter + scatter-P3 analog @@ -686,14 +685,15 @@ total - scatter-P3 + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -701,33 +701,17 @@ total - nu-scatter-P3 + scatter analog - total - nu-scatter + flux analog - - - - total - scatter - analog - - - - - total - flux - analog - - @@ -735,7 +719,7 @@ nu-fission analog - + @@ -743,7 +727,7 @@ scatter-P0 analog - + @@ -751,21 +735,21 @@ nu-scatter-P0 analog - + total flux tracklength - + total scatter tracklength - + @@ -773,12 +757,26 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + total - nu-scatter + scatter-P3 analog @@ -786,88 +784,87 @@ total - scatter + nu-scatter-0 analog + total - flux + scatter-0 analog - + total - nu-scatter + nu-fission analog - total - nu-scatter-P3 + nu-fission analog - - + total - nu-scatter + prompt-nu-fission analog - total - scatter + prompt-nu-fission analog - + total - nu-fission - analog + flux + tracklength - + total - nu-fission - analog + inverse-velocity + tracklength - + total - prompt-nu-fission - analog + flux + tracklength - + total prompt-nu-fission - analog + tracklength total flux - tracklength + analog + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -878,31 +875,33 @@ + total - prompt-nu-fission + delayed-nu-fission tracklength - + + total - flux + delayed-nu-fission analog - + total - prompt-nu-fission + delayed-nu-fission analog total - flux + nu-fission tracklength @@ -916,43 +915,12 @@ - + total delayed-nu-fission - analog + tracklength - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -960,14 +928,14 @@ decay-rate tracklength - + total flux analog - + @@ -976,95 +944,123 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + + + + + total + fission + tracklength + total - absorption + flux tracklength total - flux + fission tracklength total - absorption + flux tracklength total - fission + nu-fission tracklength @@ -1078,7 +1074,7 @@ total - fission + kappa-fission tracklength @@ -1092,7 +1088,7 @@ total - nu-fission + scatter tracklength @@ -1100,28 +1096,29 @@ total flux - tracklength + analog total - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + total - scatter - tracklength + scatter-P3 + analog @@ -1133,15 +1130,17 @@ + total - nu-scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -1149,7 +1148,7 @@ total - scatter-P3 + scatter analog @@ -1164,7 +1163,7 @@ total - nu-scatter-P3 + nu-fission analog @@ -1172,7 +1171,7 @@ total - nu-scatter + scatter-P0 analog @@ -1180,55 +1179,24 @@ total - scatter + nu-scatter-P0 analog - - - total - flux - analog - - - - - - total - nu-fission - analog - - - - - - total - scatter-P0 - analog - - - - - - total - nu-scatter-P0 - analog - - total flux tracklength - + total scatter tracklength - + @@ -1236,83 +1204,110 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + + + + + total + nu-scatter-0 + analog + total - nu-scatter + scatter-0 analog - - - - total - scatter - analog - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter-P3 - analog - - - - - - total - nu-scatter - analog - - - - - - total - scatter - analog - - total nu-fission analog - + total nu-fission analog - + total prompt-nu-fission analog + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + total prompt-nu-fission @@ -1326,49 +1321,6 @@ tracklength - - - total - inverse-velocity - tracklength - - - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - - - - total - flux - analog - - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - @@ -1376,7 +1328,7 @@ delayed-nu-fission tracklength - + @@ -1384,7 +1336,7 @@ delayed-nu-fission analog - + @@ -1392,14 +1344,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1407,7 +1359,7 @@ delayed-nu-fission tracklength - + @@ -1415,7 +1367,7 @@ delayed-nu-fission tracklength - + @@ -1423,14 +1375,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat index bb84ee16a..d20a5ba0c 100644 --- a/tests/test_mgxs_library_condense/results_true.dat +++ b/tests/test_mgxs_library_condense/results_true.dat @@ -42,10 +42,10 @@ 2 10000 1 1 total P2 0.017957 0.003039 3 10000 1 1 total P3 0.006618 0.002480 material group in group out nuclide moment mean std. dev. -0 10000 1 1 total P0 0.389304 0.043096 -1 10000 1 1 total P1 0.046224 0.007316 -2 10000 1 1 total P2 0.017984 0.003336 -3 10000 1 1 total P3 0.006628 0.002534 +0 10000 1 1 total P0 0.388721 0.040482 +1 10000 1 1 total P1 0.046155 0.007097 +2 10000 1 1 total P2 0.017957 0.003262 +3 10000 1 1 total P3 0.006618 0.002518 material group out nuclide mean std. dev. 0 10000 1 total 1.0 0.046071 material group out nuclide mean std. dev. @@ -135,10 +135,10 @@ 2 10001 1 1 total P2 0.018997 0.004420 3 10001 1 1 total P3 0.006263 0.003364 material group in group out nuclide moment mean std. dev. -0 10001 1 1 total P0 0.307987 0.050720 -1 10001 1 1 total P1 0.030617 0.008524 -2 10001 1 1 total P2 0.018911 0.005015 -3 10001 1 1 total P3 0.006235 0.003442 +0 10001 1 1 total P0 0.309384 0.043735 +1 10001 1 1 total P1 0.030756 0.008159 +2 10001 1 1 total P2 0.018997 0.004775 +3 10001 1 1 total P3 0.006263 0.003417 material group out nuclide mean std. dev. 0 10001 1 total 0.0 0.0 material group out nuclide mean std. dev. @@ -228,10 +228,10 @@ 2 10002 1 1 total P2 0.142591 0.010824 3 10002 1 1 total P3 0.008696 0.003588 material group in group out nuclide moment mean std. dev. -0 10002 1 1 total P0 0.903415 0.084918 -1 10002 1 1 total P1 0.410417 0.036718 -2 10002 1 1 total P2 0.143301 0.013612 -3 10002 1 1 total P3 0.008739 0.003640 +0 10002 1 1 total P0 0.898938 0.084369 +1 10002 1 1 total P1 0.408384 0.036475 +2 10002 1 1 total P2 0.142591 0.013525 +3 10002 1 1 total P3 0.008696 0.003622 material group out nuclide mean std. dev. 0 10002 1 total 0.0 0.0 material group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat index 3ab849a56..d2d338708 100644 --- a/tests/test_mgxs_library_distribcell/inputs_true.dat +++ b/tests/test_mgxs_library_distribcell/inputs_true.dat @@ -340,31 +340,31 @@ - total - nu-scatter - analog + flux + tracklength - total scatter - analog + tracklength + total - flux + scatter-P3 analog + total - nu-scatter + nu-scatter-0 analog @@ -372,52 +372,50 @@ total - nu-scatter-P3 + scatter-0 analog - total - nu-scatter + nu-fission analog - total - scatter + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -430,7 +428,7 @@ total - inverse-velocity + prompt-nu-fission tracklength @@ -438,54 +436,40 @@ total flux - tracklength + analog + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength + - total - prompt-nu-fission - analog + delayed-nu-fission + tracklength + total - flux - tracklength + delayed-nu-fission + analog - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - @@ -493,30 +477,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -524,14 +508,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat index bf98ad688..36e3203ba 100644 --- a/tests/test_mgxs_library_distribcell/results_true.dat +++ b/tests/test_mgxs_library_distribcell/results_true.dat @@ -42,10 +42,10 @@ 2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P2 0.015866 0.003708 3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P3 0.005430 0.003170 sum(distribcell) group in group out nuclide moment mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P0 0.387654 0.024885 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P1 0.047226 0.005527 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P2 0.015740 0.003750 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P3 0.005392 0.003157 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P0 0.391123 0.022356 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P1 0.047680 0.005395 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P2 0.015880 0.003758 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P3 0.005435 0.003179 sum(distribcell) group out nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 1.0 0.080455 sum(distribcell) group out nuclide mean std. dev. diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat index f99014ee2..b4498e9d8 100644 --- a/tests/test_mgxs_library_hdf5/inputs_true.dat +++ b/tests/test_mgxs_library_hdf5/inputs_true.dat @@ -313,31 +313,31 @@ - total - nu-scatter - analog + flux + tracklength - total scatter - analog + tracklength + total - flux + scatter-P3 analog + total - nu-scatter + nu-scatter-0 analog @@ -345,52 +345,50 @@ total - nu-scatter-P3 + scatter-0 analog - - + total - nu-scatter + nu-fission analog - total - scatter + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -403,31 +401,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -435,14 +419,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -450,7 +434,7 @@ delayed-nu-fission tracklength - + @@ -458,7 +442,7 @@ delayed-nu-fission analog - + @@ -466,30 +450,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -497,14 +481,14 @@ decay-rate tracklength - + total flux analog - + @@ -513,62 +497,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -587,14 +585,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -615,7 +613,7 @@ total - fission + nu-fission tracklength @@ -629,7 +627,7 @@ total - nu-fission + kappa-fission tracklength @@ -643,7 +641,7 @@ total - kappa-fission + scatter tracklength @@ -651,14 +649,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -670,8 +668,9 @@ + total - nu-scatter + scatter-P3 analog @@ -686,14 +685,15 @@ total - scatter-P3 + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -701,33 +701,17 @@ total - nu-scatter-P3 + scatter analog - total - nu-scatter + flux analog - - - - total - scatter - analog - - - - - total - flux - analog - - @@ -735,7 +719,7 @@ nu-fission analog - + @@ -743,7 +727,7 @@ scatter-P0 analog - + @@ -751,21 +735,21 @@ nu-scatter-P0 analog - + total flux tracklength - + total scatter tracklength - + @@ -773,12 +757,26 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + total - nu-scatter + scatter-P3 analog @@ -786,88 +784,87 @@ total - scatter + nu-scatter-0 analog + total - flux + scatter-0 analog - + total - nu-scatter + nu-fission analog - total - nu-scatter-P3 + nu-fission analog - - + total - nu-scatter + prompt-nu-fission analog - total - scatter + prompt-nu-fission analog - + total - nu-fission - analog + flux + tracklength - + total - nu-fission - analog + inverse-velocity + tracklength - + total - prompt-nu-fission - analog + flux + tracklength - + total prompt-nu-fission - analog + tracklength total flux - tracklength + analog + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -878,31 +875,33 @@ + total - prompt-nu-fission + delayed-nu-fission tracklength - + + total - flux + delayed-nu-fission analog - + total - prompt-nu-fission + delayed-nu-fission analog total - flux + nu-fission tracklength @@ -916,43 +915,12 @@ - + total delayed-nu-fission - analog + tracklength - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -960,14 +928,14 @@ decay-rate tracklength - + total flux analog - + @@ -976,95 +944,123 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + + + + + total + fission + tracklength + total - absorption + flux tracklength total - flux + fission tracklength total - absorption + flux tracklength total - fission + nu-fission tracklength @@ -1078,7 +1074,7 @@ total - fission + kappa-fission tracklength @@ -1092,7 +1088,7 @@ total - nu-fission + scatter tracklength @@ -1100,28 +1096,29 @@ total flux - tracklength + analog total - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + total - scatter - tracklength + scatter-P3 + analog @@ -1133,15 +1130,17 @@ + total - nu-scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -1149,7 +1148,7 @@ total - scatter-P3 + scatter analog @@ -1164,7 +1163,7 @@ total - nu-scatter-P3 + nu-fission analog @@ -1172,7 +1171,7 @@ total - nu-scatter + scatter-P0 analog @@ -1180,55 +1179,24 @@ total - scatter + nu-scatter-P0 analog - - - total - flux - analog - - - - - - total - nu-fission - analog - - - - - - total - scatter-P0 - analog - - - - - - total - nu-scatter-P0 - analog - - total flux tracklength - + total scatter tracklength - + @@ -1236,83 +1204,110 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + + + + + total + nu-scatter-0 + analog + total - nu-scatter + scatter-0 analog - - - - total - scatter - analog - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter-P3 - analog - - - - - - total - nu-scatter - analog - - - - - - total - scatter - analog - - total nu-fission analog - + total nu-fission analog - + total prompt-nu-fission analog + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + total prompt-nu-fission @@ -1326,49 +1321,6 @@ tracklength - - - total - inverse-velocity - tracklength - - - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - - - - total - flux - analog - - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - @@ -1376,7 +1328,7 @@ delayed-nu-fission tracklength - + @@ -1384,7 +1336,7 @@ delayed-nu-fission analog - + @@ -1392,14 +1344,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1407,7 +1359,7 @@ delayed-nu-fission tracklength - + @@ -1415,7 +1367,7 @@ delayed-nu-fission tracklength - + @@ -1423,14 +1375,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat index 3f7797bf1..5324d666c 100644 --- a/tests/test_mgxs_library_hdf5/results_true.dat +++ b/tests/test_mgxs_library_hdf5/results_true.dat @@ -82,16 +82,16 @@ domain=10000 type=consistent scatter matrix [[8.89289900e-04 7.38354757e-04 4.74910776e-04 1.64940700e-04] [2.98710064e-02 4.44330993e-03 1.01307463e-02 1.00367467e-02]]] domain=10000 type=consistent nu-scatter matrix -[[[3.84199430e-01 5.18702806e-02 2.00688439e-02 9.47771503e-03] - [9.88930322e-04 -2.07234582e-04 -1.03366173e-04 2.34290606e-04]] +[[[3.86422967e-01 5.21704775e-02 2.01849914e-02 9.53256688e-03] + [9.94653712e-04 -2.08433942e-04 -1.03964400e-04 2.35646553e-04]] - [[9.24639842e-04 -7.67704913e-04 4.93788836e-04 -1.71497217e-04] - [4.11464730e-01 1.64817268e-02 6.37149004e-03 -1.04991213e-02]]] -[[[5.04005137e-02 9.04259889e-03 3.61169756e-03 2.46795126e-03] - [8.36973463e-04 2.06752354e-04 1.97694759e-04 2.06602832e-04]] + [[8.87128136e-04 -7.36559899e-04 4.73756321e-04 -1.64539748e-04] + [3.94772020e-01 1.58130798e-02 6.11300510e-03 -1.00731826e-02]]] +[[[4.75627021e-02 8.78140568e-03 3.51522200e-03 2.44425169e-03] + [8.40606499e-04 2.07733706e-04 1.98782933e-04 2.07523215e-04]] - [[1.60212263e-03 1.33020162e-03 8.55587476e-04 2.97153075e-04] - [2.84588375e-02 4.60349295e-03 1.05573088e-02 1.04561824e-02]]] + [[1.53780011e-03 1.27679627e-03 8.21237084e-04 2.85222881e-04] + [3.39988352e-02 4.49065920e-03 1.01338659e-02 1.00452944e-02]]] domain=10000 type=chi [1.00000000e+00 0.00000000e+00] [4.60705493e-02 0.00000000e+00] @@ -280,16 +280,16 @@ domain=10001 type=consistent scatter matrix [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] [5.02358893e-02 1.61616720e-02 1.14951123e-02 7.31312479e-03]]] domain=10001 type=consistent nu-scatter matrix -[[[3.10120713e-01 3.82295876e-02 2.07449405e-02 7.96429620e-03] +[[[3.12162675e-01 3.84813069e-02 2.08815337e-02 8.01673640e-03] [0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [2.96264249e-01 -1.12136353e-02 8.83656566e-03 -3.27006707e-03]]] -[[[5.84608636e-02 1.03230576e-02 5.67743887e-03 3.92760936e-03] + [2.95421002e-01 -1.11817183e-02 8.81141444e-03 -3.26075959e-03]]] +[[[5.04070427e-02 9.69345877e-03 5.34169555e-03 3.87580585e-03] [0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [7.40187611e-02 1.63372534e-02 1.16408402e-02 7.35838382e-03]]] + [6.55288678e-02 1.62399493e-02 1.15634161e-02 7.32785650e-03]]] domain=10001 type=chi [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] @@ -478,16 +478,16 @@ domain=10002 type=consistent scatter matrix [[4.44773843e-04 4.01251123e-04 3.20593966e-04 2.14537073e-04] [3.52193929e-01 7.91402819e-02 1.84875925e-02 8.77085752e-03]]] domain=10002 type=consistent nu-scatter matrix -[[[6.39901439e-01 3.81167422e-01 1.52391887e-01 9.14802163e-03] - [3.13677176e-02 8.75772258e-03 -2.56790088e-03 -3.78480261e-03]] +[[[6.32859281e-01 3.76972649e-01 1.50714804e-01 9.04734705e-03] + [3.10225138e-02 8.66134326e-03 -2.53964096e-03 -3.74315061e-03]] - [[4.43343102e-04 3.99960386e-04 3.19562684e-04 2.13846954e-04] - [2.03494484e+00 5.09940477e-01 1.11174601e-01 2.49884339e-02]]] -[[[4.26392749e-02 2.63117825e-02 1.16194647e-02 3.92016710e-03] - [2.98774961e-03 1.14887360e-03 1.03342895e-03 8.68386243e-04]] + [[4.40143026e-04 3.97073448e-04 3.17256062e-04 2.12303394e-04] + [2.02025649e+00 5.06259696e-01 1.10372136e-01 2.48080660e-02]]] +[[[4.52974133e-02 2.78247077e-02 1.21478698e-02 3.88422859e-03] + [3.06407542e-03 1.15855775e-03 1.02420876e-03 8.64382873e-04]] - [[7.71125112e-04 6.95667747e-04 5.55828678e-04 3.71952908e-04] - [4.68587349e-01 1.10634806e-01 2.50303502e-02 9.60120658e-03]]] + [[7.65033031e-04 6.90171798e-04 5.51437493e-04 3.69014387e-04] + [4.46600759e-01 1.04874946e-01 2.38091367e-02 9.39676938e-03]]] domain=10002 type=chi [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 aca103a8a..fe38ef89d 100644 --- a/tests/test_mgxs_library_mesh/inputs_true.dat +++ b/tests/test_mgxs_library_mesh/inputs_true.dat @@ -577,31 +577,31 @@ - total - nu-scatter - analog + flux + tracklength - total scatter - analog + tracklength + total - flux + scatter-P3 analog + total - nu-scatter + nu-scatter-0 analog @@ -609,52 +609,50 @@ total - nu-scatter-P3 + scatter-0 analog - total - nu-scatter + nu-fission analog - total - scatter + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -667,7 +665,7 @@ total - inverse-velocity + prompt-nu-fission tracklength @@ -675,54 +673,40 @@ total flux - tracklength + analog + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength + - total - prompt-nu-fission - analog + delayed-nu-fission + tracklength + total - flux - tracklength + delayed-nu-fission + analog - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - analog - - @@ -730,30 +714,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -761,14 +745,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat index 786ab8fec..f6c7a5718 100644 --- a/tests/test_mgxs_library_mesh/results_true.dat +++ b/tests/test_mgxs_library_mesh/results_true.dat @@ -138,22 +138,22 @@ 15 2 2 1 1 1 total P3 0.019785 0.014168 mesh 1 group in group out nuclide moment mean std. dev. x y z -0 1 1 1 1 1 total P0 0.638348 0.169129 -1 1 1 1 1 1 total P1 0.247099 0.064297 -2 1 1 1 1 1 total P2 0.092195 0.022758 -3 1 1 1 1 1 total P3 0.013224 0.005359 -4 1 2 1 1 1 total P0 0.588378 0.462704 -5 1 2 1 1 1 total P1 0.221552 0.175616 -6 1 2 1 1 1 total P2 0.069798 0.056753 -7 1 2 1 1 1 total P3 -0.003039 0.009829 -8 2 1 1 1 1 total P0 0.698373 0.171880 -9 2 1 1 1 1 total P1 0.261835 0.064773 -10 2 1 1 1 1 total P2 0.096206 0.024355 -11 2 1 1 1 1 total P3 0.016973 0.005960 -12 2 2 1 1 1 total P0 0.625643 0.146236 -13 2 2 1 1 1 total P1 0.244646 0.056797 -14 2 2 1 1 1 total P2 0.088580 0.021648 -15 2 2 1 1 1 total P3 0.019989 0.014515 +0 1 1 1 1 1 total P0 0.633490 0.166706 +1 1 1 1 1 1 total P1 0.245219 0.063359 +2 1 1 1 1 1 total P2 0.091493 0.022409 +3 1 1 1 1 1 total P3 0.013124 0.005303 +4 1 2 1 1 1 total P0 0.618705 0.483237 +5 1 2 1 1 1 total P1 0.232972 0.183428 +6 1 2 1 1 1 total P2 0.073396 0.059298 +7 1 2 1 1 1 total P3 -0.003195 0.010332 +8 2 1 1 1 1 total P0 0.686150 0.161742 +9 2 1 1 1 1 total P1 0.257252 0.060980 +10 2 1 1 1 1 total P2 0.094522 0.022975 +11 2 1 1 1 1 total P3 0.016676 0.005736 +12 2 2 1 1 1 total P0 0.619269 0.152000 +13 2 2 1 1 1 total P1 0.242153 0.059073 +14 2 2 1 1 1 total P2 0.087677 0.022412 +15 2 2 1 1 1 total P3 0.019785 0.014443 mesh 1 group out nuclide mean std. dev. x y z 0 1 1 1 1 total 1.0 0.135958 diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat index f99014ee2..b4498e9d8 100644 --- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat @@ -313,31 +313,31 @@ - total - nu-scatter - analog + flux + tracklength - total scatter - analog + tracklength + total - flux + scatter-P3 analog + total - nu-scatter + nu-scatter-0 analog @@ -345,52 +345,50 @@ total - nu-scatter-P3 + scatter-0 analog - - + total - nu-scatter + nu-fission analog - total - scatter + nu-fission analog total - nu-fission + prompt-nu-fission analog total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -403,31 +401,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -435,14 +419,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -450,7 +434,7 @@ delayed-nu-fission tracklength - + @@ -458,7 +442,7 @@ delayed-nu-fission analog - + @@ -466,30 +450,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -497,14 +481,14 @@ decay-rate tracklength - + total flux analog - + @@ -513,62 +497,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -587,14 +585,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -615,7 +613,7 @@ total - fission + nu-fission tracklength @@ -629,7 +627,7 @@ total - nu-fission + kappa-fission tracklength @@ -643,7 +641,7 @@ total - kappa-fission + scatter tracklength @@ -651,14 +649,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -670,8 +668,9 @@ + total - nu-scatter + scatter-P3 analog @@ -686,14 +685,15 @@ total - scatter-P3 + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -701,33 +701,17 @@ total - nu-scatter-P3 + scatter analog - total - nu-scatter + flux analog - - - - total - scatter - analog - - - - - total - flux - analog - - @@ -735,7 +719,7 @@ nu-fission analog - + @@ -743,7 +727,7 @@ scatter-P0 analog - + @@ -751,21 +735,21 @@ nu-scatter-P0 analog - + total flux tracklength - + total scatter tracklength - + @@ -773,12 +757,26 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + total - nu-scatter + scatter-P3 analog @@ -786,88 +784,87 @@ total - scatter + nu-scatter-0 analog + total - flux + scatter-0 analog - + total - nu-scatter + nu-fission analog - total - nu-scatter-P3 + nu-fission analog - - + total - nu-scatter + prompt-nu-fission analog - total - scatter + prompt-nu-fission analog - + total - nu-fission - analog + flux + tracklength - + total - nu-fission - analog + inverse-velocity + tracklength - + total - prompt-nu-fission - analog + flux + tracklength - + total prompt-nu-fission - analog + tracklength total flux - tracklength + analog + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -878,31 +875,33 @@ + total - prompt-nu-fission + delayed-nu-fission tracklength - + + total - flux + delayed-nu-fission analog - + total - prompt-nu-fission + delayed-nu-fission analog total - flux + nu-fission tracklength @@ -916,43 +915,12 @@ - + total delayed-nu-fission - analog + tracklength - - - - total - delayed-nu-fission - analog - - - - - total - nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -960,14 +928,14 @@ decay-rate tracklength - + total flux analog - + @@ -976,95 +944,123 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + + + + + total + flux + analog + + + + + total + total + analog + - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + + + + + total + flux + tracklength + + + + + total + absorption + tracklength + + + + + total + fission + tracklength + total - absorption + flux tracklength total - flux + fission tracklength total - absorption + flux tracklength total - fission + nu-fission tracklength @@ -1078,7 +1074,7 @@ total - fission + kappa-fission tracklength @@ -1092,7 +1088,7 @@ total - nu-fission + scatter tracklength @@ -1100,28 +1096,29 @@ total flux - tracklength + analog total - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + total - scatter - tracklength + scatter-P3 + analog @@ -1133,15 +1130,17 @@ + total - nu-scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -1149,7 +1148,7 @@ total - scatter-P3 + scatter analog @@ -1164,7 +1163,7 @@ total - nu-scatter-P3 + nu-fission analog @@ -1172,7 +1171,7 @@ total - nu-scatter + scatter-P0 analog @@ -1180,55 +1179,24 @@ total - scatter + nu-scatter-P0 analog - - - total - flux - analog - - - - - - total - nu-fission - analog - - - - - - total - scatter-P0 - analog - - - - - - total - nu-scatter-P0 - analog - - total flux tracklength - + total scatter tracklength - + @@ -1236,83 +1204,110 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + + + + + total + nu-scatter-0 + analog + total - nu-scatter + scatter-0 analog - - - - total - scatter - analog - - - - - total - flux - analog - - - - - total - nu-scatter - analog - - - - - - total - nu-scatter-P3 - analog - - - - - - total - nu-scatter - analog - - - - - - total - scatter - analog - - total nu-fission analog - + total nu-fission analog - + total prompt-nu-fission analog + + + + total + prompt-nu-fission + analog + + + + + total + flux + tracklength + + + + + total + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + total prompt-nu-fission @@ -1326,49 +1321,6 @@ tracklength - - - total - inverse-velocity - tracklength - - - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - - - - total - flux - analog - - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - @@ -1376,7 +1328,7 @@ delayed-nu-fission tracklength - + @@ -1384,7 +1336,7 @@ delayed-nu-fission analog - + @@ -1392,14 +1344,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1407,7 +1359,7 @@ delayed-nu-fission tracklength - + @@ -1415,7 +1367,7 @@ delayed-nu-fission tracklength - + @@ -1423,14 +1375,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat index 46cc07e31..0cec56a25 100644 --- a/tests/test_mgxs_library_no_nuclides/results_true.dat +++ b/tests/test_mgxs_library_no_nuclides/results_true.dat @@ -100,22 +100,22 @@ 2 10000 2 2 total P2 0.006113 0.010131 3 10000 2 2 total P3 -0.010073 0.010037 material group in group out nuclide moment mean std. dev. -12 10000 1 1 total P0 0.384199 0.050401 -13 10000 1 1 total P1 0.051870 0.009043 -14 10000 1 1 total P2 0.020069 0.003612 -15 10000 1 1 total P3 0.009478 0.002468 -8 10000 1 2 total P0 0.000989 0.000837 -9 10000 1 2 total P1 -0.000207 0.000207 -10 10000 1 2 total P2 -0.000103 0.000198 -11 10000 1 2 total P3 0.000234 0.000207 -4 10000 2 1 total P0 0.000925 0.001602 -5 10000 2 1 total P1 -0.000768 0.001330 -6 10000 2 1 total P2 0.000494 0.000856 -7 10000 2 1 total P3 -0.000171 0.000297 -0 10000 2 2 total P0 0.411465 0.028459 -1 10000 2 2 total P1 0.016482 0.004603 -2 10000 2 2 total P2 0.006371 0.010557 -3 10000 2 2 total P3 -0.010499 0.010456 +12 10000 1 1 total P0 0.386423 0.047563 +13 10000 1 1 total P1 0.052170 0.008781 +14 10000 1 1 total P2 0.020185 0.003515 +15 10000 1 1 total P3 0.009533 0.002444 +8 10000 1 2 total P0 0.000995 0.000841 +9 10000 1 2 total P1 -0.000208 0.000208 +10 10000 1 2 total P2 -0.000104 0.000199 +11 10000 1 2 total P3 0.000236 0.000208 +4 10000 2 1 total P0 0.000887 0.001538 +5 10000 2 1 total P1 -0.000737 0.001277 +6 10000 2 1 total P2 0.000474 0.000821 +7 10000 2 1 total P3 -0.000165 0.000285 +0 10000 2 2 total P0 0.394772 0.033999 +1 10000 2 2 total P1 0.015813 0.004491 +2 10000 2 2 total P2 0.006113 0.010134 +3 10000 2 2 total P3 -0.010073 0.010045 material group out nuclide mean std. dev. 1 10000 1 total 1.0 0.046071 0 10000 2 total 0.0 0.000000 @@ -312,10 +312,10 @@ 2 10001 2 2 total P2 0.008811 0.011495 3 10001 2 2 total P3 -0.003261 0.007313 material group in group out nuclide moment mean std. dev. -12 10001 1 1 total P0 0.310121 0.058461 -13 10001 1 1 total P1 0.038230 0.010323 -14 10001 1 1 total P2 0.020745 0.005677 -15 10001 1 1 total P3 0.007964 0.003928 +12 10001 1 1 total P0 0.312163 0.050407 +13 10001 1 1 total P1 0.038481 0.009693 +14 10001 1 1 total P2 0.020882 0.005342 +15 10001 1 1 total P3 0.008017 0.003876 8 10001 1 2 total P0 0.000000 0.000000 9 10001 1 2 total P1 0.000000 0.000000 10 10001 1 2 total P2 0.000000 0.000000 @@ -324,10 +324,10 @@ 5 10001 2 1 total P1 0.000000 0.000000 6 10001 2 1 total P2 0.000000 0.000000 7 10001 2 1 total P3 0.000000 0.000000 -0 10001 2 2 total P0 0.296264 0.074019 -1 10001 2 2 total P1 -0.011214 0.016337 -2 10001 2 2 total P2 0.008837 0.011641 -3 10001 2 2 total P3 -0.003270 0.007358 +0 10001 2 2 total P0 0.295421 0.065529 +1 10001 2 2 total P1 -0.011182 0.016240 +2 10001 2 2 total P2 0.008811 0.011563 +3 10001 2 2 total P3 -0.003261 0.007328 material group out nuclide mean std. dev. 1 10001 1 total 0.0 0.0 0 10001 2 total 0.0 0.0 @@ -524,22 +524,22 @@ 2 10002 2 2 total P2 0.110372 0.018488 3 10002 2 2 total P3 0.024808 0.008771 material group in group out nuclide moment mean std. dev. -12 10002 1 1 total P0 0.639901 0.042639 -13 10002 1 1 total P1 0.381167 0.026312 -14 10002 1 1 total P2 0.152392 0.011619 -15 10002 1 1 total P3 0.009148 0.003920 -8 10002 1 2 total P0 0.031368 0.002988 -9 10002 1 2 total P1 0.008758 0.001149 -10 10002 1 2 total P2 -0.002568 0.001033 -11 10002 1 2 total P3 -0.003785 0.000868 -4 10002 2 1 total P0 0.000443 0.000771 -5 10002 2 1 total P1 0.000400 0.000696 -6 10002 2 1 total P2 0.000320 0.000556 -7 10002 2 1 total P3 0.000214 0.000372 -0 10002 2 2 total P0 2.034945 0.468587 -1 10002 2 2 total P1 0.509940 0.110635 -2 10002 2 2 total P2 0.111175 0.025030 -3 10002 2 2 total P3 0.024988 0.009601 +12 10002 1 1 total P0 0.632859 0.045297 +13 10002 1 1 total P1 0.376973 0.027825 +14 10002 1 1 total P2 0.150715 0.012148 +15 10002 1 1 total P3 0.009047 0.003884 +8 10002 1 2 total P0 0.031023 0.003064 +9 10002 1 2 total P1 0.008661 0.001159 +10 10002 1 2 total P2 -0.002540 0.001024 +11 10002 1 2 total P3 -0.003743 0.000864 +4 10002 2 1 total P0 0.000440 0.000765 +5 10002 2 1 total P1 0.000397 0.000690 +6 10002 2 1 total P2 0.000317 0.000551 +7 10002 2 1 total P3 0.000212 0.000369 +0 10002 2 2 total P0 2.020256 0.446601 +1 10002 2 2 total P1 0.506260 0.104875 +2 10002 2 2 total P2 0.110372 0.023809 +3 10002 2 2 total P3 0.024808 0.009397 material group out nuclide mean std. dev. 1 10002 1 total 0.0 0.0 0 10002 2 total 0.0 0.0 diff --git a/tests/test_mgxs_library_nuclides/inputs_true.dat b/tests/test_mgxs_library_nuclides/inputs_true.dat index 6ee483a57..3083ef903 100644 --- a/tests/test_mgxs_library_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_nuclides/inputs_true.dat @@ -313,31 +313,31 @@ - - U234 U235 U238 O16 - nu-scatter - analog + total + flux + tracklength - U234 U235 U238 O16 scatter - analog + tracklength - total - flux + + U234 U235 U238 O16 + scatter-P3 analog + U234 U235 U238 O16 - nu-scatter + nu-scatter-0 analog @@ -345,52 +345,50 @@ U234 U235 U238 O16 - nu-scatter-P3 + scatter-0 analog - - + U234 U235 U238 O16 - nu-scatter + nu-fission analog - U234 U235 U238 O16 - scatter + nu-fission analog U234 U235 U238 O16 - nu-fission + prompt-nu-fission analog U234 U235 U238 O16 - nu-fission + prompt-nu-fission analog - - U234 U235 U238 O16 - prompt-nu-fission - analog + + total + flux + tracklength - + U234 U235 U238 O16 - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -403,31 +401,17 @@ U234 U235 U238 O16 - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - U234 U235 U238 O16 - prompt-nu-fission - tracklength - - total flux analog - + @@ -435,62 +419,76 @@ prompt-nu-fission analog + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + total + tracklength + total flux - tracklength + analog Zr90 Zr91 Zr92 Zr94 Zr96 total - tracklength + analog - - - total - flux - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - analog - - Zr90 Zr91 Zr92 Zr94 Zr96 scatter-1 analog - + total flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 total analog - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-scatter-1 analog + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption + tracklength + @@ -508,15 +506,15 @@ - total - flux + Zr90 Zr91 Zr92 Zr94 Zr96 + fission tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - absorption + total + flux tracklength @@ -537,7 +535,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - fission + nu-fission tracklength @@ -551,7 +549,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + kappa-fission tracklength @@ -565,7 +563,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - kappa-fission + scatter tracklength @@ -573,14 +571,14 @@ total flux - tracklength + analog Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - tracklength + nu-scatter + analog @@ -592,8 +590,9 @@ + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + scatter-P3 analog @@ -608,14 +607,15 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 + nu-scatter-P3 analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter analog @@ -623,33 +623,17 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P3 + scatter analog - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + total + flux analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - analog - - - - - total - flux - analog - - @@ -657,7 +641,7 @@ nu-fission analog - + @@ -665,7 +649,7 @@ scatter-P0 analog - + @@ -673,21 +657,21 @@ nu-scatter-P0 analog - + total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength - + @@ -695,12 +679,26 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + tracklength + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + scatter-P3 analog @@ -708,207 +706,205 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-scatter-0 analog - total - flux + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-0 analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + nu-fission analog - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P3 + nu-fission analog - - + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + prompt-nu-fission analog - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + prompt-nu-fission analog - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 inverse-velocity tracklength - + total flux tracklength + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog + + + + + total + flux + tracklength + - + - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + H1 O16 B10 B11 + total tracklength - + total flux analog - + - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission + H1 O16 B10 B11 + total analog - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - total - tracklength - - - - - total - flux - analog - - - - - H1 O16 B10 B11 - total - analog - - H1 O16 B10 B11 scatter-1 analog - + total flux analog - + H1 O16 B10 B11 total analog - + H1 O16 B10 B11 nu-scatter-1 analog - + total flux tracklength + + + + H1 O16 B10 B11 + absorption + tracklength + + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + absorption + tracklength + + + + + H1 O16 B10 B11 + fission + tracklength + - H1 O16 B10 B11 - absorption + total + flux tracklength - total - flux + H1 O16 B10 B11 + fission tracklength - H1 O16 B10 B11 - absorption + total + flux tracklength H1 O16 B10 B11 - fission + nu-fission tracklength @@ -922,7 +918,7 @@ H1 O16 B10 B11 - fission + kappa-fission tracklength @@ -936,7 +932,7 @@ H1 O16 B10 B11 - nu-fission + scatter tracklength @@ -944,28 +940,29 @@ total flux - tracklength + analog H1 O16 B10 B11 - kappa-fission - tracklength + nu-scatter + analog total flux - tracklength + analog + H1 O16 B10 B11 - scatter - tracklength + scatter-P3 + analog @@ -977,15 +974,17 @@ + H1 O16 B10 B11 - nu-scatter + nu-scatter-P3 analog - total - flux + + H1 O16 B10 B11 + nu-scatter analog @@ -993,7 +992,7 @@ H1 O16 B10 B11 - scatter-P3 + scatter analog @@ -1008,7 +1007,7 @@ H1 O16 B10 B11 - nu-scatter-P3 + nu-fission analog @@ -1016,7 +1015,7 @@ H1 O16 B10 B11 - nu-scatter + scatter-P0 analog @@ -1024,55 +1023,24 @@ H1 O16 B10 B11 - scatter + nu-scatter-P0 analog - - - total - flux - analog - - - - - - H1 O16 B10 B11 - nu-fission - analog - - - - - - H1 O16 B10 B11 - scatter-P0 - analog - - - - - - H1 O16 B10 B11 - nu-scatter-P0 - analog - - total flux tracklength - + H1 O16 B10 B11 scatter tracklength - + @@ -1080,124 +1048,108 @@ scatter-P3 analog - - - - - H1 O16 B10 B11 - nu-scatter - analog - - - - - - H1 O16 B10 B11 - scatter - analog - - - - - total - flux - analog - - - - - H1 O16 B10 B11 - nu-scatter - analog - - - - - - H1 O16 B10 B11 - nu-scatter-P3 - analog - - - - - - H1 O16 B10 B11 - nu-scatter - analog - - - - - - H1 O16 B10 B11 - scatter - analog - - - - - H1 O16 B10 B11 - nu-fission - analog - - - - - H1 O16 B10 B11 - nu-fission - analog - - - - - H1 O16 B10 B11 - prompt-nu-fission - analog - - - - - H1 O16 B10 B11 - prompt-nu-fission - analog - - + total flux tracklength - + + + + H1 O16 B10 B11 + scatter + tracklength + + + + + + H1 O16 B10 B11 + scatter-P3 + analog + + + + + + H1 O16 B10 B11 + nu-scatter-0 + analog + + + + + + H1 O16 B10 B11 + scatter-0 + analog + + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + H1 O16 B10 B11 + prompt-nu-fission + analog + + + + + H1 O16 B10 B11 + prompt-nu-fission + analog + + + + + total + flux + tracklength + + H1 O16 B10 B11 inverse-velocity tracklength - + total flux tracklength - + H1 O16 B10 B11 prompt-nu-fission tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_nuclides/results_true.dat b/tests/test_mgxs_library_nuclides/results_true.dat index 427a9f3b0..7b1279192 100644 --- a/tests/test_mgxs_library_nuclides/results_true.dat +++ b/tests/test_mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -98b6de0cd546baf457c878d9695806ed53d1af1f380e164d1803041947346a54830aef4a30eab1d261abce700a4f45e2f81d6e5f78c124110c0f60601161cf9b \ No newline at end of file +bd5c4c64a77f8df58fc6753bc5d43de9d7b80c47097cfbafa37f52f10f661997caec72acdfa31dd1af246314447bd5781e950181814cbc77435ebbf029e9f6d7 \ No newline at end of file From 99db48bc8e48f41a8cd1e358f1311ba9ba72b5ee Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 2 Mar 2017 17:16:32 -0500 Subject: [PATCH 25/40] Updated equations in new consistent scattering matrix --- docs/source/pythonapi/index.rst | 1 - openmc/mgxs/mgxs.py | 786 ++------------------------------ 2 files changed, 30 insertions(+), 757 deletions(-) diff --git a/docs/source/pythonapi/index.rst b/docs/source/pythonapi/index.rst index e622fb265..8b4b0b154 100644 --- a/docs/source/pythonapi/index.rst +++ b/docs/source/pythonapi/index.rst @@ -287,7 +287,6 @@ Multi-group Cross Sections openmc.mgxs.MGXS openmc.mgxs.AbsorptionXS openmc.mgxs.CaptureXS - openmc.mgxs.ConsistentScatterMatrixXS openmc.mgxs.Chi openmc.mgxs.FissionXS openmc.mgxs.InverseVelocity diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index aa2afb8cf..4b08cfb8f 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3552,7 +3552,35 @@ class ScatterMatrixXS(MatrixMGXS): To incorporate the effect of neutron multiplication from (n,xn) reactions in the above relation, the `nu` parameter can be set to `True`. - # FIXME: Add equations to reflect alternative formulation + An alternative form of the scattering matrix is computed when the + `formulation` property is set to 'consistent' rather than the default + of 'simple'. This formulation computes the scattering matrix multi-group + cross section as the product of the scatter cross section and + group-to-group scattering probabilities. + + Unlike the default 'simple' formulation, the 'consistent' formulation + is computed from the groupwise cattering cross section which uses a + tracklength estimator. This ensures that reaction rate balance is exactly + preserved with a :class:`TotalXS` computed using a tracklength estimator. + + For a scattering probability matrix :math:`P_{s,\ell,g'\rightarrow g}` and + scattering cross section :math:`\sigma_s (r, E)` for incoming energy group + :math:`[E_{g'},E_{g'-1}]` and outgoing energy group :math:`[E_g,E_{g-1}]`, + the Legendre scattering moments are calculated as: + + .. math:: + + \sigma_{s,\ell,g'\rightarrow g} = \sigma_s (r, E) \times + P_{s,\ell,g'\rightarrow g} + + To incorporate the effect of neutron multiplication from (n,xn) reactions + in the 'consistent' scattering matrix, the `nu` parameter can be set to `True` + such that the Legendre scattering moments are calculated as: + + .. math:: + + \sigma_{s,\ell,g'\rightarrow g} = \upsilon_{g'\rightarrow g} \times + \sigma_s (r, E) \times P_{s,\ell,g'\rightarrow g} Parameters ---------- @@ -4786,7 +4814,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): \sigma_{s,0,g'} \phi \rangle} To incorporate the effect of neutron multiplication from (n,xn) reactions - in the above probaility matrix, the `nu` parameter can be set to `True`. + in the above probability matrix, the `nu` parameter can be set to `True`. Parameters ---------- @@ -5581,760 +5609,6 @@ class ScatterProbabilityMatrix(MatrixMGXS): print(string) -@add_metaclass(ABCMeta) -class ConvolvedMGXS(MGXS): - """An abstract convolution of multiple multi-group cross sections for some - energy group structure within some spatial domain. - - This class can be used for both OpenMC input generation and tally data - post-processing to compute spatially-homogenized and energy-integrated - multi-group cross sections for multi-group neutronics calculations. - - .. note:: Users should instantiate the subclasses of this abstract class. - - Parameters - ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh - The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - The domain type for spatial homogenization - energy_groups : openmc.mgxs.EnergyGroups - The energy group structure for energy condensation - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - name : str, optional - Name of the multi-group cross section. Used as a label to identify - tallies in OpenMC 'tallies.xml' file. - num_polar : Integral, optional - Number of equi-width polar angle bins for angle discretization; - defaults to one bin - num_azimuthal : Integral, optional - Number of equi-width azimuthal angle bins for angle discretization; - defaults to one bin - - Attributes - ---------- - name : str, optional - Name of the multi-group cross section - rxn_type : str - Reaction type (e.g., 'total', 'nu-fission', etc.) - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - domain : Material or Cell or Universe or Mesh - Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - Domain type for spatial homogenization - energy_groups : openmc.mgxs.EnergyGroups - Energy group structure for energy condensation - num_polar : Integral - Number of equi-width polar angle bins for angle discretization - num_azimuthal : Integral - Number of equi-width azimuthal angle bins for angle discretization - tally_trigger : openmc.Trigger - An (optional) tally precision trigger given to each tally used to - compute the cross section - scores : list of str - The scores in each tally used to compute the multi-group cross section - filters : list of openmc.Filter - The filters in each tally used to compute the multi-group cross section - 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'} - The tally estimator used to compute the multi-group cross section - tallies : collections.OrderedDict - OpenMC tallies needed to compute the multi-group cross section - rxn_rate_tally : openmc.Tally - Derived tally for the reaction rate tally used in the numerator to - compute the multi-group cross section. This attribute is None - unless the multi-group cross section has been computed. - xs_tally : openmc.Tally - Derived tally for the multi-group cross section. This attribute - is None unless the multi-group cross section has been computed. - num_subdomains : int - The number of subdomains is unity for 'material', 'cell' and 'universe' - domain types. This is equal to the number of cell instances - for 'distribcell' domain types (it is equal to unity prior to loading - tally data from a statepoint file) and the number of mesh cells for - 'mesh' domain types. - num_nuclides : int - The number of nuclides for which the multi-group cross section is - being tracked. This is unity if the by_nuclide attribute is False. - nuclides : Iterable of str or 'sum' - The optional user-specified nuclides for which to compute cross - sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides - are not specified by the user, all nuclides in the spatial domain - are included. This attribute is 'sum' if by_nuclide is false. - sparse : bool - Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format - for compressed data storage - loaded_sp : bool - Whether or not a statepoint file has been loaded with tally data - derived : bool - Whether or not the MGXS is merged from one or more other MGXS - hdf5_key : str - The key used to index multi-group cross sections in an HDF5 data store - mgxs : list of openmc.mgxs.MGXS - A list of MGXS to combine to compute this multi-group cross section - - """ - - def __init__(self, domain=None, domain_type=None, groups=None, - by_nuclide=False, name='', num_polar=1, num_azimuthal=1): - - self._mgxs = [] - super(ConvolvedMGXS, self).__init__( - domain, domain_type, groups, by_nuclide, - name, num_polar, num_azimuthal) - - def __deepcopy__(self, memo): - clone = super(ConvolvedMGXS, self).__deepcopy__(memo) - clone._mgxs = copy.deepcopy(self.mgxs) - return clone - - @property - def mgxs(self): - return self._mgxs - - @property - def scores(self): - scores = [] - for mgxs in self.mgxs: - scores += mgxs.scores - return scores - - @property - def filters(self): - filters = [] - for mgxs in self.mgxs: - filters.extend(mgxs.filters) - return filters - - @property - def tally_keys(self): - keys = [] - for mgxs in self.mgxs: - for tally_key in mgxs.tallies: - keys += ['{} : {}'.format(mgxs.hdf5_key, tally_key)] - return keys - - @property - def tallies(self): - - # Instantiate tallies if they do not exist - if self._tallies is None: - - # Initialize a collection of Tallies - self._tallies = OrderedDict() - - # Add tallies created for each MGXS - for mgxs in self.mgxs: - for tally_key in mgxs.tallies: - new_key = '{} : {}'.format(mgxs.hdf5_key, tally_key) - self._tallies[new_key] = mgxs.tallies[tally_key] - - return self._tallies - - @MGXS.name.setter - def name(self, name): - cv.check_type('name', name, string_types) - - self._name = name - for mgxs in self.mgxs: - mgxs.name = name - - @MGXS.by_nuclide.setter - def by_nuclide(self, by_nuclide): - cv.check_type('by_nuclide', by_nuclide, bool) - - self._by_nuclide = by_nuclide - for mgxs in self.mgxs: - mgxs.by_nuclide = by_nuclide - - @MGXS.nuclides.setter - def nuclides(self, nuclides): - cv.check_iterable_type('nuclides', nuclides, string_types) - - self._nuclides = nuclides - for mgxs in self.mgxs: - mgxs.nuclides = nuclides - - @MGXS.estimator.setter - def estimator(self, estimator): - raise ValueError('Unable to assign a tally estimator a ConvolvedMGXS') - - @MGXS.domain.setter - def domain(self, domain): - cv.check_type('domain', domain, _DOMAINS) - - self._domain = domain - for mgxs in self.mgxs: - mgxs.domain = domain - - # Assign a domain type - if self.domain_type is None: - if isinstance(domain, openmc.Material): - self._domain_type = 'material' - elif isinstance(domain, openmc.Cell): - self._domain_type = 'cell' - elif isinstance(domain, openmc.Universe): - self._domain_type = 'universe' - elif isinstance(domain, openmc.Mesh): - self._domain_type = 'mesh' - - @MGXS.domain_type.setter - def domain_type(self, domain_type): - cv.check_value('domain type', domain_type, DOMAIN_TYPES) - - self._domain_type = domain_type - for mgxs in self.mgxs: - mgxs.domain_type = domain_type - - @MGXS.energy_groups.setter - def energy_groups(self, energy_groups): - cv.check_type('energy groups', energy_groups, openmc.mgxs.EnergyGroups) - - self._energy_groups = energy_groups - for mgxs in self.mgxs: - mgxs.energy_groups = energy_groups - - @MGXS.num_polar.setter - def num_polar(self, num_polar): - cv.check_type('num_polar', num_polar, Integral) - cv.check_greater_than('num_polar', num_polar, 0) - - self._num_polar = num_polar - for mgxs in self.mgxs: - mgxs.num_polar = num_polar - - @MGXS.num_azimuthal.setter - def num_azimuthal(self, num_azimuthal): - cv.check_type('num_azimuthal', num_azimuthal, Integral) - cv.check_greater_than('num_azimuthal', num_azimuthal, 0) - - self._num_azimuthal = num_azimuthal - for mgxs in self.mgxs: - mgxs.num_azimuthal = num_azimuthal - - @MGXS.tally_trigger.setter - def tally_trigger(self, tally_trigger): - cv.check_type('tally trigger', tally_trigger, openmc.Trigger) - - self._tally_trigger = tally_trigger - for mgxs in self.mgxs: - mgxs.tally_trigger = tally_trigger - - @MGXS.sparse.setter - def sparse(self, sparse): - """Convert tally data from NumPy arrays to SciPy list of lists (LIL) - sparse matrices, and vice versa. - - This property may be used to reduce the amount of data in memory during - tally data processing. The tally data will be stored as SciPy LIL - matrices internally within the Tally object. All tally data access - properties and methods will return data as a dense NumPy array. - - """ - - cv.check_type('sparse', sparse, bool) - - # Sparsify or densify the derived MGXS tallies and the base tallies - if self._xs_tally: - self.xs_tally.sparse = sparse - if self._rxn_rate_tally: - self.rxn_rate_tally.sparse = sparse - - for tally_name in self.tallies: - self.tallies[tally_name].sparse = sparse - - self._sparse = sparse - for mgxs in self.mgxs: - mgxs.sparse = sparse - - def load_from_statepoint(self, statepoint): - """Extracts tallies in an OpenMC StatePoint with the data needed to - compute multi-group cross sections. - - This method is needed to compute cross section data from tallies - in an OpenMC StatePoint object. - - .. note:: The statepoint must be linked with an OpenMC Summary object. - - Parameters - ---------- - statepoint : openmc.StatePoint - An OpenMC StatePoint object with tally data - - Raises - ------ - ValueError - When this method is called with a statepoint that has not been - linked with a summary object. - - """ - - cv.check_type('statepoint', statepoint, openmc.statepoint.StatePoint) - - if statepoint.summary is None: - msg = 'Unable to load data from a statepoint which has not been ' \ - 'linked with a summary file' - raise ValueError(msg) - - # Override the domain object that loaded from an OpenMC summary file - # NOTE: This is necessary for micro cross-sections which require - # the isotopic number densities as computed by OpenMC - geom = statepoint.summary.geometry - if self.domain_type in ('cell', 'distribcell'): - self.domain = geom.get_all_cells()[self.domain.id] - elif self.domain_type == 'universe': - self.domain = geom.get_all_universes()[self.domain.id] - elif self.domain_type == 'material': - self.domain = geom.get_all_materials()[self.domain.id] - elif self.domain_type == 'mesh': - self.domain = statepoint.meshes[self.domain.id] - else: - msg = 'Unable to load data from a statepoint for domain type {0} ' \ - 'which is not yet supported'.format(self.domain_type) - raise ValueError(msg) - - # Use tally "slicing" to ensure that tallies correspond to our domain - # NOTE: This is important if tally merging was used - if self.domain_type == 'mesh': - filters = [_DOMAIN_TO_FILTER[self.domain_type]] - xyz = [range(1, x + 1) for x in self.domain.dimension] - filter_bins = [tuple(itertools.product(*xyz))] - elif self.domain_type != 'distribcell': - filters = [_DOMAIN_TO_FILTER[self.domain_type]] - filter_bins = [(self.domain.id,)] - # Distribcell filters only accept single cell - neglect it when slicing - else: - filters = [] - filter_bins = [] - - # Clear any tallies previously loaded from a statepoint - if self.loaded_sp: - self._tallies = None - self._xs_tally = None - self._rxn_rate_tally = None - self._loaded_sp = False - - # Find, slice and store Tallies from StatePoint - # The tally slicing is needed if tally merging was used - for tally_type, tally in self.tallies.items(): - sp_tally = statepoint.get_tally( - tally.scores, tally.filters, tally.nuclides, - estimator=tally.estimator, exact_filters=True) - sp_tally = sp_tally.get_slice( - tally.scores, filters, filter_bins, tally.nuclides) - sp_tally.sparse = self.sparse - self._tallies[tally_type] = sp_tally - - # Load data for the tallies in each MGXS in the convolution - for mgxs in self.mgxs: - mgxs.load_from_statepoint(statepoint) - - self._loaded_sp = True - - -class ConsistentScatterMatrixXS(ConvolvedMGXS, ScatterMatrixXS): - r"""A scattering matrix multi-group cross section computed as the product - of the scatter cross section and group-to-group scattering probabilities. - - This class is a variation of the :class:`ScatterMatrixXS` which computes - the scattering matrix as the convolution product of :class:`ScatterXS` and - :class:`ScatterProbabilityMatrix`, and :class:`MultiplicityMatrix` if - multiplication from scattering multiplication is considered (optional). - Unlike the :class:`ScatterMatrixXS`, this scattering matrix is computed - from the scattering cross section which uses a tracklength estimator. - This ensures that reaction rate balance is exactly preserved with a - :class:`TotalXS` computed using a tracklength estimator. - - This class can be used for both OpenMC input generation and tally data - post-processing to compute spatially-homogenized and energy-integrated - multi-group cross sections for multi-group neutronics calculations. At a - minimum, one needs to set the - :attr:`ConsistentScatterMatrixXS.energy_groups` and - :attr:`ConsistentScatterMatrixXS.domain` properties. Tallies for the flux - and appropriate reaction rates over the specified domain are generated - automatically via the :attr:`ConsistentScatterMatrixXS.tallies` property, - which can then be appended to a :class:`openmc.Tallies` instance. - - For post-processing, the :meth:`MGXS.load_from_statepoint` will pull in the - necessary data to compute multi-group cross sections from a - :class:`openmc.StatePoint` instance. The derived multi-group cross section - can then be obtained from the :attr:`ConsistentScatterMatrixXS.xs_tally` - property. - - For a scattering probability matrix :math:`P_{s,\ell,g'\rightarrow g}` and - scattering cross section :math:`\sigma_s (r, E)` for incoming energy group - :math:`[E_{g'},E_{g'-1}]` and outgoing energy group :math:`[E_g,E_{g-1}]`, - the Legendre scattering moments are calculated as: - - .. math:: - - \sigma_{s,\ell,g'\rightarrow g} = \sigma_s (r, E) \times - P_{s,\ell,g'\rightarrow g} - - To incorporate the effect of neutron multiplication from (n,xn) reactions - in the above scattering matrix, the `nu` parameter can be set to `True` - such that the Legendre scattering moments are calculated as: - - .. math:: - - \sigma_{s,\ell,g'\rightarrow g} = \upsilon_{g'\rightarrow g} \times - \sigma_s (r, E) \times P_{s,\ell,g'\rightarrow g} - - Parameters - ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh - The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - The domain type for spatial homogenization - groups : openmc.mgxs.EnergyGroups - The energy group structure for energy condensation - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - name : str, optional - Name of the multi-group cross section. Used as a label to identify - tallies in OpenMC 'tallies.xml' file. - num_polar : Integral, optional - Number of equi-width polar angle bins for angle discretization; - defaults to one bin - num_azimuthal : Integral, optional - Number of equi-width azimuthal angle bins for angle discretization; - defaults to one bin - nu : bool - If True, the cross section data will include neutron multiplication; - defaults to False - - Attributes - ---------- - correction : 'P0' or None - Apply the P0 correction to scattering matrices if set to 'P0'; this is - used only if :attr:`ConsistentScatterMatrixXS.scatter_format` is - 'legendre' - scatter_format : {'legendre', or 'histogram'} - Representation of the angular scattering distribution (default is - 'legendre') - legendre_order : int - The highest Legendre moment in the scattering matrix; this is used if - :attr:`ConsistentScatterMatrixXS.scatter_format` is 'legendre'. - (default is 0) - histogram_bins : int - The number of equally-spaced bins for the histogram representation of - the angular scattering distribution; this is used if - :attr:`ConsistentScatterMatrixXS.scatter_format` is 'histogram'. - (default is 16) - name : str, optional - Name of the multi-group cross section - rxn_type : str - Reaction type (e.g., 'total', 'nu-fission', etc.) - nu : bool - If True, the cross section data will include neutron multiplication - by_nuclide : bool - If true, computes cross sections for each nuclide in domain - domain : Material or Cell or Universe or Mesh - Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} - Domain type for spatial homogenization - energy_groups : openmc.mgxs.EnergyGroups - Energy group structure for energy condensation - num_polar : Integral - Number of equi-width polar angle bins for angle discretization - num_azimuthal : Integral - Number of equi-width azimuthal angle bins for angle discretization - tally_trigger : openmc.Trigger - An (optional) tally precision trigger given to each tally used to - compute the cross section - scores : list of str - The scores in each tally used to compute the multi-group cross section - filters : list of openmc.Filter - The filters in each tally used to compute the multi-group cross section - tally_keys : list of str - The keys into the tallies dictionary for each tally used to compute - the multi-group cross section - 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 - are strings listed in the :attr:`ConsistentScatterMatrixXS.tally_keys` - property - and values are instances of :class:`openmc.Tally`. - rxn_rate_tally : openmc.Tally - Derived tally for the reaction rate tally used in the numerator to - compute the multi-group cross section. This attribute is None - unless the multi-group cross section has been computed. - xs_tally : openmc.Tally - Derived tally for the multi-group cross section. This attribute - is None unless the multi-group cross section has been computed. - num_subdomains : int - The number of subdomains is unity for 'material', 'cell' and 'universe' - domain types. This is equal to the number of cell instances - for 'distribcell' domain types (it is equal to unity prior to loading - tally data from a statepoint file). - num_nuclides : int - The number of nuclides for which the multi-group cross section is - being tracked. This is unity if the by_nuclide attribute is False. - nuclides : Iterable of str or 'sum' - The optional user-specified nuclides for which to compute cross - sections (e.g., 'U238', 'O16'). If by_nuclide is True but nuclides - are not specified by the user, all nuclides in the spatial domain - are included. This attribute is 'sum' if by_nuclide is false. - sparse : bool - Whether or not the MGXS' tallies use SciPy's LIL sparse matrix format - for compressed data storage - loaded_sp : bool - Whether or not a statepoint file has been loaded with tally data - derived : bool - Whether or not the MGXS is merged from one or more other MGXS - hdf5_key : str - The key used to index multi-group cross sections in an HDF5 data store - - """ - - def __init__(self, domain=None, domain_type=None, groups=None, - by_nuclide=False, name='', num_polar=1, - num_azimuthal=1, nu=False): - super(ConsistentScatterMatrixXS, self).__init__( - domain, domain_type, groups, by_nuclide=by_nuclide, - name=name, num_polar=num_polar, num_azimuthal=num_azimuthal) - - self.nu = nu - - # Initialize each MGXS used by the convolution - self._mgxs = \ - [ScatterXS(), ScatterProbabilityMatrix(), MultiplicityMatrixXS()] - - # Assign parameters to each MGXS in the convlution - for mgxs in self.mgxs: - mgxs.name = name - mgxs.by_nuclide = by_nuclide - mgxs.nu = nu - - if domain_type is not None: - mgxs.domain_type = domain_type - if domain is not None: - mgxs.domain = domain - if groups is not None: - mgxs.energy_groups = groups - mgxs.num_polar = num_polar - mgxs.num_azimuthal = num_azimuthal - - @property - def scores(self): - scores = super(ConsistentScatterMatrixXS, self).scores - - # Add scores for transport correction - if self.correction == 'P0' and self.legendre_order == 0: - scores += ['{}-1'.format(self.rxn_type)] - - return scores - - @property - def filters(self): - filters = super(ConsistentScatterMatrixXS, self).filters - - # Add filters for transport correction - if self.correction == 'P0' and self.legendre_order == 0: - group_edges = self.energy_groups.group_edges - energyout = openmc.EnergyoutFilter(group_edges) - filters += self._add_angle_filters([[energyout]]) - - return filters - - @property - def tally_keys(self): - tally_keys = super(ConsistentScatterMatrixXS, self).tally_keys - - # Add key for transport correction tally - if self.correction == 'P0' and self.legendre_order == 0: - tally_keys += ['{}-1'.format(self.rxn_type)] - - return tally_keys - - @property - def tallies(self): - - if self._tallies is None: - self._tallies = super(ConsistentScatterMatrixXS, self).tallies - - # Add in the transport correction tally - if self.correction == 'P0' and self.legendre_order == 0: - tally_key = '{}-1'.format(self.rxn_type) - - # Create a domain Filter object - filter_type = _DOMAIN_TO_FILTER[self.domain_type] - if self.domain_type == 'mesh': - domain_filter = filter_type(self.domain) - else: - domain_filter = filter_type(self.domain.id) - - # Create each Tally needed to compute the multi group cross section - self._tallies[tally_key] = openmc.Tally(name=self.name) - self._tallies[tally_key].estimator = 'analog' - self._tallies[tally_key].scores = [self.scores[-1]] - self._tallies[tally_key].filters = [domain_filter] - self._tallies[tally_key].filters.extend(self.filters[-1]) - - # If a tally trigger was specified, add it to each tally - if self.tally_trigger: - trigger_clone = copy.deepcopy(self.tally_trigger) - trigger_clone.scores = [self.scores[-1]] - self._tallies[tally_key].triggers.append(trigger_clone) - - # If this is a by-nuclide cross-section, add nuclides to Tally - if self.by_nuclide: - self._tallies[tally_key].nuclides += self.get_nuclides() - else: - self._tallies[tally_key].nuclides.append('total') - - return self._tallies - - @property - def scatter_xs(self): - return self.mgxs[0] - - @property - def probability_matrix(self): - return self.mgxs[1] - - @property - def multiplicity_matrix(self): - return self.mgxs[2] - - @property - def rxn_rate_tally(self): - raise NotImplementedError('The reaction rate tally is not well defined ') - - @property - def xs_tally(self): - if self._xs_tally is None: - if self.tallies is None: - msg = 'Unable to get xs_tally since tallies have ' \ - 'not been loaded from a statepoint' - raise ValueError(msg) - - # If using P0 correction subtract scatter-1 from the diagonal - if self.correction == 'P0' and self.legendre_order == 0: - flux = self.tallies['{} : flux'.format(self.rxn_type)] - scatter_p0 = self.tallies['{0} : {0}'.format(self.rxn_type)] - scatter_p1 = self.tallies['{}-1'.format(self.rxn_type)] - - energy_filter = scatter_p0.find_filter(openmc.EnergyFilter) - energy_filter = copy.deepcopy(energy_filter) - scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) - correction = scatter_p1 / flux - else: - correction = 0. - - self._xs_tally = \ - self.scatter_xs.xs_tally * self.probability_matrix.xs_tally - - if self.nu: - self._xs_tally *= self.multiplicity_matrix.xs_tally - - self._xs_tally -= correction - self._compute_xs() - - return self._xs_tally - - @ScatterMatrixXS.correction.setter - def correction(self, correction): - ScatterMatrixXS.correction.fset(self, correction) - self.mgxs[2].correction = correction - - @ScatterMatrixXS.scatter_format.setter - def scatter_format(self, scatter_format): - ScatterMatrixXS.scatter_format.fset(self, scatter_format) - self.mgxs[1].scatter_format = scatter_format - - @ScatterMatrixXS.legendre_order.setter - def legendre_order(self, legendre_order): - ScatterMatrixXS.legendre_order.fset(self, legendre_order) - self.mgxs[1].legendre_order = legendre_order - - @ScatterMatrixXS.histogram_bins.setter - def histogram_bins(self, histogram_bins): - ScatterMatrixXS.histogram_bins.fset(self, histogram_bins) - self.mgxs[1].histogram_bins = histogram_bins - - @ScatterMatrixXS.nu.setter - def nu(self, nu): - cv.check_type('nu', nu, bool) - self._nu = nu - - if not nu: - self._rxn_type = 'scatter' - self._hdf5_key = 'consistent scatter matrix' - else: - self._rxn_type = 'nu-scatter' - self._hdf5_key = 'consistent nu-scatter matrix' - - for mgxs in self.mgxs: - mgxs.nu = nu - - def load_from_statepoint(self, statepoint): - """Extracts tallies in an OpenMC StatePoint with the data needed to - compute multi-group cross sections. - - This method is needed to compute cross section data from tallies - in an OpenMC StatePoint object. - - .. note:: The statepoint must be linked with an OpenMC Summary object. - - Parameters - ---------- - statepoint : openmc.StatePoint - An OpenMC StatePoint object with tally data - - Raises - ------ - ValueError - When this method is called with a statepoint that has not been - linked with a summary object. - - """ - - # Clear any tallies previously loaded from a statepoint - if self.loaded_sp: - self._tallies = None - self._xs_tally = None - self._rxn_rate_tally = None - self._loaded_sp = False - - if self.scatter_format == 'legendre': - # Expand scores to match the format in the statepoint - # e.g., "scatter-P2" -> "scatter-0", "scatter-1", "scatter-2" - tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) - tally_key = \ - '{} probability matrix : {}'.format(self.rxn_type, tally_key) - self.tallies[tally_key].scores = \ - [self.rxn_type + '-{}'.format(i) - for i in range(self.legendre_order + 1)] - elif self.scatter_format == 'histogram': - self.tallies[self.rxn_type].scores = [self.rxn_type] - - super(ConsistentScatterMatrixXS, self).load_from_statepoint(statepoint) - - def get_condensed_xs(self, coarse_groups): - condense_xs = \ - super(ConsistentScatterMatrixXS, self).get_condensed_xs(coarse_groups) - - for i, mgxs in enumerate(condense_xs._mgxs): - condense_xs._mgxs[i] = mgxs.get_condensed_xs(coarse_groups) - - return condense_xs - - def get_subdomain_avg_xs(self, subdomains='all'): - avg_xs = \ - super(ConsistentScatterMatrixXS, self).get_subdomain_avg_xs(subdomains) - - for i, mgxs in enumerate(avg_xs._mgxs): - avg_xs._mgxs[i] = mgxs.get_subdomain_avg_xs(subdomains) - - return avg_xs - - class NuFissionMatrixXS(MatrixMGXS): r"""A fission production matrix multi-group cross section. From 2ab390c75bc60aec7ca94f4a91a565c622b7aaf0 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Fri, 3 Mar 2017 11:16:44 -0500 Subject: [PATCH 26/40] Refactored openmc.mgxs.ScatterProbabilityMatrix to only calculate for scattering moment probabilities --- openmc/mgxs/mgxs.py | 691 +----------------- .../inputs_true.dat | 524 +++++++------ .../results_true.dat | 6 - .../inputs_true.dat | 100 ++- .../results_true.dat | 2 - tests/test_mgxs_library_hdf5/inputs_true.dat | 524 +++++++------ tests/test_mgxs_library_mesh/inputs_true.dat | 100 ++- tests/test_mgxs_library_mesh/results_true.dat | 6 - .../inputs_true.dat | 524 +++++++------ .../results_true.dat | 15 - .../inputs_true.dat | 454 ++++++------ .../results_true.dat | 2 +- 12 files changed, 1071 insertions(+), 1877 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 4b08cfb8f..68cbbbe8f 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -33,7 +33,6 @@ MGXS_TYPES = ['total', 'multiplicity matrix', 'nu-fission matrix', 'scatter probability matrix', - 'nu-scatter probability matrix', 'consistent scatter matrix', 'consistent nu-scatter matrix', 'chi', @@ -737,9 +736,6 @@ class MGXS(object): mgxs = MultiplicityMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'scatter probability matrix': mgxs = ScatterProbabilityMatrix(domain, domain_type, energy_groups) - elif mgxs_type == 'nu-scatter probability matrix': - mgxs = ScatterProbabilityMatrix( - domain, domain_type, energy_groups, nu=True) elif mgxs_type == 'consistent scatter matrix': mgxs = ScatterMatrixXS(domain, domain_type, energy_groups) mgxs.formulation = 'consistent' @@ -3559,7 +3555,7 @@ class ScatterMatrixXS(MatrixMGXS): group-to-group scattering probabilities. Unlike the default 'simple' formulation, the 'consistent' formulation - is computed from the groupwise cattering cross section which uses a + is computed from the groupwise scattering cross section which uses a tracklength estimator. This ensures that reaction rate balance is exactly preserved with a :class:`TotalXS` computed using a tracklength estimator. @@ -4800,21 +4796,17 @@ class ScatterProbabilityMatrix(MatrixMGXS): .. math:: - \langle \sigma_{s,\ell,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr + \langle \sigma_{s,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega - \int_{E_g}^{E_{g-1}} dE \; P_\ell (\Omega \cdot \Omega') - \sigma_{s} (r, E' \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', - \Omega')\\ + \int_{E_g}^{E_{g-1}} dE \; \sigma_{s} (r, E' \rightarrow E, \Omega' + \cdot \Omega) \psi(r, E', \Omega')\\ \langle \sigma_{s,0,g'} \phi \rangle &= \int_{r \in V} dr \int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega \int_{0}^{\infty} dE \; \sigma_s (r, E' \rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\ - P_{s,\ell,g'\rightarrow g} &= \frac{\langle - \sigma_{s,\ell,g'\rightarrow g} \phi \rangle}{\langle - \sigma_{s,0,g'} \phi \rangle} - - To incorporate the effect of neutron multiplication from (n,xn) reactions - in the above probability matrix, the `nu` parameter can be set to `True`. + P_{s,g'\rightarrow g} &= \frac{\langle + \sigma_{s,g'\rightarrow g} \phi \rangle}{\langle + \sigma_{s,g'} \phi \rangle} Parameters ---------- @@ -4835,30 +4827,13 @@ class ScatterProbabilityMatrix(MatrixMGXS): num_azimuthal : Integral, optional Number of equi-width azimuthal angle bins for angle discretization; defaults to one bin - nu : bool - If True, the cross section data will include neutron multiplication; - defaults to False Attributes ---------- - scatter_format : {'legendre', or 'histogram'} - Representation of the angular scattering distribution (default is - 'legendre') - legendre_order : int - The highest Legendre moment in the scattering matrix; this is used if - :attr:`ScatterProbabilityMatrix.scatter_format` is 'legendre'. - (default is 0) - histogram_bins : int - The number of equally-spaced bins for the histogram representation of - the angular scattering distribution; this is used if - :attr:`ScatterProbabilityMatrix.scatter_format` is 'histogram'. - (default is 16) name : str, optional Name of the multi-group cross section rxn_type : str Reaction type (e.g., 'total', 'nu-fission', etc.) - nu : bool - If True, the cross section data will include neutron multiplication by_nuclide : bool If true, computes cross sections for each nuclide in domain domain : Material or Cell or Universe or Mesh @@ -4920,65 +4895,18 @@ class ScatterProbabilityMatrix(MatrixMGXS): """ def __init__(self, domain=None, domain_type=None, groups=None, - by_nuclide=False, name='', num_polar=1, - num_azimuthal=1, nu=False): + by_nuclide=False, name='', num_polar=1, num_azimuthal=1): super(ScatterProbabilityMatrix, self).__init__( domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - self._scatter_format = 'legendre' - self._legendre_order = 0 - self._histogram_bins = 16 + self._rxn_type = 'scatter' self._estimator = 'analog' self._valid_estimators = ['analog'] - self.nu = nu - - def __deepcopy__(self, memo): - clone = super(ScatterProbabilityMatrix, self).__deepcopy__(memo) - clone._scatter_format = self.scatter_format - clone._legendre_order = self.legendre_order - clone._histogram_bins = self.histogram_bins - clone._nu = self.nu - return clone - - @property - def _dont_squeeze(self): - """Create a tuple of axes which should not be removed during the get_xs - process - """ - if self.num_polar > 1 or self.num_azimuthal > 1: - if self.scatter_format == 'histogram': - return (0, 1, 3, 4, 5) - else: - return (0, 1, 3, 4) - else: - if self.scatter_format == 'histogram': - return (1, 2, 3) - else: - return (1, 2) - - @property - def scatter_format(self): - return self._scatter_format - - @property - def legendre_order(self): - return self._legendre_order - - @property - def histogram_bins(self): - return self._histogram_bins - - @property - def nu(self): - return self._nu @property def scores(self): - if self.scatter_format == 'legendre': - return ['{}-P{}'.format(self.rxn_type, self.legendre_order)] - elif self.scatter_format == 'histogram': - return [self.rxn_type] + return [self.rxn_type] @property def filters(self): @@ -4991,17 +4919,9 @@ class ScatterProbabilityMatrix(MatrixMGXS): @property def rxn_rate_tally(self): - if self._rxn_rate_tally is None: - if self.scatter_format == 'legendre': - tally_key = '{}-P{}'.format(self.rxn_type, - self.legendre_order) - self._rxn_rate_tally = self.tallies[tally_key] - elif self.scatter_format == 'histogram': - self._rxn_rate_tally = self.tallies[self.rxn_type] - + self._rxn_rate_tally = self.tallies[self.rxn_type] self._rxn_rate_tally.sparse = self.sparse - return self._rxn_rate_tally @property @@ -5010,8 +4930,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): if self._xs_tally is None: energyout_bins = [self.energy_groups.get_group_bounds(i) for i in range(self.num_groups, 0, -1)] - norm = self.rxn_rate_tally.get_slice( - scores=['{}-0'.format(self.rxn_type)]) + norm = self.rxn_rate_tally.get_slice(scores=[self.rxn_type]) norm = norm.summation( filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) @@ -5019,595 +4938,11 @@ class ScatterProbabilityMatrix(MatrixMGXS): norm._filters = norm._filters[:2] # Compute the group-to-group probabilities - tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) - self._xs_tally = self.tallies[tally_key] / norm + self._xs_tally = self.tallies[self.rxn_type] / norm super(ScatterProbabilityMatrix, self)._compute_xs() return self._xs_tally - @scatter_format.setter - def scatter_format(self, scatter_format): - cv.check_value('scatter_format', scatter_format, MU_TREATMENTS) - self._scatter_format = scatter_format - - @legendre_order.setter - def legendre_order(self, legendre_order): - cv.check_type('legendre_order', legendre_order, Integral) - cv.check_greater_than('legendre_order', legendre_order, 0, - equality=True) - cv.check_less_than('legendre_order', legendre_order, _MAX_LEGENDRE, - equality=True) - - if self.scatter_format == 'histogram': - msg = 'The legendre order will be ignored since the ' \ - 'scatter format is set to histogram' - warnings.warn(msg) - - self._legendre_order = legendre_order - - @histogram_bins.setter - def histogram_bins(self, histogram_bins): - cv.check_type('histogram_bins', histogram_bins, Integral) - cv.check_greater_than('histogram_bins', histogram_bins, 0) - self._histogram_bins = histogram_bins - - @nu.setter - def nu(self, nu): - cv.check_type('nu', nu, bool) - self._nu = nu - if not nu: - self._rxn_type = 'scatter' - self._hdf5_key = 'scatter probability matrix' - else: - self._rxn_type = 'nu-scatter' - self._hdf5_key = 'nu-scatter probability matrix' - - def load_from_statepoint(self, statepoint): - """Extracts tallies in an OpenMC StatePoint with the data needed to - compute multi-group cross sections. - - This method is needed to compute cross section data from tallies - in an OpenMC StatePoint object. - - .. note:: The statepoint must be linked with an OpenMC Summary object. - - Parameters - ---------- - statepoint : openmc.StatePoint - An OpenMC StatePoint object with tally data - - Raises - ------ - ValueError - When this method is called with a statepoint that has not been - linked with a summary object. - - """ - - # Clear any tallies previously loaded from a statepoint - if self.loaded_sp: - self._tallies = None - self._xs_tally = None - self._rxn_rate_tally = None - self._loaded_sp = False - - if self.scatter_format == 'legendre': - # Expand scores to match the format in the statepoint - # e.g., "scatter-P2" -> "scatter-0", "scatter-1", "scatter-2" - tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) - self.tallies[tally_key].scores = \ - [self.rxn_type + '-{}'.format(i) - for i in range(self.legendre_order + 1)] - elif self.scatter_format == 'histogram': - self.tallies[self.rxn_type].scores = [self.rxn_type] - - super(ScatterProbabilityMatrix, self).load_from_statepoint(statepoint) - - def get_slice(self, nuclides=[], in_groups=[], out_groups=[], - legendre_order='same'): - """Build a sliced ScatterProbabilityMatrix for the specified nuclides - and energy groups. - - This method constructs a new MGXS to encapsulate a subset of the data - represented by this MGXS. The subset of data to include in the tally - slice is determined by the nuclides and energy groups specified in - the input parameters. - - Parameters - ---------- - nuclides : list of str - A list of nuclide name strings - (e.g., ['U235', 'U238']; default is []) - in_groups : list of int - A list of incoming energy group indices starting at 1 for the high - energies (e.g., [1, 2, 3]; default is []) - out_groups : list of int - A list of outgoing energy group indices starting at 1 for the high - energies (e.g., [1, 2, 3]; default is []) - legendre_order : int or 'same' - The highest Legendre moment in the sliced MGXS. If order is 'same' - then the sliced MGXS will have the same Legendre moments as the - original MGXS (default). If order is an integer less than the - original MGXS' order, then only those Legendre moments up to that - order will be included in the sliced MGXS. - - Returns - ------- - openmc.mgxs.MatrixMGXS - A new MatrixMGXS which encapsulates the subset of data requested - for the nuclide(s) and/or energy group(s) requested in the - parameters. - - """ - - # Call super class method and null out derived tallies - slice_xs = \ - super(ScatterProbabilityMatrix, self).get_slice(nuclides, in_groups) - slice_xs._rxn_rate_tally = None - slice_xs._xs_tally = None - - # Slice the Legendre order if needed - if legendre_order != 'same' and self.scatter_format == 'legendre': - cv.check_type('legendre_order', legendre_order, Integral) - cv.check_less_than('legendre_order', legendre_order, - self.legendre_order, equality=True) - slice_xs.legendre_order = legendre_order - - # Slice the scattering tally - tally_key = '{}-P{}'.format(self.rxn_type, self.legendre_order) - expand_scores = \ - [self.rxn_type + '-{}'.format(i) - for i in range(self.legendre_order + 1)] - slice_xs.tallies[tally_key] = \ - slice_xs.tallies[tally_key].get_slice(scores=expand_scores) - - # Slice outgoing energy groups if needed - if len(out_groups) != 0: - filter_bins = [] - for group in out_groups: - group_bounds = self.energy_groups.get_group_bounds(group) - filter_bins.append(group_bounds) - filter_bins = [tuple(filter_bins)] - - # Slice each of the tallies across energyout groups - for tally_type, tally in slice_xs.tallies.items(): - if tally.contains_filter(openmc.EnergyoutFilter): - tally_slice = tally.get_slice( - filters=[openmc.EnergyoutFilter], filter_bins=filter_bins) - slice_xs.tallies[tally_type] = tally_slice - - slice_xs.sparse = self.sparse - return slice_xs - - def get_xs(self, in_groups='all', out_groups='all', - subdomains='all', nuclides='all', moment='all', - xs_type='macro', order_groups='increasing', - row_column='inout', value='mean', squeeze=True): - r"""Returns an array of multi-group cross sections. - - This method constructs a 5D NumPy array for the requested - multi-group cross section data for one or more subdomains - (1st dimension), energy groups in (2nd dimension), energy groups out - (3rd dimension), nuclides (4th dimension), and moments/histograms - (5th dimension). - - Parameters - ---------- - in_groups : Iterable of Integral or 'all' - Incoming energy groups of interest. Defaults to 'all'. - out_groups : Iterable of Integral or 'all' - Outgoing energy groups of interest. Defaults to 'all'. - subdomains : Iterable of Integral or 'all' - Subdomain IDs of interest. Defaults to 'all'. - nuclides : Iterable of str or 'all' or 'sum' - A list of nuclide name strings (e.g., ['U235', 'U238']). The - special string 'all' will return the cross sections for all nuclides - in the spatial domain. The special string 'sum' will return the - cross section summed over all nuclides. Defaults to 'all'. - moment : int or 'all' - The scattering matrix moment to return. All moments will be - returned if the moment is 'all' (default); otherwise, a specific - moment will be returned. - xs_type: {'macro', 'micro'} - Return the macro or micro cross section in units of cm^-1 or barns. - Defaults to 'macro'. - order_groups: {'increasing', 'decreasing'} - Return the cross section indexed according to increasing or - decreasing energy groups (decreasing or increasing energies). - Defaults to 'increasing'. - row_column: {'inout', 'outin'} - Return the cross section indexed first by incoming group and - second by outgoing group ('inout'), or vice versa ('outin'). - Defaults to 'inout'. - value : {'mean', 'std_dev', 'rel_err'} - A string for the type of value to return. Defaults to 'mean'. - squeeze : bool - A boolean representing whether to eliminate the extra dimensions - of the multi-dimensional array to be returned. Defaults to True. - - Returns - ------- - numpy.ndarray - A NumPy array of the multi-group cross section indexed in the order - each group and subdomain is listed in the parameters. - - Raises - ------ - ValueError - When this method is called before the multi-group cross section is - computed from tally data. - - """ - - cv.check_value('value', value, ['mean', 'std_dev', 'rel_err']) - cv.check_value('xs_type', xs_type, ['macro', 'micro']) - - # FIXME: Unable to get microscopic xs for mesh domain because the mesh - # cells do not know the nuclide densities in each mesh cell. - if self.domain_type == 'mesh' and xs_type == 'micro': - msg = 'Unable to get micro xs for mesh domain since the mesh ' \ - 'cells do not know the nuclide densities in each mesh cell.' - raise ValueError(msg) - - filters = [] - filter_bins = [] - - # Construct a collection of the domain filter bins - if not isinstance(subdomains, string_types): - cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=3) - filters.append(_DOMAIN_TO_FILTER[self.domain_type]) - subdomain_bins = [] - for subdomain in subdomains: - subdomain_bins.append(subdomain) - filter_bins.append(tuple(subdomain_bins)) - - # Construct list of energy group bounds tuples for all requested groups - if not isinstance(in_groups, string_types): - cv.check_iterable_type('groups', in_groups, Integral) - filters.append(openmc.EnergyFilter) - energy_bins = [] - for group in in_groups: - energy_bins.append( - (self.energy_groups.get_group_bounds(group),)) - filter_bins.append(tuple(energy_bins)) - - # Construct list of energy group bounds tuples for all requested groups - if not isinstance(out_groups, string_types): - cv.check_iterable_type('groups', out_groups, Integral) - for group in out_groups: - filters.append(openmc.EnergyoutFilter) - filter_bins.append((self.energy_groups.get_group_bounds(group),)) - - # Construct CrossScore for requested scattering moment - if moment != 'all' and self.scatter_format == 'legendre': - cv.check_type('moment', moment, Integral) - cv.check_greater_than('moment', moment, 0, equality=True) - cv.check_less_than( - 'moment', moment, self.legendre_order, equality=True) - scores = [self.xs_tally.scores[moment]] - else: - scores = [] - - # Construct a collection of the nuclides to retrieve from the xs tally - if self.by_nuclide: - if nuclides == 'all' or nuclides == 'sum' or nuclides == ['sum']: - query_nuclides = self.get_nuclides() - else: - query_nuclides = nuclides - else: - query_nuclides = ['total'] - - # Use tally summation if user requested the sum for all nuclides - if nuclides == 'sum' or nuclides == ['sum']: - xs_tally = self.xs_tally.summation(nuclides=query_nuclides) - xs = xs_tally.get_values(scores=scores, filters=filters, - filter_bins=filter_bins, value=value) - else: - xs = self.xs_tally.get_values(scores=scores, filters=filters, - filter_bins=filter_bins, - nuclides=query_nuclides, value=value) - - # Divide by atom number densities for microscopic cross sections - if xs_type == 'micro': - if self.by_nuclide: - densities = self.get_nuclide_densities(nuclides) - else: - densities = self.get_nuclide_densities('sum') - if value == 'mean' or value == 'std_dev': - xs /= densities[np.newaxis, :, np.newaxis] - - # Convert and nans to zero - xs = np.nan_to_num(xs) - - if in_groups == 'all': - num_in_groups = self.num_groups - else: - num_in_groups = len(in_groups) - - if out_groups == 'all': - num_out_groups = self.num_groups - else: - num_out_groups = len(out_groups) - - if self.scatter_format == 'histogram': - num_mu_bins = self.histogram_bins - else: - num_mu_bins = 1 - - # Reshape tally data array with separate axes for domain and energy - # Accomodate the polar and azimuthal bins if needed - num_subdomains = int(xs.shape[0] / (num_mu_bins * num_in_groups * - num_out_groups * self.num_polar * - self.num_azimuthal)) - if self.num_polar > 1 or self.num_azimuthal > 1: - if self.scatter_format == 'histogram': - new_shape = (self.num_polar, self.num_azimuthal, - num_subdomains, num_in_groups, num_out_groups, - num_mu_bins) - else: - new_shape = (self.num_polar, self.num_azimuthal, - num_subdomains, num_in_groups, num_out_groups) - new_shape += xs.shape[1:] - xs = np.reshape(xs, new_shape) - - # Transpose the scattering matrix if requested by user - if row_column == 'outin': - xs = np.swapaxes(xs, 3, 4) - - # Reverse data if user requested increasing energy groups since - # tally data is stored in order of increasing energies - if order_groups == 'increasing': - xs = xs[:, :, :, ::-1, ::-1, ...] - else: - if self.scatter_format == 'histogram': - new_shape = (num_subdomains, num_in_groups, num_out_groups, - num_mu_bins) - else: - new_shape = (num_subdomains, num_in_groups, num_out_groups) - new_shape += xs.shape[1:] - xs = np.reshape(xs, new_shape) - - # Transpose the scattering matrix if requested by user - if row_column == 'outin': - xs = np.swapaxes(xs, 1, 2) - - # Reverse data if user requested increasing energy groups since - # tally data is stored in order of increasing energies - if order_groups == 'increasing': - xs = xs[:, ::-1, ::-1, ...] - - if squeeze: - # We want to squeeze out everything but the angles, in_groups, - # out_groups, and, if needed, num_mu_bins dimension. These must - # not be squeezed so 1-group, 1-angle problems have the correct - # shape. - xs = self._squeeze_xs(xs) - return xs - - def get_pandas_dataframe(self, groups='all', nuclides='all', moment='all', - xs_type='macro', distribcell_paths=True): - """Build a Pandas DataFrame for the MGXS data. - - This method leverages :meth:`openmc.Tally.get_pandas_dataframe`, but - renames the columns with terminology appropriate for cross section data. - - Parameters - ---------- - groups : Iterable of Integral or 'all' - Energy groups of interest. Defaults to 'all'. - nuclides : Iterable of str or 'all' or 'sum' - The nuclides of the cross-sections to include in the dataframe. This - may be a list of nuclide name strings (e.g., ['U235', 'U238']). - The special string 'all' will include the cross sections for all - nuclides in the spatial domain. The special string 'sum' will - include the cross sections summed over all nuclides. Defaults - to 'all'. - moment : int or 'all' - The scattering matrix moment to return. All moments will be - returned if the moment is 'all' (default); otherwise, a specific - moment will be returned. - xs_type: {'macro', 'micro'} - Return macro or micro cross section in units of cm^-1 or barns. - Defaults to 'macro'. - distribcell_paths : bool, optional - Construct columns for distribcell tally filters (default is True). - The geometric information in the Summary object is embedded into a - Multi-index column with a geometric "path" to each distribcell - instance. - - Returns - ------- - pandas.DataFrame - A Pandas DataFrame for the cross section data. - - Raises - ------ - ValueError - When this method is called before the multi-group cross section is - computed from tally data. - - """ - - df = super(ScatterProbabilityMatrix, self).get_pandas_dataframe( - groups, nuclides, xs_type, distribcell_paths) - - if self.scatter_format == 'legendre': - # Add a moment column to dataframe - if self.legendre_order > 0: - # Insert a column corresponding to the Legendre moments - moments = ['P{}'.format(i) - for i in range(self.legendre_order + 1)] - moments = np.tile(moments, int(df.shape[0] / len(moments))) - df['moment'] = moments - - # Place the moment column before the mean column - columns = df.columns.tolist() - mean_index \ - = [i for i, s in enumerate(columns) if 'mean' in s][0] - if self.domain_type == 'mesh': - df = df[columns[:mean_index] + [('moment', '')] + - columns[mean_index:-1]] - else: - df = df[columns[:mean_index] + ['moment'] + - columns[mean_index:-1]] - - # Select rows corresponding to requested scattering moment - if moment != 'all': - cv.check_type('moment', moment, Integral) - cv.check_greater_than('moment', moment, 0, equality=True) - cv.check_less_than( - 'moment', moment, self.legendre_order, equality=True) - df = df[df['moment'] == 'P{}'.format(moment)] - - return df - - def print_xs(self, subdomains='all', nuclides='all', - xs_type='macro', moment=0): - """Prints a string representation for the multi-group cross section. - - Parameters - ---------- - subdomains : Iterable of Integral or 'all' - The subdomain IDs of the cross sections to include in the report. - Defaults to 'all'. - nuclides : Iterable of str or 'all' or 'sum' - The nuclides of the cross-sections to include in the report. This - may be a list of nuclide name strings (e.g., ['U235', 'U238']). - The special string 'all' will report the cross sections for all - nuclides in the spatial domain. The special string 'sum' will report - the cross sections summed over all nuclides. Defaults to 'all'. - xs_type: {'macro', 'micro'} - Return the macro or micro cross section in units of cm^-1 or barns. - Defaults to 'macro'. - moment : int - The scattering moment to print (default is 0) - - """ - - # Construct a collection of the subdomains to report - if not isinstance(subdomains, string_types): - cv.check_iterable_type('subdomains', subdomains, Integral) - elif self.domain_type == 'distribcell': - subdomains = np.arange(self.num_subdomains, dtype=np.int) - elif self.domain_type == 'mesh': - xyz = [range(1, x + 1) for x in self.domain.dimension] - subdomains = list(itertools.product(*xyz)) - else: - subdomains = [self.domain.id] - - # Construct a collection of the nuclides to report - if self.by_nuclide: - if nuclides == 'all': - nuclides = self.get_nuclides() - if nuclides == 'sum': - nuclides = ['sum'] - else: - cv.check_iterable_type('nuclides', nuclides, string_types) - else: - nuclides = ['sum'] - - cv.check_value('xs_type', xs_type, ['macro', 'micro']) - - if self.scatter_format == 'legendre': - rxn_type = '{0} (P{1})'.format(self.rxn_type, moment) - else: - rxn_type = self.rxn_type - - # Build header for string with type and domain info - string = 'Multi-Group XS\n' - string += '{0: <16}=\t{1}\n'.format('\tReaction Type', rxn_type) - string += '{0: <16}=\t{1}\n'.format('\tDomain Type', self.domain_type) - string += '{0: <16}=\t{1}\n'.format('\tDomain ID', self.domain.id) - - # Generate the header for an individual XS - xs_header = '\tCross Sections [{0}]:'.format(self.get_units(xs_type)) - - # If cross section data has not been computed, only print string header - if self.tallies is None: - print(string) - return - - string += '{0: <16}\n'.format('\tEnergy Groups:') - template = '{0: <12}Group {1} [{2: <10} - {3: <10}eV]\n' - - # Loop over energy groups ranges - for group in range(1, self.num_groups + 1): - bounds = self.energy_groups.get_group_bounds(group) - string += template.format('', group, bounds[0], bounds[1]) - - # Set polar and azimuthal bins if necessary - if self.num_polar > 1 or self.num_azimuthal > 1: - pol_bins = np.linspace(0., np.pi, num=self.num_polar + 1, - endpoint=True) - azi_bins = np.linspace(-np.pi, np.pi, num=self.num_azimuthal + 1, - endpoint=True) - - # Loop over all subdomains - for subdomain in subdomains: - - if self.domain_type == 'distribcell' or self.domain_type == 'mesh': - string += '{0: <16}=\t{1}\n'.format('\tSubdomain', subdomain) - - # Loop over all Nuclides - for nuclide in nuclides: - - # Build header for nuclide type - if xs_type != 'sum': - string += '{0: <16}=\t{1}\n'.format('\tNuclide', nuclide) - - # Build header for cross section type - string += '{0: <16}\n'.format(xs_header) - template = '{0: <12}Group {1} -> Group {2}:\t\t' - - average_xs = self.get_xs(nuclides=[nuclide], - subdomains=[subdomain], - xs_type=xs_type, value='mean', - moment=moment) - rel_err_xs = self.get_xs(nuclides=[nuclide], - subdomains=[subdomain], - xs_type=xs_type, value='rel_err', - moment=moment) - rel_err_xs = rel_err_xs * 100. - - if self.num_polar > 1 or self.num_azimuthal > 1: - # Loop over polar, azi, and in/out energy group ranges - for pol in range(len(pol_bins) - 1): - pol_low, pol_high = pol_bins[pol: pol + 2] - for azi in range(len(azi_bins) - 1): - azi_low, azi_high = azi_bins[azi: azi + 2] - string += '\t\tPolar Angle: [{0:5f} - {1:5f}]'.format( - pol_low, pol_high) + \ - '\tAzimuthal Angle: [{0:5f} - {1:5f}]'.format( - azi_low, azi_high) + '\n' - for in_group in range(1, self.num_groups + 1): - for out_group in range(1, self.num_groups + 1): - string += '\t' + template.format('', - in_group, - out_group) - string += '{0:.2e} +/- {1:.2e}%'.format( - average_xs[pol, azi, in_group - 1, - out_group - 1], - rel_err_xs[pol, azi, in_group - 1, - out_group - 1]) - string += '\n' - string += '\n' - string += '\n' - else: - # Loop over incoming/outgoing energy groups ranges - for in_group in range(1, self.num_groups + 1): - for out_group in range(1, self.num_groups + 1): - string += template.format('', in_group, out_group) - string += '{0:.2e} +/- {1:.2e}%'.format( - average_xs[in_group - 1, out_group - 1], - rel_err_xs[in_group - 1, out_group - 1]) - string += '\n' - string += '\n' - string += '\n' - string += '\n' - string += '\n' - - print(string) - class NuFissionMatrixXS(MatrixMGXS): r"""A fission production matrix multi-group cross section. diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat index b4498e9d8..f2a7c9025 100644 --- a/tests/test_mgxs_library_condense/inputs_true.dat +++ b/tests/test_mgxs_library_condense/inputs_true.dat @@ -277,32 +277,24 @@ total - scatter-P0 + scatter analog - total - nu-scatter-P0 - analog + flux + tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - @@ -310,21 +302,21 @@ scatter-P3 analog - + total flux tracklength - + total scatter tracklength - + @@ -332,7 +324,7 @@ scatter-P3 analog - + @@ -340,7 +332,7 @@ nu-scatter-0 analog - + @@ -348,70 +340,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + - + total - nu-fission + prompt-nu-fission analog - + total prompt-nu-fission analog - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -419,14 +411,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -434,7 +426,7 @@ delayed-nu-fission tracklength - + @@ -442,7 +434,7 @@ delayed-nu-fission analog - + @@ -450,13 +442,21 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + @@ -466,14 +466,6 @@ tracklength - - - - total - delayed-nu-fission - tracklength - - @@ -481,14 +473,14 @@ decay-rate tracklength - + total flux analog - + @@ -497,175 +489,175 @@ delayed-nu-fission analog - + total flux tracklength + + + + total + total + tracklength + total - total - tracklength + flux + analog - - - total - flux - analog - - total total analog - + total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + total - absorption + flux tracklength total - flux + absorption tracklength total - absorption + fission tracklength total - fission + flux tracklength total - flux + fission tracklength total - fission + flux tracklength total - flux + nu-fission tracklength total - nu-fission + flux tracklength total - flux + kappa-fission tracklength total - kappa-fission + flux tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - total flux analog - + total nu-scatter analog - + total flux analog - + @@ -673,14 +665,14 @@ scatter-P3 analog - + total flux analog - + @@ -688,7 +680,7 @@ nu-scatter-P3 analog - + @@ -696,7 +688,7 @@ nu-scatter analog - + @@ -704,74 +696,66 @@ scatter analog - + total flux analog + + + + + total + nu-fission + analog + total - nu-fission + scatter analog - total - scatter-P0 - analog + flux + tracklength - total - nu-scatter-P0 - analog + scatter + tracklength + total - flux - tracklength + scatter-P3 + analog total - scatter + flux tracklength - - - - total - scatter-P3 - analog - - - - - total - flux - tracklength - - total scatter tracklength - + @@ -779,7 +763,7 @@ scatter-P3 analog - + @@ -787,7 +771,7 @@ nu-scatter-0 analog - + @@ -795,33 +779,47 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -834,31 +832,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -866,14 +850,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -881,7 +865,7 @@ delayed-nu-fission tracklength - + @@ -889,7 +873,7 @@ delayed-nu-fission analog - + @@ -897,30 +881,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -928,14 +912,14 @@ decay-rate tracklength - + total flux analog - + @@ -944,62 +928,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -1018,14 +1016,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -1046,7 +1044,7 @@ total - fission + nu-fission tracklength @@ -1060,7 +1058,7 @@ total - nu-fission + kappa-fission tracklength @@ -1074,7 +1072,7 @@ total - kappa-fission + scatter tracklength @@ -1082,14 +1080,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -1101,8 +1099,9 @@ + total - nu-scatter + scatter-P3 analog @@ -1113,21 +1112,6 @@ analog - - - - total - scatter-P3 - analog - - - - - total - flux - analog - - @@ -1135,7 +1119,7 @@ nu-scatter-P3 analog - + @@ -1143,7 +1127,7 @@ nu-scatter analog - + @@ -1151,14 +1135,14 @@ scatter analog - + total flux analog - + @@ -1166,20 +1150,34 @@ nu-fission analog - + total - scatter-P0 + scatter analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + total - nu-scatter-P0 + scatter-P3 analog @@ -1205,28 +1203,6 @@ analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - - - - - total - scatter-P3 - analog - - @@ -1234,7 +1210,7 @@ nu-scatter-0 analog - + @@ -1242,70 +1218,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -1313,14 +1289,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -1328,7 +1304,7 @@ delayed-nu-fission tracklength - + @@ -1336,7 +1312,7 @@ delayed-nu-fission analog - + @@ -1344,14 +1320,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1359,7 +1335,7 @@ delayed-nu-fission tracklength - + @@ -1367,7 +1343,7 @@ delayed-nu-fission tracklength - + @@ -1375,14 +1351,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat index d20a5ba0c..1892a17f2 100644 --- a/tests/test_mgxs_library_condense/results_true.dat +++ b/tests/test_mgxs_library_condense/results_true.dat @@ -33,8 +33,6 @@ material group in group out nuclide mean std. dev. 0 10000 1 1 total 0.085835 0.005592 material group in group out nuclide mean std. dev. -0 10000 1 1 total 1.0 0.066111 - material group in group out nuclide mean std. dev. 0 10000 1 1 total 1.0 0.066111 material group in group out nuclide moment mean std. dev. 0 10000 1 1 total P0 0.388721 0.031279 @@ -126,8 +124,6 @@ material group in group out nuclide mean std. dev. 0 10001 1 1 total 0.0 0.0 material group in group out nuclide mean std. dev. -0 10001 1 1 total 1.0 0.095039 - material group in group out nuclide mean std. dev. 0 10001 1 1 total 1.0 0.095039 material group in group out nuclide moment mean std. dev. 0 10001 1 1 total P0 0.309384 0.032376 @@ -219,8 +215,6 @@ material group in group out nuclide mean std. dev. 0 10002 1 1 total 0.0 0.0 material group in group out nuclide mean std. dev. -0 10002 1 1 total 1.0 0.056867 - material group in group out nuclide mean std. dev. 0 10002 1 1 total 1.0 0.056867 material group in group out nuclide moment mean std. dev. 0 10002 1 1 total P0 0.898938 0.067118 diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat index d2d338708..8e68ca8f0 100644 --- a/tests/test_mgxs_library_distribcell/inputs_true.dat +++ b/tests/test_mgxs_library_distribcell/inputs_true.dat @@ -304,32 +304,24 @@ total - scatter-P0 + scatter analog - total - nu-scatter-P0 - analog + flux + tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - @@ -337,21 +329,21 @@ scatter-P3 analog - + total flux tracklength - + total scatter tracklength - + @@ -359,7 +351,7 @@ scatter-P3 analog - + @@ -367,7 +359,7 @@ nu-scatter-0 analog - + @@ -375,70 +367,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + - + total - nu-fission + prompt-nu-fission analog - + total prompt-nu-fission analog - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -446,22 +438,22 @@ prompt-nu-fission analog - + total flux tracklength + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - @@ -469,7 +461,7 @@ delayed-nu-fission analog - + @@ -477,13 +469,21 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + @@ -493,14 +493,6 @@ tracklength - - - - total - delayed-nu-fission - tracklength - - @@ -508,14 +500,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat index 36e3203ba..e6ec539e6 100644 --- a/tests/test_mgxs_library_distribcell/results_true.dat +++ b/tests/test_mgxs_library_distribcell/results_true.dat @@ -34,8 +34,6 @@ 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total 0.094516 0.0059 sum(distribcell) 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 total 1.0 0.037213 - sum(distribcell) 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 total 1.0 0.037208 sum(distribcell) group in group out nuclide moment mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P0 0.390797 0.016955 1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 1 total P1 0.047641 0.005091 diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat index b4498e9d8..f2a7c9025 100644 --- a/tests/test_mgxs_library_hdf5/inputs_true.dat +++ b/tests/test_mgxs_library_hdf5/inputs_true.dat @@ -277,32 +277,24 @@ total - scatter-P0 + scatter analog - total - nu-scatter-P0 - analog + flux + tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - @@ -310,21 +302,21 @@ scatter-P3 analog - + total flux tracklength - + total scatter tracklength - + @@ -332,7 +324,7 @@ scatter-P3 analog - + @@ -340,7 +332,7 @@ nu-scatter-0 analog - + @@ -348,70 +340,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + - + total - nu-fission + prompt-nu-fission analog - + total prompt-nu-fission analog - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -419,14 +411,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -434,7 +426,7 @@ delayed-nu-fission tracklength - + @@ -442,7 +434,7 @@ delayed-nu-fission analog - + @@ -450,13 +442,21 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + @@ -466,14 +466,6 @@ tracklength - - - - total - delayed-nu-fission - tracklength - - @@ -481,14 +473,14 @@ decay-rate tracklength - + total flux analog - + @@ -497,175 +489,175 @@ delayed-nu-fission analog - + total flux tracklength + + + + total + total + tracklength + total - total - tracklength + flux + analog - - - total - flux - analog - - total total analog - + total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + total - absorption + flux tracklength total - flux + absorption tracklength total - absorption + fission tracklength total - fission + flux tracklength total - flux + fission tracklength total - fission + flux tracklength total - flux + nu-fission tracklength total - nu-fission + flux tracklength total - flux + kappa-fission tracklength total - kappa-fission + flux tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - total flux analog - + total nu-scatter analog - + total flux analog - + @@ -673,14 +665,14 @@ scatter-P3 analog - + total flux analog - + @@ -688,7 +680,7 @@ nu-scatter-P3 analog - + @@ -696,7 +688,7 @@ nu-scatter analog - + @@ -704,74 +696,66 @@ scatter analog - + total flux analog + + + + + total + nu-fission + analog + total - nu-fission + scatter analog - total - scatter-P0 - analog + flux + tracklength - total - nu-scatter-P0 - analog + scatter + tracklength + total - flux - tracklength + scatter-P3 + analog total - scatter + flux tracklength - - - - total - scatter-P3 - analog - - - - - total - flux - tracklength - - total scatter tracklength - + @@ -779,7 +763,7 @@ scatter-P3 analog - + @@ -787,7 +771,7 @@ nu-scatter-0 analog - + @@ -795,33 +779,47 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -834,31 +832,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -866,14 +850,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -881,7 +865,7 @@ delayed-nu-fission tracklength - + @@ -889,7 +873,7 @@ delayed-nu-fission analog - + @@ -897,30 +881,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -928,14 +912,14 @@ decay-rate tracklength - + total flux analog - + @@ -944,62 +928,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -1018,14 +1016,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -1046,7 +1044,7 @@ total - fission + nu-fission tracklength @@ -1060,7 +1058,7 @@ total - nu-fission + kappa-fission tracklength @@ -1074,7 +1072,7 @@ total - kappa-fission + scatter tracklength @@ -1082,14 +1080,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -1101,8 +1099,9 @@ + total - nu-scatter + scatter-P3 analog @@ -1113,21 +1112,6 @@ analog - - - - total - scatter-P3 - analog - - - - - total - flux - analog - - @@ -1135,7 +1119,7 @@ nu-scatter-P3 analog - + @@ -1143,7 +1127,7 @@ nu-scatter analog - + @@ -1151,14 +1135,14 @@ scatter analog - + total flux analog - + @@ -1166,20 +1150,34 @@ nu-fission analog - + total - scatter-P0 + scatter analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + total - nu-scatter-P0 + scatter-P3 analog @@ -1205,28 +1203,6 @@ analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - - - - - total - scatter-P3 - analog - - @@ -1234,7 +1210,7 @@ nu-scatter-0 analog - + @@ -1242,70 +1218,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -1313,14 +1289,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -1328,7 +1304,7 @@ delayed-nu-fission tracklength - + @@ -1336,7 +1312,7 @@ delayed-nu-fission analog - + @@ -1344,14 +1320,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1359,7 +1335,7 @@ delayed-nu-fission tracklength - + @@ -1367,7 +1343,7 @@ delayed-nu-fission tracklength - + @@ -1375,14 +1351,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_mesh/inputs_true.dat b/tests/test_mgxs_library_mesh/inputs_true.dat index fe38ef89d..b806bec91 100644 --- a/tests/test_mgxs_library_mesh/inputs_true.dat +++ b/tests/test_mgxs_library_mesh/inputs_true.dat @@ -541,32 +541,24 @@ total - scatter-P0 + scatter analog - total - nu-scatter-P0 - analog + flux + tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - @@ -574,21 +566,21 @@ scatter-P3 analog - + total flux tracklength - + total scatter tracklength - + @@ -596,7 +588,7 @@ scatter-P3 analog - + @@ -604,7 +596,7 @@ nu-scatter-0 analog - + @@ -612,70 +604,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + - + total - nu-fission + prompt-nu-fission analog - + total prompt-nu-fission analog - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -683,22 +675,22 @@ prompt-nu-fission analog - + total flux tracklength + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - @@ -706,7 +698,7 @@ delayed-nu-fission analog - + @@ -714,13 +706,21 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + @@ -730,14 +730,6 @@ tracklength - - - - total - delayed-nu-fission - tracklength - - @@ -745,14 +737,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat index f6c7a5718..28203268a 100644 --- a/tests/test_mgxs_library_mesh/results_true.dat +++ b/tests/test_mgxs_library_mesh/results_true.dat @@ -111,12 +111,6 @@ 0 1 1 1 1 1 total 1.0 0.153265 1 1 2 1 1 1 total 1.0 0.454973 2 2 1 1 1 1 total 1.0 0.146747 -3 2 2 1 1 1 total 1.0 0.141824 - mesh 1 group in group out nuclide mean std. dev. - x y z -0 1 1 1 1 1 total 1.0 0.153265 -1 1 2 1 1 1 total 1.0 0.454973 -2 2 1 1 1 1 total 1.0 0.146747 3 2 2 1 1 1 total 1.0 0.141824 mesh 1 group in group out nuclide moment mean std. dev. x y z diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat index b4498e9d8..f2a7c9025 100644 --- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat @@ -277,32 +277,24 @@ total - scatter-P0 + scatter analog - total - nu-scatter-P0 - analog + flux + tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - @@ -310,21 +302,21 @@ scatter-P3 analog - + total flux tracklength - + total scatter tracklength - + @@ -332,7 +324,7 @@ scatter-P3 analog - + @@ -340,7 +332,7 @@ nu-scatter-0 analog - + @@ -348,70 +340,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + - + total - nu-fission + prompt-nu-fission analog - + total prompt-nu-fission analog - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -419,14 +411,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -434,7 +426,7 @@ delayed-nu-fission tracklength - + @@ -442,7 +434,7 @@ delayed-nu-fission analog - + @@ -450,13 +442,21 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + @@ -466,14 +466,6 @@ tracklength - - - - total - delayed-nu-fission - tracklength - - @@ -481,14 +473,14 @@ decay-rate tracklength - + total flux analog - + @@ -497,175 +489,175 @@ delayed-nu-fission analog - + total flux tracklength + + + + total + total + tracklength + total - total - tracklength + flux + analog - - - total - flux - analog - - total total analog - + total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog - + total flux tracklength + + + + total + absorption + tracklength + total - absorption + flux tracklength total - flux + absorption tracklength total - absorption + fission tracklength total - fission + flux tracklength total - flux + fission tracklength total - fission + flux tracklength total - flux + nu-fission tracklength total - nu-fission + flux tracklength total - flux + kappa-fission tracklength total - kappa-fission + flux tracklength total - flux + scatter tracklength - - - total - scatter - tracklength - - total flux analog - + total nu-scatter analog - + total flux analog - + @@ -673,14 +665,14 @@ scatter-P3 analog - + total flux analog - + @@ -688,7 +680,7 @@ nu-scatter-P3 analog - + @@ -696,7 +688,7 @@ nu-scatter analog - + @@ -704,74 +696,66 @@ scatter analog - + total flux analog + + + + + total + nu-fission + analog + total - nu-fission + scatter analog - total - scatter-P0 - analog + flux + tracklength - total - nu-scatter-P0 - analog + scatter + tracklength + total - flux - tracklength + scatter-P3 + analog total - scatter + flux tracklength - - - - total - scatter-P3 - analog - - - - - total - flux - tracklength - - total scatter tracklength - + @@ -779,7 +763,7 @@ scatter-P3 analog - + @@ -787,7 +771,7 @@ nu-scatter-0 analog - + @@ -795,33 +779,47 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + total - nu-fission + prompt-nu-fission analog - + total - prompt-nu-fission - analog + flux + tracklength - + total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -834,31 +832,17 @@ total - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - total - prompt-nu-fission - tracklength - - total flux analog - + @@ -866,14 +850,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -881,7 +865,7 @@ delayed-nu-fission tracklength - + @@ -889,7 +873,7 @@ delayed-nu-fission analog - + @@ -897,30 +881,30 @@ delayed-nu-fission analog - + total nu-fission tracklength + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - - @@ -928,14 +912,14 @@ decay-rate tracklength - + total flux analog - + @@ -944,62 +928,76 @@ delayed-nu-fission analog + + + + total + flux + tracklength + + + + + total + total + tracklength + total flux - tracklength + analog total total - tracklength + analog - - - total - flux - analog - - - - - total - total - analog - - total scatter-1 analog - + total flux analog - + total total analog - + total nu-scatter-1 analog + + + + total + flux + tracklength + + + + + total + absorption + tracklength + @@ -1018,14 +1016,14 @@ total - flux + fission tracklength total - absorption + flux tracklength @@ -1046,7 +1044,7 @@ total - fission + nu-fission tracklength @@ -1060,7 +1058,7 @@ total - nu-fission + kappa-fission tracklength @@ -1074,7 +1072,7 @@ total - kappa-fission + scatter tracklength @@ -1082,14 +1080,14 @@ total flux - tracklength + analog total - scatter - tracklength + nu-scatter + analog @@ -1101,8 +1099,9 @@ + total - nu-scatter + scatter-P3 analog @@ -1113,21 +1112,6 @@ analog - - - - total - scatter-P3 - analog - - - - - total - flux - analog - - @@ -1135,7 +1119,7 @@ nu-scatter-P3 analog - + @@ -1143,7 +1127,7 @@ nu-scatter analog - + @@ -1151,14 +1135,14 @@ scatter analog - + total flux analog - + @@ -1166,20 +1150,34 @@ nu-fission analog - + total - scatter-P0 + scatter analog + + + + total + flux + tracklength + + + + + total + scatter + tracklength + total - nu-scatter-P0 + scatter-P3 analog @@ -1205,28 +1203,6 @@ analog - - - total - flux - tracklength - - - - - total - scatter - tracklength - - - - - - total - scatter-P3 - analog - - @@ -1234,7 +1210,7 @@ nu-scatter-0 analog - + @@ -1242,70 +1218,70 @@ scatter-0 analog - + total nu-fission analog + + + + total + nu-fission + analog + + + + + total + prompt-nu-fission + analog + + + + + total + prompt-nu-fission + analog + - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - total flux tracklength - + total inverse-velocity tracklength - + total flux tracklength - + total prompt-nu-fission tracklength - + total flux analog - + @@ -1313,14 +1289,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -1328,7 +1304,7 @@ delayed-nu-fission tracklength - + @@ -1336,7 +1312,7 @@ delayed-nu-fission analog - + @@ -1344,14 +1320,14 @@ delayed-nu-fission analog - + total nu-fission tracklength - + @@ -1359,7 +1335,7 @@ delayed-nu-fission tracklength - + @@ -1367,7 +1343,7 @@ delayed-nu-fission tracklength - + @@ -1375,14 +1351,14 @@ decay-rate tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat index 0cec56a25..85dc93377 100644 --- a/tests/test_mgxs_library_no_nuclides/results_true.dat +++ b/tests/test_mgxs_library_no_nuclides/results_true.dat @@ -76,11 +76,6 @@ 3 10000 1 1 total 0.997433 0.078224 2 10000 1 2 total 0.002567 0.001256 1 10000 2 1 total 0.002242 0.002243 -0 10000 2 2 total 0.997758 0.041053 - material group in group out nuclide mean std. dev. -3 10000 1 1 total 0.997433 0.078224 -2 10000 1 2 total 0.002567 0.001256 -1 10000 2 1 total 0.002242 0.002243 0 10000 2 2 total 0.997758 0.041053 material group in group out nuclide moment mean std. dev. 12 10000 1 1 total P0 0.386423 0.036629 @@ -288,11 +283,6 @@ 3 10001 1 1 total 1.0 0.108779 2 10001 1 2 total 0.0 0.000000 1 10001 2 1 total 0.0 0.000000 -0 10001 2 2 total 1.0 0.142427 - material group in group out nuclide mean std. dev. -3 10001 1 1 total 1.0 0.108779 -2 10001 1 2 total 0.0 0.000000 -1 10001 2 1 total 0.0 0.000000 0 10001 2 2 total 1.0 0.142427 material group in group out nuclide moment mean std. dev. 12 10001 1 1 total P0 0.312163 0.037253 @@ -500,11 +490,6 @@ 3 10002 1 1 total 0.953271 0.036018 2 10002 1 2 total 0.046729 0.002547 1 10002 2 1 total 0.000218 0.000219 -0 10002 2 2 total 0.999782 0.135885 - material group in group out nuclide mean std. dev. -3 10002 1 1 total 0.953271 0.036018 -2 10002 1 2 total 0.046729 0.002547 -1 10002 2 1 total 0.000218 0.000219 0 10002 2 2 total 0.999782 0.135885 material group in group out nuclide moment mean std. dev. 12 10002 1 1 total P0 0.632859 0.038142 diff --git a/tests/test_mgxs_library_nuclides/inputs_true.dat b/tests/test_mgxs_library_nuclides/inputs_true.dat index 3083ef903..8d7cf5fb8 100644 --- a/tests/test_mgxs_library_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_nuclides/inputs_true.dat @@ -277,32 +277,24 @@ U234 U235 U238 O16 - scatter-P0 + scatter analog - - - - U234 U235 U238 O16 - nu-scatter-P0 - analog - - total flux tracklength - + U234 U235 U238 O16 scatter tracklength - + @@ -310,26 +302,34 @@ scatter-P3 analog - + total flux tracklength - + U234 U235 U238 O16 scatter tracklength + + + + + U234 U235 U238 O16 + scatter-P3 + analog + U234 U235 U238 O16 - scatter-P3 + nu-scatter-0 analog @@ -337,81 +337,73 @@ U234 U235 U238 O16 - nu-scatter-0 + scatter-0 analog - - + U234 U235 U238 O16 - scatter-0 + nu-fission analog - + U234 U235 U238 O16 nu-fission analog - + U234 U235 U238 O16 - nu-fission + prompt-nu-fission analog - + U234 U235 U238 O16 prompt-nu-fission analog - - - U234 U235 U238 O16 - prompt-nu-fission - analog - - total flux tracklength - + U234 U235 U238 O16 inverse-velocity tracklength - + total flux tracklength - + U234 U235 U238 O16 prompt-nu-fission tracklength - + total flux analog - + @@ -419,175 +411,175 @@ prompt-nu-fission analog - + total flux tracklength + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + total + tracklength + - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - tracklength - - total flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 total analog - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter-1 analog - + total flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 total analog - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-scatter-1 analog - + total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 absorption tracklength - + total flux tracklength + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption + tracklength + Zr90 Zr91 Zr92 Zr94 Zr96 - absorption + fission tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - fission + total + flux tracklength - total - flux + Zr90 Zr91 Zr92 Zr94 Zr96 + fission tracklength - - - Zr90 Zr91 Zr92 Zr94 Zr96 - fission - tracklength - - total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-fission tracklength - + total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 kappa-fission tracklength - + total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength - + total flux analog - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-scatter analog - + total flux analog - + @@ -595,14 +587,14 @@ scatter-P3 analog - + total flux analog - + @@ -610,7 +602,7 @@ nu-scatter-P3 analog - + @@ -618,7 +610,7 @@ nu-scatter analog - + @@ -626,74 +618,66 @@ scatter analog - + total flux analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + scatter analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P0 - analog - - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P0 - analog - - total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-P3 + analog + + + + + total + flux + tracklength + - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 - analog - - - - - total - flux - tracklength - - Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength - + @@ -701,7 +685,7 @@ scatter-P3 analog - + @@ -709,7 +693,7 @@ nu-scatter-0 analog - + @@ -717,33 +701,47 @@ scatter-0 analog - + Zr90 Zr91 Zr92 Zr94 Zr96 nu-fission analog + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog + Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + prompt-nu-fission analog - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog + + total + flux + tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -756,31 +754,17 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - inverse-velocity + prompt-nu-fission tracklength - - - total - flux - tracklength - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - tracklength - - total flux analog - + @@ -788,62 +772,76 @@ prompt-nu-fission analog + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + total + tracklength + total flux - tracklength + analog H1 O16 B10 B11 total - tracklength + analog - - - total - flux - analog - - - - - H1 O16 B10 B11 - total - analog - - H1 O16 B10 B11 scatter-1 analog - + total flux analog - + H1 O16 B10 B11 total analog - + H1 O16 B10 B11 nu-scatter-1 analog + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + absorption + tracklength + @@ -861,15 +859,15 @@ - total - flux + H1 O16 B10 B11 + fission tracklength - H1 O16 B10 B11 - absorption + total + flux tracklength @@ -890,7 +888,7 @@ H1 O16 B10 B11 - fission + nu-fission tracklength @@ -904,7 +902,7 @@ H1 O16 B10 B11 - nu-fission + kappa-fission tracklength @@ -918,7 +916,7 @@ H1 O16 B10 B11 - kappa-fission + scatter tracklength @@ -926,14 +924,14 @@ total flux - tracklength + analog H1 O16 B10 B11 - scatter - tracklength + nu-scatter + analog @@ -945,8 +943,9 @@ + H1 O16 B10 B11 - nu-scatter + scatter-P3 analog @@ -957,21 +956,6 @@ analog - - - - H1 O16 B10 B11 - scatter-P3 - analog - - - - - total - flux - analog - - @@ -979,7 +963,7 @@ nu-scatter-P3 analog - + @@ -987,7 +971,7 @@ nu-scatter analog - + @@ -995,14 +979,14 @@ scatter analog - + total flux analog - + @@ -1010,20 +994,34 @@ nu-fission analog - + H1 O16 B10 B11 - scatter-P0 + scatter analog + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + scatter + tracklength + H1 O16 B10 B11 - nu-scatter-P0 + scatter-P3 analog @@ -1049,28 +1047,6 @@ analog - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - scatter - tracklength - - - - - - H1 O16 B10 B11 - scatter-P3 - analog - - @@ -1078,7 +1054,7 @@ nu-scatter-0 analog - + @@ -1086,70 +1062,70 @@ scatter-0 analog - + H1 O16 B10 B11 nu-fission analog + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + H1 O16 B10 B11 + prompt-nu-fission + analog + + + + + H1 O16 B10 B11 + prompt-nu-fission + analog + - - - H1 O16 B10 B11 - nu-fission - analog - - - - - H1 O16 B10 B11 - prompt-nu-fission - analog - - - - - H1 O16 B10 B11 - prompt-nu-fission - analog - - total flux tracklength - + H1 O16 B10 B11 inverse-velocity tracklength - + total flux tracklength - + H1 O16 B10 B11 prompt-nu-fission tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_nuclides/results_true.dat b/tests/test_mgxs_library_nuclides/results_true.dat index 7b1279192..243adc368 100644 --- a/tests/test_mgxs_library_nuclides/results_true.dat +++ b/tests/test_mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -bd5c4c64a77f8df58fc6753bc5d43de9d7b80c47097cfbafa37f52f10f661997caec72acdfa31dd1af246314447bd5781e950181814cbc77435ebbf029e9f6d7 \ No newline at end of file +5df54054ab37cd69b7096b9f785be57a83a8c3872d3e065ff605aa6de5688640a5551f99313a3e60a9ab8f902c1d4927630e1838db26a2a09d41e29338634b43 \ No newline at end of file From aa76e16bbfca3dc64ec5cf88011068ee89bc7387 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Fri, 3 Mar 2017 11:29:02 -0500 Subject: [PATCH 27/40] Added HDF5 key for scatter probability matrix --- openmc/mgxs/mgxs.py | 1 + tests/test_mgxs_library_hdf5/results_true.dat | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 68cbbbe8f..d7a17201a 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4901,6 +4901,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): name, num_polar, num_azimuthal) self._rxn_type = 'scatter' + self._hdf5_key = 'scatter probability matrix' self._estimator = 'analog' self._valid_estimators = ['analog'] diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat index 5324d666c..282ffeb89 100644 --- a/tests/test_mgxs_library_hdf5/results_true.dat +++ b/tests/test_mgxs_library_hdf5/results_true.dat @@ -61,11 +61,6 @@ domain=10000 type=nu-fission matrix [[3.14909051e-03 0.00000000e+00] [2.74255162e-02 0.00000000e+00]] domain=10000 type=scatter probability matrix -[[9.97432606e-01 2.56739409e-03] - [2.24215247e-03 9.97757848e-01]] -[[7.82243018e-02 1.25560869e-03] - [2.24310192e-03 4.10531468e-02]] -domain=10000 type=nu-scatter probability matrix [[9.97432606e-01 2.56739409e-03] [2.24215247e-03 9.97757848e-01]] [[7.82243018e-02 1.25560869e-03] @@ -259,11 +254,6 @@ domain=10001 type=nu-fission matrix [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] domain=10001 type=scatter probability matrix -[[1.00000000e+00 0.00000000e+00] - [0.00000000e+00 1.00000000e+00]] -[[1.08778697e-01 0.00000000e+00] - [0.00000000e+00 1.42427173e-01]] -domain=10001 type=nu-scatter probability matrix [[1.00000000e+00 0.00000000e+00] [0.00000000e+00 1.00000000e+00]] [[1.08778697e-01 0.00000000e+00] @@ -457,11 +447,6 @@ domain=10002 type=nu-fission matrix [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] domain=10002 type=scatter probability matrix -[[9.53271028e-01 4.67289720e-02] - [2.17817469e-04 9.99782183e-01]] -[[3.60184962e-02 2.54736726e-03] - [2.18820864e-04 1.35884974e-01]] -domain=10002 type=nu-scatter probability matrix [[9.53271028e-01 4.67289720e-02] [2.17817469e-04 9.99782183e-01]] [[3.60184962e-02 2.54736726e-03] From 10f8e200909e1cfe8c39150eb35541e8a652374e Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 5 Mar 2017 10:32:43 -0500 Subject: [PATCH 28/40] Fixed issue with scatter matrix transport correction filter --- openmc/mgxs/mgxs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index d7a17201a..3471671e8 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3869,7 +3869,7 @@ class ScatterMatrixXS(MatrixMGXS): # Add filters for transport correction if self.correction == 'P0' and self.legendre_order == 0: - filters.append([[energyout]]) + filters.append([energyout]) return self._add_angle_filters(filters) From 04c0f3910d20f7b5241473f3506d6277f6b9d9e5 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 6 Mar 2017 13:22:14 -0500 Subject: [PATCH 29/40] Removed errant filters added to scatter probability matrix for consistent multi-group scattering matrix --- openmc/mgxs/mgxs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 3471671e8..fbd6b9e0b 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3861,7 +3861,7 @@ class ScatterMatrixXS(MatrixMGXS): filters = [[energy], [energy]] # Group-to-group scattering probability matrix - filters.extend([[energy, energyout], [energy, energyout]]) + filters.extend([[energy, energyout]]) #, [energy, energyout]]) # Multiplicity matrix if self.nu: From 2e0ade3bc7cea1018711ccec0e9d2ef155fd06ec Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 6 Mar 2017 13:46:19 -0500 Subject: [PATCH 30/40] Removed errant filters added to scatter probability matrix for consistent multi-group scattering matrix --- openmc/mgxs/mgxs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index fbd6b9e0b..7ea28c597 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3861,15 +3861,15 @@ class ScatterMatrixXS(MatrixMGXS): filters = [[energy], [energy]] # Group-to-group scattering probability matrix - filters.extend([[energy, energyout]]) #, [energy, energyout]]) + filters.append([energy, energyout]) #, [energy, energyout]]) # Multiplicity matrix if self.nu: - filters.append([energy, energyout]) + filters.extend([[energy, energyout], [energy, energyout]]) # Add filters for transport correction if self.correction == 'P0' and self.legendre_order == 0: - filters.append([energyout]) + filters.extend([[energyout], [energy]]) return self._add_angle_filters(filters) From 4be0e58be807fecaaa63e6badcd81ea18902e5dc Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 6 Mar 2017 13:59:22 -0500 Subject: [PATCH 31/40] Added support for histograms to consistent scattering matrix --- openmc/mgxs/mgxs.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 7ea28c597..94071101d 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3778,10 +3778,13 @@ class ScatterMatrixXS(MatrixMGXS): scores = ['flux', 'scatter'] # Add scores for group-to-group scattering probability matrix - if self.legendre_order == 0: + if self.scatter_format == 'legendre': + if self.legendre_order == 0: + scores.append('scatter-0') + else: + scores.append('scatter-P{}'.format(self.legendre_order)) + elif self.scatter_format == 'histogram': scores.append('scatter-0') - else: - scores.append('scatter-P{}'.format(self.legendre_order)) # Add scores for multiplicity matrix if self.nu: @@ -3861,7 +3864,12 @@ class ScatterMatrixXS(MatrixMGXS): filters = [[energy], [energy]] # Group-to-group scattering probability matrix - filters.append([energy, energyout]) #, [energy, energyout]]) + if self.scatter_format == 'legendre': + filters.append([energy, energyout]) + elif self.scatter_format == 'histogram': + bins = np.linspace(-1., 1., num=self.histogram_bins + 1, + endpoint=True) + filters.append([energy, energyout, openmc.MuFilter(bins)]) # Multiplicity matrix if self.nu: From 0352849b1a06e92dfde4cbc9714dd3f5fec7a7b5 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 7 Mar 2017 09:23:12 -0500 Subject: [PATCH 32/40] Updated test results with new consistent transport-corrected total MGXS --- openmc/mgxs/mgxs.py | 43 +- src/xml/fox | 1 + .../inputs_true.dat | 772 +++++++++--------- .../results_true.dat | 16 +- .../inputs_true.dat | 208 ++--- .../results_true.dat | 4 +- tests/test_mgxs_library_hdf5/inputs_true.dat | 772 +++++++++--------- tests/test_mgxs_library_hdf5/results_true.dat | 24 +- tests/test_mgxs_library_mesh/inputs_true.dat | 208 ++--- tests/test_mgxs_library_mesh/results_true.dat | 16 +- .../inputs_true.dat | 772 +++++++++--------- .../results_true.dat | 24 +- .../inputs_true.dat | 640 ++++++++------- .../results_true.dat | 2 +- 14 files changed, 1858 insertions(+), 1644 deletions(-) create mode 160000 src/xml/fox diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 94071101d..402152608 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -2715,7 +2715,10 @@ class TransportXS(MGXS): super(TransportXS, self).__init__(domain, domain_type, groups, by_nuclide, name, num_polar, num_azimuthal) - self._estimator = 'analog' + + # Use tracklength estimators for the total MGXS term, and + # analog estimators for the transport correction term + self._estimator = ['tracklength', 'tracklength', 'analog', 'analog'] self._valid_estimators = ['analog'] self.nu = nu @@ -2727,40 +2730,54 @@ class TransportXS(MGXS): @property def scores(self): if not self.nu: - return ['flux', 'total', 'scatter-1'] + return ['flux', 'total', 'flux', 'scatter-1'] else: - return ['flux', 'total', 'nu-scatter-1'] + return ['flux', 'total', 'flux', 'nu-scatter-1'] @property def tally_keys(self): - if not self.nu: - return super(TransportXS, self).tally_keys - else: - return ['flux', 'total', 'scatter-1'] + return ['flux (tracklength)', 'total', 'flux (analog)', 'scatter-1'] @property def filters(self): group_edges = self.energy_groups.group_edges energy_filter = openmc.EnergyFilter(group_edges) energyout_filter = openmc.EnergyoutFilter(group_edges) - filters = [[energy_filter], [energy_filter], [energyout_filter]] + filters = [[energy_filter], [energy_filter], + [energy_filter], [energyout_filter]] return self._add_angle_filters(filters) @property def rxn_rate_tally(self): - if self._rxn_rate_tally is None: + raise NotImplementedError('The reaction rate tally is poorly defined' \ + ' for the transport cross section') + + @property + def xs_tally(self): + if self._xs_tally is None: + if self.tallies is None: + msg = 'Unable to get xs_tally since tallies have ' \ + 'not been loaded from a statepoint' + raise ValueError(msg) + # Switch EnergyoutFilter to EnergyFilter. old_filt = self.tallies['scatter-1'].filters[-1] new_filt = openmc.EnergyFilter(old_filt.bins) new_filt.stride = old_filt.stride self.tallies['scatter-1'].filters[-1] = new_filt - self._rxn_rate_tally = \ - self.tallies['total'] - self.tallies['scatter-1'] - self._rxn_rate_tally.sparse = self.sparse + # Compute total cross section + total_xs = self.tallies['total'] / self.tallies['flux (tracklength)'] - return self._rxn_rate_tally + # Compute transport correction term + trans_corr = self.tallies['scatter-1'] / self.tallies['flux (analog)'] + + # Compute the transport-corrected total cross section + self._xs_tally = total_xs - trans_corr + self._compute_xs() + + return self._xs_tally @property def nu(self): diff --git a/src/xml/fox b/src/xml/fox new file mode 160000 index 000000000..bdc852f4f --- /dev/null +++ b/src/xml/fox @@ -0,0 +1 @@ +Subproject commit bdc852f4f43d969fb1b179cba79295c1e095a455 diff --git a/tests/test_mgxs_library_condense/inputs_true.dat b/tests/test_mgxs_library_condense/inputs_true.dat index f2a7c9025..79c7ea049 100644 --- a/tests/test_mgxs_library_condense/inputs_true.dat +++ b/tests/test_mgxs_library_condense/inputs_true.dat @@ -69,56 +69,56 @@ total flux - analog + tracklength total total - analog + tracklength + + + total + flux + analog + + total scatter-1 analog - - - - total - flux - analog - total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -138,14 +138,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -166,7 +166,7 @@ total - nu-fission + fission tracklength @@ -180,7 +180,7 @@ total - kappa-fission + nu-fission tracklength @@ -194,7 +194,7 @@ total - scatter + kappa-fission tracklength @@ -202,14 +202,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -221,9 +221,8 @@ - total - scatter-P3 + nu-scatter analog @@ -238,15 +237,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -254,14 +252,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -269,54 +268,47 @@ total - nu-fission + scatter analog - total - scatter + flux analog + total - flux - tracklength + nu-fission + analog + total scatter - tracklength + analog - total - scatter-P3 - analog + flux + tracklength - - - total - flux - tracklength - - total scatter tracklength - + @@ -324,7 +316,29 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -332,7 +346,7 @@ nu-scatter-0 analog - + @@ -340,47 +354,33 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog - + total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -393,7 +393,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -401,9 +401,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -411,14 +425,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -426,7 +440,7 @@ delayed-nu-fission tracklength - + @@ -434,7 +448,7 @@ delayed-nu-fission analog - + @@ -442,45 +456,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + @@ -489,60 +503,46 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - total flux - analog + tracklength total total - analog + tracklength - + total - scatter-1 - analog + flux + tracklength + + + total + total + tracklength + + total flux analog - - - - total - total - analog - total - nu-scatter-1 + scatter-1 analog @@ -556,7 +556,7 @@ total - absorption + total tracklength @@ -564,48 +564,48 @@ total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog total - fission + flux tracklength total - flux + absorption tracklength total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + fission tracklength @@ -619,7 +619,7 @@ total - kappa-fission + fission tracklength @@ -633,7 +633,7 @@ total - scatter + nu-fission tracklength @@ -641,29 +641,28 @@ total flux - analog + tracklength total - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + scatter + tracklength @@ -675,17 +674,15 @@ - total - nu-scatter-P3 + nu-scatter analog - total - nu-scatter + flux analog @@ -693,7 +690,7 @@ total - scatter + scatter-P3 analog @@ -708,7 +705,7 @@ total - nu-fission + nu-scatter-P3 analog @@ -716,46 +713,55 @@ total - scatter + nu-scatter analog + total - flux - tracklength + scatter + analog total - scatter - tracklength + flux + analog total - scatter-P3 + nu-fission analog + + + + total + scatter + analog + + total flux tracklength - + total scatter tracklength - + @@ -763,7 +769,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -771,7 +799,7 @@ nu-scatter-0 analog - + @@ -779,76 +807,47 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - + total - flux - tracklength + nu-fission + analog - + total - inverse-velocity - tracklength + nu-fission + analog - + total - flux - tracklength + prompt-nu-fission + analog - + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength - total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -859,33 +858,31 @@ - total - delayed-nu-fission + prompt-nu-fission tracklength - - + total - delayed-nu-fission + flux analog - + total - delayed-nu-fission + prompt-nu-fission analog total - nu-fission + flux tracklength @@ -897,6 +894,29 @@ tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + @@ -904,7 +924,15 @@ delayed-nu-fission tracklength - + + + + + total + delayed-nu-fission + tracklength + + @@ -912,14 +940,14 @@ decay-rate tracklength - + total flux analog - + @@ -928,75 +956,47 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - + total - scatter-1 - analog + flux + tracklength total - flux - analog + total + tracklength total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + scatter-1 + analog @@ -1009,56 +1009,56 @@ total - absorption + total tracklength total - fission - tracklength + flux + analog - + total - flux - tracklength + nu-scatter-1 + analog total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + flux tracklength total - flux + absorption tracklength total - kappa-fission + fission tracklength @@ -1072,7 +1072,7 @@ total - scatter + fission tracklength @@ -1080,59 +1080,55 @@ total flux - analog + tracklength total - nu-scatter - analog + nu-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + kappa-fission + tracklength total flux - analog + tracklength - total - nu-scatter-P3 - analog + scatter + tracklength - total - nu-scatter + flux analog - total - scatter + nu-scatter analog @@ -1147,37 +1143,38 @@ total - nu-fission + scatter-P3 analog - total - scatter + flux analog + total - flux - tracklength + nu-scatter-P3 + analog + total - scatter - tracklength + nu-scatter + analog total - scatter-P3 + scatter analog @@ -1185,16 +1182,39 @@ total flux - tracklength + analog + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + total scatter tracklength - + @@ -1202,7 +1222,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -1210,7 +1252,7 @@ nu-scatter-0 analog - + @@ -1218,72 +1260,29 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - - - - total - inverse-velocity - tracklength - - + total - flux - tracklength + nu-fission + analog - + total - prompt-nu-fission - tracklength + nu-fission + analog - + total - flux + prompt-nu-fission analog - total prompt-nu-fission @@ -1298,49 +1297,45 @@ - total - delayed-nu-fission + inverse-velocity tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + prompt-nu-fission + tracklength total - nu-fission - tracklength + flux + analog - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength @@ -1348,17 +1343,64 @@ total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_condense/results_true.dat b/tests/test_mgxs_library_condense/results_true.dat index 1892a17f2..f69814444 100644 --- a/tests/test_mgxs_library_condense/results_true.dat +++ b/tests/test_mgxs_library_condense/results_true.dat @@ -1,9 +1,9 @@ material group in nuclide mean std. dev. 0 10000 1 total 0.453624 0.021053 - material group in nuclide mean std. dev. -0 10000 1 total 0.400852 0.022858 - material group in nuclide mean std. dev. -0 10000 1 total 0.400852 0.022858 + material group in nuclide mean std. dev. +0 10000 1 total 0.4074 0.021863 + material group in nuclide mean std. dev. +0 10000 1 total 0.4074 0.021863 material group in nuclide mean std. dev. 0 10000 1 total 0.064903 0.004313 material group in nuclide mean std. dev. @@ -92,9 +92,9 @@ material group in nuclide mean std. dev. 0 10001 1 total 0.311594 0.013793 material group in nuclide mean std. dev. -0 10001 1 total 0.279255 0.029189 +0 10001 1 total 0.280977 0.015683 material group in nuclide mean std. dev. -0 10001 1 total 0.279255 0.029189 +0 10001 1 total 0.280977 0.015683 material group in nuclide mean std. dev. 0 10001 1 total 0.00221 0.000286 material group in nuclide mean std. dev. @@ -183,9 +183,9 @@ material group in nuclide mean std. dev. 0 10002 1 total 0.904999 0.043964 material group in nuclide mean std. dev. -0 10002 1 total 0.499184 0.040914 +0 10002 1 total 0.494581 0.046763 material group in nuclide mean std. dev. -0 10002 1 total 0.499184 0.040914 +0 10002 1 total 0.494581 0.046763 material group in nuclide mean std. dev. 0 10002 1 total 0.00606 0.000555 material group in nuclide mean std. dev. diff --git a/tests/test_mgxs_library_distribcell/inputs_true.dat b/tests/test_mgxs_library_distribcell/inputs_true.dat index 8e68ca8f0..79862b8bc 100644 --- a/tests/test_mgxs_library_distribcell/inputs_true.dat +++ b/tests/test_mgxs_library_distribcell/inputs_true.dat @@ -96,56 +96,56 @@ total flux - analog + tracklength total total - analog + tracklength + + + total + flux + analog + + total scatter-1 analog - - - - total - flux - analog - total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -165,14 +165,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -193,7 +193,7 @@ total - nu-fission + fission tracklength @@ -207,7 +207,7 @@ total - kappa-fission + nu-fission tracklength @@ -221,7 +221,7 @@ total - scatter + kappa-fission tracklength @@ -229,14 +229,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -248,9 +248,8 @@ - total - scatter-P3 + nu-scatter analog @@ -265,15 +264,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -281,14 +279,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -296,54 +295,47 @@ total - nu-fission + scatter analog - total - scatter + flux analog + total - flux - tracklength + nu-fission + analog + total scatter - tracklength + analog - total - scatter-P3 - analog + flux + tracklength - - - total - flux - tracklength - - total scatter tracklength - + @@ -351,7 +343,29 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -359,7 +373,7 @@ nu-scatter-0 analog - + @@ -367,47 +381,33 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -420,7 +420,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -428,9 +428,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -438,14 +452,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -453,7 +467,7 @@ delayed-nu-fission tracklength - + @@ -461,7 +475,7 @@ delayed-nu-fission analog - + @@ -469,45 +483,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_distribcell/results_true.dat b/tests/test_mgxs_library_distribcell/results_true.dat index e6ec539e6..e9277c975 100644 --- a/tests/test_mgxs_library_distribcell/results_true.dat +++ b/tests/test_mgxs_library_distribcell/results_true.dat @@ -1,9 +1,9 @@ sum(distribcell) group in nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 0.457353 0.010474 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 0.405649 0.015784 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 0.410174 0.011573 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 0.405641 0.015787 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 0.410166 0.011577 sum(distribcell) group in nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... 1 total 0.066556 0.00251 sum(distribcell) group in nuclide mean std. dev. diff --git a/tests/test_mgxs_library_hdf5/inputs_true.dat b/tests/test_mgxs_library_hdf5/inputs_true.dat index f2a7c9025..79c7ea049 100644 --- a/tests/test_mgxs_library_hdf5/inputs_true.dat +++ b/tests/test_mgxs_library_hdf5/inputs_true.dat @@ -69,56 +69,56 @@ total flux - analog + tracklength total total - analog + tracklength + + + total + flux + analog + + total scatter-1 analog - - - - total - flux - analog - total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -138,14 +138,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -166,7 +166,7 @@ total - nu-fission + fission tracklength @@ -180,7 +180,7 @@ total - kappa-fission + nu-fission tracklength @@ -194,7 +194,7 @@ total - scatter + kappa-fission tracklength @@ -202,14 +202,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -221,9 +221,8 @@ - total - scatter-P3 + nu-scatter analog @@ -238,15 +237,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -254,14 +252,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -269,54 +268,47 @@ total - nu-fission + scatter analog - total - scatter + flux analog + total - flux - tracklength + nu-fission + analog + total scatter - tracklength + analog - total - scatter-P3 - analog + flux + tracklength - - - total - flux - tracklength - - total scatter tracklength - + @@ -324,7 +316,29 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -332,7 +346,7 @@ nu-scatter-0 analog - + @@ -340,47 +354,33 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog - + total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -393,7 +393,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -401,9 +401,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -411,14 +425,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -426,7 +440,7 @@ delayed-nu-fission tracklength - + @@ -434,7 +448,7 @@ delayed-nu-fission analog - + @@ -442,45 +456,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + @@ -489,60 +503,46 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - total flux - analog + tracklength total total - analog + tracklength - + total - scatter-1 - analog + flux + tracklength + + + total + total + tracklength + + total flux analog - - - - total - total - analog - total - nu-scatter-1 + scatter-1 analog @@ -556,7 +556,7 @@ total - absorption + total tracklength @@ -564,48 +564,48 @@ total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog total - fission + flux tracklength total - flux + absorption tracklength total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + fission tracklength @@ -619,7 +619,7 @@ total - kappa-fission + fission tracklength @@ -633,7 +633,7 @@ total - scatter + nu-fission tracklength @@ -641,29 +641,28 @@ total flux - analog + tracklength total - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + scatter + tracklength @@ -675,17 +674,15 @@ - total - nu-scatter-P3 + nu-scatter analog - total - nu-scatter + flux analog @@ -693,7 +690,7 @@ total - scatter + scatter-P3 analog @@ -708,7 +705,7 @@ total - nu-fission + nu-scatter-P3 analog @@ -716,46 +713,55 @@ total - scatter + nu-scatter analog + total - flux - tracklength + scatter + analog total - scatter - tracklength + flux + analog total - scatter-P3 + nu-fission analog + + + + total + scatter + analog + + total flux tracklength - + total scatter tracklength - + @@ -763,7 +769,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -771,7 +799,7 @@ nu-scatter-0 analog - + @@ -779,76 +807,47 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - + total - flux - tracklength + nu-fission + analog - + total - inverse-velocity - tracklength + nu-fission + analog - + total - flux - tracklength + prompt-nu-fission + analog - + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength - total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -859,33 +858,31 @@ - total - delayed-nu-fission + prompt-nu-fission tracklength - - + total - delayed-nu-fission + flux analog - + total - delayed-nu-fission + prompt-nu-fission analog total - nu-fission + flux tracklength @@ -897,6 +894,29 @@ tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + @@ -904,7 +924,15 @@ delayed-nu-fission tracklength - + + + + + total + delayed-nu-fission + tracklength + + @@ -912,14 +940,14 @@ decay-rate tracklength - + total flux analog - + @@ -928,75 +956,47 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - + total - scatter-1 - analog + flux + tracklength total - flux - analog + total + tracklength total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + scatter-1 + analog @@ -1009,56 +1009,56 @@ total - absorption + total tracklength total - fission - tracklength + flux + analog - + total - flux - tracklength + nu-scatter-1 + analog total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + flux tracklength total - flux + absorption tracklength total - kappa-fission + fission tracklength @@ -1072,7 +1072,7 @@ total - scatter + fission tracklength @@ -1080,59 +1080,55 @@ total flux - analog + tracklength total - nu-scatter - analog + nu-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + kappa-fission + tracklength total flux - analog + tracklength - total - nu-scatter-P3 - analog + scatter + tracklength - total - nu-scatter + flux analog - total - scatter + nu-scatter analog @@ -1147,37 +1143,38 @@ total - nu-fission + scatter-P3 analog - total - scatter + flux analog + total - flux - tracklength + nu-scatter-P3 + analog + total - scatter - tracklength + nu-scatter + analog total - scatter-P3 + scatter analog @@ -1185,16 +1182,39 @@ total flux - tracklength + analog + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + total scatter tracklength - + @@ -1202,7 +1222,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -1210,7 +1252,7 @@ nu-scatter-0 analog - + @@ -1218,72 +1260,29 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - - - - total - inverse-velocity - tracklength - - + total - flux - tracklength + nu-fission + analog - + total - prompt-nu-fission - tracklength + nu-fission + analog - + total - flux + prompt-nu-fission analog - total prompt-nu-fission @@ -1298,49 +1297,45 @@ - total - delayed-nu-fission + inverse-velocity tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + prompt-nu-fission + tracklength total - nu-fission - tracklength + flux + analog - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength @@ -1348,17 +1343,64 @@ total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_hdf5/results_true.dat b/tests/test_mgxs_library_hdf5/results_true.dat index 282ffeb89..f3426cd40 100644 --- a/tests/test_mgxs_library_hdf5/results_true.dat +++ b/tests/test_mgxs_library_hdf5/results_true.dat @@ -2,11 +2,11 @@ domain=10000 type=total [4.14825464e-01 6.60169863e-01] [2.27929105e-02 4.75188999e-02] domain=10000 type=transport -[3.56859612e-01 6.47647614e-01] -[2.54935937e-02 2.37037335e-02] +[3.63092031e-01 6.44850709e-01] +[2.38384843e-02 4.76746408e-02] domain=10000 type=nu-transport -[3.56859612e-01 6.47647614e-01] -[2.54935937e-02 2.37037335e-02] +[3.63092031e-01 6.44850709e-01] +[2.38384843e-02 4.76746408e-02] domain=10000 type=absorption [2.74078431e-02 2.64510714e-01] [2.69249666e-03 2.33670618e-02] @@ -195,11 +195,11 @@ domain=10001 type=total [3.13737666e-01 3.00821380e-01] [1.55819223e-02 2.80524816e-02] domain=10001 type=transport -[2.73227852e-01 3.12374814e-01] -[3.31153641e-02 4.96058281e-02] +[2.75508079e-01 3.12035015e-01] +[1.77418855e-02 3.23843473e-02] domain=10001 type=nu-transport -[2.73227852e-01 3.12374814e-01] -[3.31153641e-02 4.96058281e-02] +[2.75508079e-01 3.12035015e-01] +[1.77418855e-02 3.23843473e-02] domain=10001 type=absorption [1.57499139e-03 5.40037826e-03] [3.22547919e-04 6.18139027e-04] @@ -388,11 +388,11 @@ domain=10002 type=total [6.64572195e-01 2.05238389e+00] [3.12147473e-02 2.24342891e-01] domain=10002 type=transport -[2.90565237e-01 1.51643790e+00] -[2.38518529e-02 2.35197252e-01] +[2.83322749e-01 1.49973953e+00] +[3.52061127e-02 2.30902118e-01] domain=10002 type=nu-transport -[2.90565237e-01 1.51643790e+00] -[2.38518529e-02 2.35197252e-01] +[2.83322749e-01 1.49973953e+00] +[3.52061127e-02 2.30902118e-01] domain=10002 type=absorption [6.90399495e-04 3.16872549e-02] [4.41475663e-05 3.74655831e-03] diff --git a/tests/test_mgxs_library_mesh/inputs_true.dat b/tests/test_mgxs_library_mesh/inputs_true.dat index b806bec91..b0db8a9c4 100644 --- a/tests/test_mgxs_library_mesh/inputs_true.dat +++ b/tests/test_mgxs_library_mesh/inputs_true.dat @@ -333,56 +333,56 @@ total flux - analog + tracklength total total - analog + tracklength + + + total + flux + analog + + total scatter-1 analog - - - - total - flux - analog - total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -402,14 +402,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -430,7 +430,7 @@ total - nu-fission + fission tracklength @@ -444,7 +444,7 @@ total - kappa-fission + nu-fission tracklength @@ -458,7 +458,7 @@ total - scatter + kappa-fission tracklength @@ -466,14 +466,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -485,9 +485,8 @@ - total - scatter-P3 + nu-scatter analog @@ -502,15 +501,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -518,14 +516,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -533,54 +532,47 @@ total - nu-fission + scatter analog - total - scatter + flux analog + total - flux - tracklength + nu-fission + analog + total scatter - tracklength + analog - total - scatter-P3 - analog + flux + tracklength - - - total - flux - tracklength - - total scatter tracklength - + @@ -588,7 +580,29 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -596,7 +610,7 @@ nu-scatter-0 analog - + @@ -604,47 +618,33 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -657,7 +657,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -665,9 +665,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -675,14 +689,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -690,7 +704,7 @@ delayed-nu-fission tracklength - + @@ -698,7 +712,7 @@ delayed-nu-fission analog - + @@ -706,45 +720,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_mesh/results_true.dat b/tests/test_mgxs_library_mesh/results_true.dat index fd4c972e2..527c91d66 100644 --- a/tests/test_mgxs_library_mesh/results_true.dat +++ b/tests/test_mgxs_library_mesh/results_true.dat @@ -6,16 +6,16 @@ 3 2 2 1 1 total 0.641095 0.091519 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.413423 0.087250 -1 1 2 1 1 total 0.392074 0.244272 -2 2 1 1 1 total 0.458841 0.087921 -3 2 2 1 1 total 0.403898 0.074343 +0 1 1 1 1 total 0.407867 0.104648 +1 1 2 1 1 total 0.417805 0.300173 +2 2 1 1 1 total 0.451699 0.087229 +3 2 2 1 1 total 0.396449 0.095884 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.413423 0.087250 -1 1 2 1 1 total 0.392074 0.244272 -2 2 1 1 1 total 0.458841 0.087921 -3 2 2 1 1 total 0.403898 0.074343 +0 1 1 1 1 total 0.407867 0.104648 +1 1 2 1 1 total 0.417805 0.300173 +2 2 1 1 1 total 0.451699 0.087229 +3 2 2 1 1 total 0.396449 0.095884 mesh 1 group in nuclide mean std. dev. x y z 0 1 1 1 1 total 0.021476 0.004248 diff --git a/tests/test_mgxs_library_no_nuclides/inputs_true.dat b/tests/test_mgxs_library_no_nuclides/inputs_true.dat index f2a7c9025..79c7ea049 100644 --- a/tests/test_mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_no_nuclides/inputs_true.dat @@ -69,56 +69,56 @@ total flux - analog + tracklength total total - analog + tracklength + + + total + flux + analog + + total scatter-1 analog - - - - total - flux - analog - total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog @@ -138,14 +138,14 @@ total - fission + flux tracklength total - flux + absorption tracklength @@ -166,7 +166,7 @@ total - nu-fission + fission tracklength @@ -180,7 +180,7 @@ total - kappa-fission + nu-fission tracklength @@ -194,7 +194,7 @@ total - scatter + kappa-fission tracklength @@ -202,14 +202,14 @@ total flux - analog + tracklength total - nu-scatter - analog + scatter + tracklength @@ -221,9 +221,8 @@ - total - scatter-P3 + nu-scatter analog @@ -238,15 +237,14 @@ total - nu-scatter-P3 + scatter-P3 analog - total - nu-scatter + flux analog @@ -254,14 +252,15 @@ total - scatter + nu-scatter-P3 analog + total - flux + nu-scatter analog @@ -269,54 +268,47 @@ total - nu-fission + scatter analog - total - scatter + flux analog + total - flux - tracklength + nu-fission + analog + total scatter - tracklength + analog - total - scatter-P3 - analog + flux + tracklength - - - total - flux - tracklength - - total scatter tracklength - + @@ -324,7 +316,29 @@ scatter-P3 analog + + + + total + flux + tracklength + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -332,7 +346,7 @@ nu-scatter-0 analog - + @@ -340,47 +354,33 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - total - prompt-nu-fission + nu-fission analog total - prompt-nu-fission + nu-fission analog - + total - flux - tracklength + prompt-nu-fission + analog - + total - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -393,7 +393,7 @@ total - prompt-nu-fission + inverse-velocity tracklength @@ -401,9 +401,23 @@ total flux - analog + tracklength + + + total + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -411,14 +425,14 @@ prompt-nu-fission analog - + total flux tracklength - + @@ -426,7 +440,7 @@ delayed-nu-fission tracklength - + @@ -434,7 +448,7 @@ delayed-nu-fission analog - + @@ -442,45 +456,45 @@ delayed-nu-fission analog - + total nu-fission tracklength - - - - - total - delayed-nu-fission - tracklength - - - - - - total - delayed-nu-fission - tracklength - total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + @@ -489,60 +503,46 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - total flux - analog + tracklength total total - analog + tracklength - + total - scatter-1 - analog + flux + tracklength + + + total + total + tracklength + + total flux analog - - - - total - total - analog - total - nu-scatter-1 + scatter-1 analog @@ -556,7 +556,7 @@ total - absorption + total tracklength @@ -564,48 +564,48 @@ total flux - tracklength + analog - + total - absorption - tracklength + nu-scatter-1 + analog total - fission + flux tracklength total - flux + absorption tracklength total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + fission tracklength @@ -619,7 +619,7 @@ total - kappa-fission + fission tracklength @@ -633,7 +633,7 @@ total - scatter + nu-fission tracklength @@ -641,29 +641,28 @@ total flux - analog + tracklength total - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + scatter + tracklength @@ -675,17 +674,15 @@ - total - nu-scatter-P3 + nu-scatter analog - total - nu-scatter + flux analog @@ -693,7 +690,7 @@ total - scatter + scatter-P3 analog @@ -708,7 +705,7 @@ total - nu-fission + nu-scatter-P3 analog @@ -716,46 +713,55 @@ total - scatter + nu-scatter analog + total - flux - tracklength + scatter + analog total - scatter - tracklength + flux + analog total - scatter-P3 + nu-fission analog + + + + total + scatter + analog + + total flux tracklength - + total scatter tracklength - + @@ -763,7 +769,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -771,7 +799,7 @@ nu-scatter-0 analog - + @@ -779,76 +807,47 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - + total - flux - tracklength + nu-fission + analog - + total - inverse-velocity - tracklength + nu-fission + analog - + total - flux - tracklength + prompt-nu-fission + analog - + total prompt-nu-fission - tracklength + analog total flux - analog + tracklength - total - prompt-nu-fission - analog + inverse-velocity + tracklength @@ -859,33 +858,31 @@ - total - delayed-nu-fission + prompt-nu-fission tracklength - - + total - delayed-nu-fission + flux analog - + total - delayed-nu-fission + prompt-nu-fission analog total - nu-fission + flux tracklength @@ -897,6 +894,29 @@ tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + @@ -904,7 +924,15 @@ delayed-nu-fission tracklength - + + + + + total + delayed-nu-fission + tracklength + + @@ -912,14 +940,14 @@ decay-rate tracklength - + total flux analog - + @@ -928,75 +956,47 @@ delayed-nu-fission analog - - - - total - flux - tracklength - - - - - total - total - tracklength - - - - - total - flux - analog - - - - - total - total - analog - - + total - scatter-1 - analog + flux + tracklength total - flux - analog + total + tracklength total - total - analog + flux + tracklength - + total - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + total - absorption - tracklength + scatter-1 + analog @@ -1009,56 +1009,56 @@ total - absorption + total tracklength total - fission - tracklength + flux + analog - + total - flux - tracklength + nu-scatter-1 + analog total - fission + flux tracklength total - flux + absorption tracklength total - nu-fission + flux tracklength total - flux + absorption tracklength total - kappa-fission + fission tracklength @@ -1072,7 +1072,7 @@ total - scatter + fission tracklength @@ -1080,59 +1080,55 @@ total flux - analog + tracklength total - nu-scatter - analog + nu-fission + tracklength total flux - analog + tracklength - total - scatter-P3 - analog + kappa-fission + tracklength total flux - analog + tracklength - total - nu-scatter-P3 - analog + scatter + tracklength - total - nu-scatter + flux analog - total - scatter + nu-scatter analog @@ -1147,37 +1143,38 @@ total - nu-fission + scatter-P3 analog - total - scatter + flux analog + total - flux - tracklength + nu-scatter-P3 + analog + total - scatter - tracklength + nu-scatter + analog total - scatter-P3 + scatter analog @@ -1185,16 +1182,39 @@ total flux - tracklength + analog + + + + total + nu-fission + analog + + + + + + total + scatter + analog + + + + + total + flux + tracklength + + total scatter tracklength - + @@ -1202,7 +1222,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + total + scatter + tracklength + + + + + + total + scatter-P3 + analog + + @@ -1210,7 +1252,7 @@ nu-scatter-0 analog - + @@ -1218,72 +1260,29 @@ scatter-0 analog - - - - total - nu-fission - analog - - - - - total - nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - prompt-nu-fission - analog - - - - - total - flux - tracklength - - - - - total - inverse-velocity - tracklength - - + total - flux - tracklength + nu-fission + analog - + total - prompt-nu-fission - tracklength + nu-fission + analog - + total - flux + prompt-nu-fission analog - total prompt-nu-fission @@ -1298,49 +1297,45 @@ - total - delayed-nu-fission + inverse-velocity tracklength - - + total - delayed-nu-fission - analog + flux + tracklength - - + total - delayed-nu-fission - analog + prompt-nu-fission + tracklength total - nu-fission - tracklength + flux + analog - + total - delayed-nu-fission - tracklength + prompt-nu-fission + analog - total - delayed-nu-fission + flux tracklength @@ -1348,17 +1343,64 @@ total - decay-rate + delayed-nu-fission tracklength + + + + total + delayed-nu-fission + analog + + + + + + total + delayed-nu-fission + analog + + + + + total + nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + delayed-nu-fission + tracklength + + + + + + total + decay-rate + tracklength + + total flux analog - + diff --git a/tests/test_mgxs_library_no_nuclides/results_true.dat b/tests/test_mgxs_library_no_nuclides/results_true.dat index 85dc93377..e3481ce4e 100644 --- a/tests/test_mgxs_library_no_nuclides/results_true.dat +++ b/tests/test_mgxs_library_no_nuclides/results_true.dat @@ -2,11 +2,11 @@ 1 10000 1 total 0.414825 0.022793 0 10000 2 total 0.660170 0.047519 material group in nuclide mean std. dev. -1 10000 1 total 0.356860 0.025494 -0 10000 2 total 0.647648 0.023704 +1 10000 1 total 0.363092 0.023838 +0 10000 2 total 0.644851 0.047675 material group in nuclide mean std. dev. -1 10000 1 total 0.356860 0.025494 -0 10000 2 total 0.647648 0.023704 +1 10000 1 total 0.363092 0.023838 +0 10000 2 total 0.644851 0.047675 material group in nuclide mean std. dev. 1 10000 1 total 0.027408 0.002692 0 10000 2 total 0.264511 0.023367 @@ -209,11 +209,11 @@ 1 10001 1 total 0.313738 0.015582 0 10001 2 total 0.300821 0.028052 material group in nuclide mean std. dev. -1 10001 1 total 0.273228 0.033115 -0 10001 2 total 0.312375 0.049606 +1 10001 1 total 0.275508 0.017742 +0 10001 2 total 0.312035 0.032384 material group in nuclide mean std. dev. -1 10001 1 total 0.273228 0.033115 -0 10001 2 total 0.312375 0.049606 +1 10001 1 total 0.275508 0.017742 +0 10001 2 total 0.312035 0.032384 material group in nuclide mean std. dev. 1 10001 1 total 0.001575 0.000323 0 10001 2 total 0.005400 0.000618 @@ -416,11 +416,11 @@ 1 10002 1 total 0.664572 0.031215 0 10002 2 total 2.052384 0.224343 material group in nuclide mean std. dev. -1 10002 1 total 0.290565 0.023852 -0 10002 2 total 1.516438 0.235197 +1 10002 1 total 0.283323 0.035206 +0 10002 2 total 1.499740 0.230902 material group in nuclide mean std. dev. -1 10002 1 total 0.290565 0.023852 -0 10002 2 total 1.516438 0.235197 +1 10002 1 total 0.283323 0.035206 +0 10002 2 total 1.499740 0.230902 material group in nuclide mean std. dev. 1 10002 1 total 0.000690 0.000044 0 10002 2 total 0.031687 0.003747 diff --git a/tests/test_mgxs_library_nuclides/inputs_true.dat b/tests/test_mgxs_library_nuclides/inputs_true.dat index 8d7cf5fb8..89541b4d5 100644 --- a/tests/test_mgxs_library_nuclides/inputs_true.dat +++ b/tests/test_mgxs_library_nuclides/inputs_true.dat @@ -69,56 +69,56 @@ total flux - analog + tracklength U234 U235 U238 O16 total - analog + tracklength + + + total + flux + analog + + U234 U235 U238 O16 scatter-1 analog - + total flux - analog + tracklength - + U234 U235 U238 O16 total - analog - - - - - U234 U235 U238 O16 - nu-scatter-1 - analog + tracklength total flux - tracklength + analog - + U234 U235 U238 O16 - absorption - tracklength + nu-scatter-1 + analog @@ -137,15 +137,15 @@ - U234 U235 U238 O16 - fission + total + flux tracklength - total - flux + U234 U235 U238 O16 + absorption tracklength @@ -166,7 +166,7 @@ U234 U235 U238 O16 - nu-fission + fission tracklength @@ -180,7 +180,7 @@ U234 U235 U238 O16 - kappa-fission + nu-fission tracklength @@ -194,7 +194,7 @@ U234 U235 U238 O16 - scatter + kappa-fission tracklength @@ -202,14 +202,14 @@ total flux - analog + tracklength U234 U235 U238 O16 - nu-scatter - analog + scatter + tracklength @@ -221,9 +221,8 @@ - U234 U235 U238 O16 - scatter-P3 + nu-scatter analog @@ -238,15 +237,14 @@ U234 U235 U238 O16 - nu-scatter-P3 + scatter-P3 analog - - U234 U235 U238 O16 - nu-scatter + total + flux analog @@ -254,14 +252,15 @@ U234 U235 U238 O16 - scatter + nu-scatter-P3 analog - total - flux + + U234 U235 U238 O16 + nu-scatter analog @@ -269,54 +268,69 @@ U234 U235 U238 O16 - nu-fission + scatter analog - - U234 U235 U238 O16 - scatter + total + flux analog - total - flux - tracklength + + U234 U235 U238 O16 + nu-fission + analog + U234 U235 U238 O16 scatter - tracklength + analog - - U234 U235 U238 O16 - scatter-P3 - analog + total + flux + tracklength - total - flux + U234 U235 U238 O16 + scatter tracklength + + + + U234 U235 U238 O16 + scatter-P3 + analog + + + + + total + flux + tracklength + + U234 U235 U238 O16 scatter tracklength - + @@ -324,7 +338,7 @@ scatter-P3 analog - + @@ -332,7 +346,7 @@ nu-scatter-0 analog - + @@ -340,47 +354,33 @@ scatter-0 analog - - - - U234 U235 U238 O16 - nu-fission - analog - - - - - U234 U235 U238 O16 - nu-fission - analog - U234 U235 U238 O16 - prompt-nu-fission + nu-fission analog U234 U235 U238 O16 - prompt-nu-fission + nu-fission analog - - total - flux - tracklength + + U234 U235 U238 O16 + prompt-nu-fission + analog - + U234 U235 U238 O16 - inverse-velocity - tracklength + prompt-nu-fission + analog @@ -393,7 +393,7 @@ U234 U235 U238 O16 - prompt-nu-fission + inverse-velocity tracklength @@ -401,9 +401,23 @@ total flux - analog + tracklength + + + U234 U235 U238 O16 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -411,60 +425,46 @@ prompt-nu-fission analog - - - - total - flux - tracklength - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - tracklength - total flux - analog + tracklength Zr90 Zr91 Zr92 Zr94 Zr96 total - analog + tracklength - - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-1 - analog + + total + flux + tracklength + + + Zr90 Zr91 Zr92 Zr94 Zr96 + total + tracklength + + total flux analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - total - analog - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-1 + scatter-1 analog @@ -478,7 +478,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - absorption + total tracklength @@ -486,48 +486,48 @@ total flux - tracklength + analog + + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-scatter-1 + analog + + + + + total + flux + tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 absorption tracklength - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - fission - tracklength - - + total flux tracklength - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - fission - tracklength - - total - flux + Zr90 Zr91 Zr92 Zr94 Zr96 + absorption tracklength Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + fission tracklength @@ -541,7 +541,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - kappa-fission + fission tracklength @@ -555,7 +555,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-fission tracklength @@ -563,29 +563,28 @@ total flux - analog + tracklength Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter - analog + kappa-fission + tracklength total flux - analog + tracklength - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 - analog + scatter + tracklength @@ -597,17 +596,15 @@ - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter-P3 + nu-scatter analog - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-scatter + total + flux analog @@ -615,7 +612,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + scatter-P3 analog @@ -630,7 +627,7 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission + nu-scatter-P3 analog @@ -638,46 +635,55 @@ Zr90 Zr91 Zr92 Zr94 Zr96 - scatter + nu-scatter analog - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + analog - Zr90 Zr91 Zr92 Zr94 Zr96 - scatter - tracklength + total + flux + analog Zr90 Zr91 Zr92 Zr94 Zr96 - scatter-P3 + nu-fission analog + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + analog + + total flux tracklength - + Zr90 Zr91 Zr92 Zr94 Zr96 scatter tracklength - + @@ -685,7 +691,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter + tracklength + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + scatter-P3 + analog + + @@ -693,7 +721,7 @@ nu-scatter-0 analog - + @@ -701,70 +729,70 @@ scatter-0 analog - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - - - - Zr90 Zr91 Zr92 Zr94 Zr96 - prompt-nu-fission - analog - - - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + nu-fission + analog - + Zr90 Zr91 Zr92 Zr94 Zr96 - inverse-velocity - tracklength + nu-fission + analog - - total - flux - tracklength + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + analog - + Zr90 Zr91 Zr92 Zr94 Zr96 prompt-nu-fission - tracklength + analog total flux - analog + tracklength + + + Zr90 Zr91 Zr92 Zr94 Zr96 + inverse-velocity + tracklength + + + + + total + flux + tracklength + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 + prompt-nu-fission + tracklength + + + + + total + flux + analog + + @@ -772,75 +800,47 @@ prompt-nu-fission analog - - - - total - flux - tracklength - - - - - H1 O16 B10 B11 - total - tracklength - - - - - total - flux - analog - - - - - H1 O16 B10 B11 - total - analog - - - H1 O16 B10 B11 - scatter-1 - analog + + total + flux + tracklength - total - flux - analog + H1 O16 B10 B11 + total + tracklength - H1 O16 B10 B11 - total - analog + total + flux + tracklength - + H1 O16 B10 B11 - nu-scatter-1 - analog + total + tracklength total flux - tracklength + analog - + H1 O16 B10 B11 - absorption - tracklength + scatter-1 + analog @@ -853,56 +853,56 @@ H1 O16 B10 B11 - absorption + total tracklength - H1 O16 B10 B11 - fission - tracklength + total + flux + analog - - total - flux - tracklength + + H1 O16 B10 B11 + nu-scatter-1 + analog - H1 O16 B10 B11 - fission + total + flux tracklength - total - flux + H1 O16 B10 B11 + absorption tracklength - H1 O16 B10 B11 - nu-fission + total + flux tracklength - total - flux + H1 O16 B10 B11 + absorption tracklength H1 O16 B10 B11 - kappa-fission + fission tracklength @@ -916,7 +916,7 @@ H1 O16 B10 B11 - scatter + fission tracklength @@ -924,59 +924,55 @@ total flux - analog + tracklength H1 O16 B10 B11 - nu-scatter - analog + nu-fission + tracklength total flux - analog + tracklength - H1 O16 B10 B11 - scatter-P3 - analog + kappa-fission + tracklength total flux - analog + tracklength - H1 O16 B10 B11 - nu-scatter-P3 - analog + scatter + tracklength - - H1 O16 B10 B11 - nu-scatter + total + flux analog - H1 O16 B10 B11 - scatter + nu-scatter analog @@ -991,37 +987,38 @@ H1 O16 B10 B11 - nu-fission + scatter-P3 analog - - H1 O16 B10 B11 - scatter + total + flux analog - total - flux - tracklength + + H1 O16 B10 B11 + nu-scatter-P3 + analog + H1 O16 B10 B11 - scatter - tracklength + nu-scatter + analog H1 O16 B10 B11 - scatter-P3 + scatter analog @@ -1029,16 +1026,39 @@ total flux - tracklength + analog + + + + H1 O16 B10 B11 + nu-fission + analog + + + + + + H1 O16 B10 B11 + scatter + analog + + + + + total + flux + tracklength + + H1 O16 B10 B11 scatter tracklength - + @@ -1046,7 +1066,29 @@ scatter-P3 analog - + + + + total + flux + tracklength + + + + + H1 O16 B10 B11 + scatter + tracklength + + + + + + H1 O16 B10 B11 + scatter-P3 + analog + + @@ -1054,7 +1096,7 @@ nu-scatter-0 analog - + @@ -1062,70 +1104,70 @@ scatter-0 analog - + H1 O16 B10 B11 nu-fission analog - + H1 O16 B10 B11 nu-fission analog - + H1 O16 B10 B11 prompt-nu-fission analog - + H1 O16 B10 B11 prompt-nu-fission analog - + total flux tracklength - + H1 O16 B10 B11 inverse-velocity tracklength - + total flux tracklength - + H1 O16 B10 B11 prompt-nu-fission tracklength - + total flux analog - + diff --git a/tests/test_mgxs_library_nuclides/results_true.dat b/tests/test_mgxs_library_nuclides/results_true.dat index 243adc368..c521a1a55 100644 --- a/tests/test_mgxs_library_nuclides/results_true.dat +++ b/tests/test_mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -5df54054ab37cd69b7096b9f785be57a83a8c3872d3e065ff605aa6de5688640a5551f99313a3e60a9ab8f902c1d4927630e1838db26a2a09d41e29338634b43 \ No newline at end of file +107576b21fa8ed72f71ac65866e4ad1100cc62df527f6f4e6bb8a6318f3694614b6ba1c72634b2e97474a75ea1b3112dcb9b4b36e58f0417e5b04aee5d3c7570 \ No newline at end of file From 67ff99511db109fdd3fadc31af80f13b25c4437c Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 7 Mar 2017 10:24:06 -0500 Subject: [PATCH 33/40] Removed Fox --- src/xml/fox | 1 - 1 file changed, 1 deletion(-) delete mode 160000 src/xml/fox diff --git a/src/xml/fox b/src/xml/fox deleted file mode 160000 index bdc852f4f..000000000 --- a/src/xml/fox +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bdc852f4f43d969fb1b179cba79295c1e095a455 From a42d492a3030e922dfca1a0a2baee6fa293e1dab Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 7 Mar 2017 11:38:44 -0500 Subject: [PATCH 34/40] Fixed filters for normalization of scattering probability matrix with angular histogram representation --- openmc/mgxs/mgxs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 402152608..595c0b596 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3963,6 +3963,8 @@ class ScatterMatrixXS(MatrixMGXS): # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] + if self.scatter_format == 'histogram': + norm._filters.append(norm._filters[-1]) # Multiply by the group-to-group probability matrix self._xs_tally *= (self.tallies[tally_key] / norm) From 0c3e586dd227948606c24c1576832f772478eacf Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 8 Mar 2017 14:23:49 -0500 Subject: [PATCH 35/40] Tally merging now consolidates moment scores --- openmc/mgxs/library.py | 45 ++++++++++++++++------ openmc/mgxs/mgxs.py | 14 ++++++- openmc/tallies.py | 84 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 126 insertions(+), 17 deletions(-) diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 0a9a94828..7ebe6cb8c 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -1089,8 +1089,8 @@ class Library(object): using_multiplicity = True # multiplicity will fall back to using scatter and nu-scatter - elif ((('scatter matrix' in self.mgxs_types) and - ('nu-scatter matrix' in self.mgxs_types))): + elif 'scatter matrix' in self.mgxs_types and \ + 'nu-scatter matrix' in self.mgxs_types: scatt_mgxs = self.get_mgxs(domain, 'scatter matrix') nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix') xsdata.set_multiplicity_matrix_mgxs(nuscatt_mgxs, scatt_mgxs, @@ -1099,17 +1099,38 @@ class Library(object): subdomain=subdomain) using_multiplicity = True + # multiplicity will fall back to using scatter and nu-scatter + elif 'consistent scatter matrix' in self.mgxs_types and \ + 'consistent nu-scatter matrix' in self.mgxs_types: + scatt_mgxs = self.get_mgxs(domain, 'consistent scatter matrix') + nuscatt_mgxs = \ + self.get_mgxs(domain, 'consistent nu-scatter matrix') + xsdata.set_multiplicity_matrix_mgxs(nuscatt_mgxs, scatt_mgxs, + xs_type=xs_type, + nuclide=[nuclide], + subdomain=subdomain) + using_multiplicity = True + else: using_multiplicity = False if using_multiplicity: - nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix') + if 'nu-scatter matrix' in self.mgxs_types: + nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix') + else: + nuscatt_mgxs = \ + self.get_mgxs(domain, 'consistent nu-scatter matrix') xsdata.set_scatter_matrix_mgxs(nuscatt_mgxs, xs_type=xs_type, nuclide=[nuclide], subdomain=subdomain) else: - if 'nu-scatter matrix' in self.mgxs_types: - nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix') + if 'nu-scatter matrix' in self.mgxs_types or \ + 'consistent nu-scatter matrix' in self.mgxs_types: + if 'nu-scatter matrix' in self.mgxs_types: + nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix') + else: + nuscatt_mgxs = \ + self.get_mgxs(domain, 'consistent nu-scatter matrix') xsdata.set_scatter_matrix_mgxs(nuscatt_mgxs, xs_type=xs_type, nuclide=[nuclide], subdomain=subdomain) @@ -1409,13 +1430,15 @@ class Library(object): error_flag = True warn('An "absorption" MGXS type is required but not provided.') # Ensure nu-scattering matrix is required - if 'nu-scatter matrix' not in self.mgxs_types: + if 'nu-scatter matrix' not in self.mgxs_types and \ + 'consistent nu-scatter matrix' not in self.mgxs_types: error_flag = True warn('A "nu-scatter matrix" MGXS type is required but not provided.') else: # Ok, now see the status of scatter and/or multiplicity - if ((('scatter matrix' not in self.mgxs_types) and - ('multiplicity matrix' not in self.mgxs_types))): + if 'scatter matrix' not in self.mgxs_types or \ + 'consistent scatter matrix' not in self.mgxs_types and \ + 'multiplicity matrix' not in self.mgxs_types: # We dont have data needed for multiplicity matrix, therefore # we need total, and not transport. if 'total' not in self.mgxs_types: @@ -1424,14 +1447,12 @@ class Library(object): 'scattering matrix is not provided.') # Total or transport can be present, but if using # self.correction=="P0", then we should use transport. - if (((self.correction == "P0") and - ('nu-transport' not in self.mgxs_types))): + if self.correction == "P0" and 'nu-transport' not in self.mgxs_types: error_flag = True warn('A "nu-transport" MGXS type is required since a "P0" ' 'correction is applied, but a "nu-transport" MGXS is ' 'not provided.') - elif (((self.correction is None) and - ('total' not in self.mgxs_types))): + elif self.correction is None and 'total' not in self.mgxs_types: error_flag = True warn('A "total" MGXS type is required, but not provided.') diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 84a2e3faf..46f65b113 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -2747,8 +2747,18 @@ class TransportXS(MGXS): @property def rxn_rate_tally(self): - raise NotImplementedError('The reaction rate tally is poorly defined' \ - ' for the transport cross section') + if self._rxn_rate_tally is None: + # Switch EnergyoutFilter to EnergyFilter. + old_filt = self.tallies['scatter-1'].filters[-1] + new_filt = openmc.EnergyFilter(old_filt.bins) + new_filt.stride = old_filt.stride + self.tallies['scatter-1'].filters[-1] = new_filt + + self._rxn_rate_tally = \ + self.tallies['total'] - self.tallies['scatter-1'] + self._rxn_rate_tally.sparse = self.sparse + + return self._rxn_rate_tally @property def xs_tally(self): diff --git a/openmc/tallies.py b/openmc/tallies.py index a71d1c1c5..d79e979d8 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -2,12 +2,10 @@ from __future__ import division from collections import Iterable, MutableSequence import copy +import re from functools import partial -import os -import pickle import itertools from numbers import Integral, Real -import sys import warnings from xml.etree import ElementTree as ET @@ -1013,8 +1011,88 @@ class Tally(object): # Sparsify merged tally if both tallies are sparse merged_tally.sparse = self.sparse and other.sparse + # Consolidate scatter and flux Legendre moment scores + merged_tally._consolidate_moment_scores() + return merged_tally + def _consolidate_moment_scores(self): + """Remove redundant scattering moment scores from a merged Tally.""" + + # FIXME: This should also work for flux moments + + # Use regex to find (nu-)scatter-(P)n scores + scatt_n = [x for x in self.scores if + re.search(r'^((?!nu-)scatter-\d)', x)] + scatt_pn = [x for x in self.scores if + re.search(r'^((?!nu-)scatter-(P|p)\d)', x)] + nuscatt_n = [x for x in self.scores if + re.search(r'nu-scatter-\d', x)] + nuscatt_pn = [x for x in self.scores if + re.search(r'nu-scatter-(P|p)\d', x)] + + flux_n = [x for x in self.scores if + re.search(r'flux-\d', x)] + flux_pn = [x for x in self.scores if + re.search(r'flux-(P|p)\d', x)] + + # Find all other non-scattering moment scores + # FIXME: this should also find non-flux moment scores + scores = [x for x in self.scores if + re.search(r'^((?!scatter-).)*$', x)] + + # Consolidate scatter moment scores + if len(scatt_pn) > 0: + + # Only keep the highest scatter-PN score + high_pn = sorted([x.lower() for x in scatt_pn])[-1] + pn = int(high_pn.split('-')[1].replace('p', '')) + + # Only keep the scatter-N scores with N > PN + scatt_n = sorted([x.lower() for x in scatt_n]) + scatt_n = [x for x in scatt_n if (int(x.split('-')[1]) > pn)] + + # Append highest scatter-PN and any higher scatter-N scores + scores.extend([high_pn] + scatt_n) + else: + scores.extend(scatt_n) + + # Consolidate nu-scatter moment scores + if len(nuscatt_pn) > 0: + + # Only keep the highest nu-scatter-PN score + high_nupn = sorted([x.lower() for x in nuscatt_pn])[-1] + pn = int(high_nupn.split('-')[1].replace('p', '')) + + # Only keep the nu-scatter-N scores with N > PN + nuscatt_n = sorted([x.lower() for x in nuscatt_n]) + nuscatt_n = [x for x in nuscatt_n if (int(x.split('-')[1]) > pn)] + + # Append highest nu-scatter-PN and any higher nu-scatter-N scores + scores.extend([high_pn] + nuscatt_n) + else: + scores.extend(nuscatt_n) + + # Consolidate flux moment scores + if len(flux_pn) > 0: + + # Only keep the highest flux-PN score + high_pn = sorted([x.lower() for x in flux_pn])[-1] + pn = int(high_pn.split('-')[1].replace('p', '')) + + # Only keep the flux-N scores with N > PN + flux_n = sorted([x.lower() for x in flux_n]) + flux_n = [x for x in flux_n if (int(x.split('-')[1]) > pn)] + + # Append highest flux_n-PN and any higher flux_n-N scores + scores.extend([high_pn] + flux_n) + else: + scores.extend(flux_n) + + # Override Tally's scores with consolidated list of scores + self.scores = scores + + def to_xml_element(self): """Return XML representation of the tally From 3af6f49e23c924ade05ab18f970f40ba848f1b3a Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 8 Mar 2017 18:50:19 -0500 Subject: [PATCH 36/40] Shortened moment score consolidation code --- openmc/tallies.py | 85 +++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 61 deletions(-) diff --git a/openmc/tallies.py b/openmc/tallies.py index d79e979d8..0bf87de10 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -1017,77 +1017,40 @@ class Tally(object): return merged_tally def _consolidate_moment_scores(self): - """Remove redundant scattering moment scores from a merged Tally.""" + """Remove redundant scattering and flux moment scores from a Tally.""" - # FIXME: This should also work for flux moments + # Define regex for scatter, nu-scatter and flux moment scores + regex = [(r'^((?!nu-)scatter-\d)', r'^((?!nu-)scatter-(P|p)\d)'), + (r'nu-scatter-\d', r'nu-scatter-(P|p)\d'), + (r'flux-\d', r'flux-(P|p)\d')] - # Use regex to find (nu-)scatter-(P)n scores - scatt_n = [x for x in self.scores if - re.search(r'^((?!nu-)scatter-\d)', x)] - scatt_pn = [x for x in self.scores if - re.search(r'^((?!nu-)scatter-(P|p)\d)', x)] - nuscatt_n = [x for x in self.scores if - re.search(r'nu-scatter-\d', x)] - nuscatt_pn = [x for x in self.scores if - re.search(r'nu-scatter-(P|p)\d', x)] - - flux_n = [x for x in self.scores if - re.search(r'flux-\d', x)] - flux_pn = [x for x in self.scores if - re.search(r'flux-(P|p)\d', x)] - - # Find all other non-scattering moment scores - # FIXME: this should also find non-flux moment scores + # Find all non-scattering and non-flux moment scores scores = [x for x in self.scores if re.search(r'^((?!scatter-).)*$', x)] + scores = [x for x in scores if + re.search(r'^((?!flux-).)*$', x)] - # Consolidate scatter moment scores - if len(scatt_pn) > 0: + for regex_n, regex_pn in regex: - # Only keep the highest scatter-PN score - high_pn = sorted([x.lower() for x in scatt_pn])[-1] - pn = int(high_pn.split('-')[1].replace('p', '')) + # Use regex to find score-(P)n scores + score_n = [x for x in self.scores if re.search(regex_n, x)] + score_pn = [x for x in self.scores if re.search(regex_pn, x)] - # Only keep the scatter-N scores with N > PN - scatt_n = sorted([x.lower() for x in scatt_n]) - scatt_n = [x for x in scatt_n if (int(x.split('-')[1]) > pn)] + # Consolidate moment scores + if len(score_pn) > 0: - # Append highest scatter-PN and any higher scatter-N scores - scores.extend([high_pn] + scatt_n) - else: - scores.extend(scatt_n) + # Only keep the highest score-PN score + high_pn = sorted([x.lower() for x in score_pn])[-1] + pn = int(high_pn.split('-')[-1].replace('p', '')) - # Consolidate nu-scatter moment scores - if len(nuscatt_pn) > 0: + # Only keep the score-N scores with N > PN + score_n = sorted([x.lower() for x in score_n]) + score_n = [x for x in score_n if (int(x.split('-')[1]) > pn)] - # Only keep the highest nu-scatter-PN score - high_nupn = sorted([x.lower() for x in nuscatt_pn])[-1] - pn = int(high_nupn.split('-')[1].replace('p', '')) - - # Only keep the nu-scatter-N scores with N > PN - nuscatt_n = sorted([x.lower() for x in nuscatt_n]) - nuscatt_n = [x for x in nuscatt_n if (int(x.split('-')[1]) > pn)] - - # Append highest nu-scatter-PN and any higher nu-scatter-N scores - scores.extend([high_pn] + nuscatt_n) - else: - scores.extend(nuscatt_n) - - # Consolidate flux moment scores - if len(flux_pn) > 0: - - # Only keep the highest flux-PN score - high_pn = sorted([x.lower() for x in flux_pn])[-1] - pn = int(high_pn.split('-')[1].replace('p', '')) - - # Only keep the flux-N scores with N > PN - flux_n = sorted([x.lower() for x in flux_n]) - flux_n = [x for x in flux_n if (int(x.split('-')[1]) > pn)] - - # Append highest flux_n-PN and any higher flux_n-N scores - scores.extend([high_pn] + flux_n) - else: - scores.extend(flux_n) + # Append highest score-PN and any higher score-N scores + scores.extend([high_pn] + score_n) + else: + scores.extend(score_n) # Override Tally's scores with consolidated list of scores self.scores = scores From ea833eab4dbf59022e77a6cf3d717a2188dd6c81 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 9 Mar 2017 09:06:13 -0500 Subject: [PATCH 37/40] Small bug fix for scattering matrix histogram binning --- openmc/mgxs/mgxs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 46f65b113..250daf4e9 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3971,7 +3971,9 @@ class ScatterMatrixXS(MatrixMGXS): # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] if self.scatter_format == 'histogram': - norm._filters.append(norm._filters[-1]) + bins = np.linspace( + -1., 1., num=self.histogram_bins + 1, endpoint=True) + norm._filters.append(openmc.MuFilter(bins)) # Multiply by the group-to-group probability matrix self._xs_tally *= (self.tallies[tally_key] / norm) From 23cf630636a4ba145ff39d7db2b45d186928356f Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 9 Mar 2017 14:48:49 -0500 Subject: [PATCH 38/40] Fixed issue with consistent nu-scatter matrix with Legendre moments --- openmc/mgxs/mgxs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 250daf4e9..8f0eba1a8 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4125,8 +4125,9 @@ class ScatterMatrixXS(MatrixMGXS): self.tallies[tally_key].scores = \ [score_prefix + '{}'.format(i) for i in range(self.legendre_order + 1)] - elif self.scatter_format == 'histogram': - self.tallies[self.rxn_type].scores = [self.rxn_type] +# elif self.scatter_format == 'histogram': +# print(self.tallies.keys(), self.tally_keys) +# self.tallies[self.rxn_type].scores = [self.rxn_type] super(ScatterMatrixXS, self).load_from_statepoint(statepoint) From 2906994115d00d621d3b91e4dcff138fae5cd4f4 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 9 Mar 2017 18:55:12 -0500 Subject: [PATCH 39/40] Fixed normalization of scattering prob matrix with histogram format --- openmc/mgxs/mgxs.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 8f0eba1a8..f03994dc0 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3964,16 +3964,31 @@ class ScatterMatrixXS(MatrixMGXS): energyout_bins = [self.energy_groups.get_group_bounds(i) for i in range(self.num_groups, 0, -1)] tally_key = 'scatter-P{}'.format(self.legendre_order) + + # Compute normalization factor summed across outgoing energies norm = self.tallies[tally_key].get_slice(scores=['scatter-0']) norm = norm.summation( filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] + + # Compute normalization factor summed across outgoing mu bins if self.scatter_format == 'histogram': - bins = np.linspace( + + # (Re-)append the MuFilter which was removed above + mu_bins = np.linspace( -1., 1., num=self.histogram_bins + 1, endpoint=True) - norm._filters.append(openmc.MuFilter(bins)) + norm._filters.append(openmc.MuFilter(mu_bins)) + + # Sum across all mu bins + mu_bins = [(mu_bins[i], mu_bins[i+1]) for + i in range(self.histogram_bins)] + norm = norm.summation( + filter_type=openmc.MuFilter, filter_bins=mu_bins) + + # Remove the AggregateFilter summed across mu bins + norm._filters = norm._filters[:2] # Multiply by the group-to-group probability matrix self._xs_tally *= (self.tallies[tally_key] / norm) From 3a8bd3d35df8c1f43a141ac8a89ac2fd98cb96b4 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Fri, 10 Mar 2017 18:12:38 -0500 Subject: [PATCH 40/40] Removed commented out code in consistent scatter matrix per comment by @nelsonag --- openmc/mgxs/mgxs.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index f03994dc0..65a452a15 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -4140,9 +4140,6 @@ class ScatterMatrixXS(MatrixMGXS): self.tallies[tally_key].scores = \ [score_prefix + '{}'.format(i) for i in range(self.legendre_order + 1)] -# elif self.scatter_format == 'histogram': -# print(self.tallies.keys(), self.tally_keys) -# self.tallies[self.rxn_type].scores = [self.rxn_type] super(ScatterMatrixXS, self).load_from_statepoint(statepoint)