diff --git a/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb b/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb index a6dda13d6..845c71118 100644 --- a/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb +++ b/docs/source/pythonapi/examples/multi-group-cross-sections.ipynb @@ -309,7 +309,7 @@ "cell_type": "code", "execution_count": 11, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ @@ -324,7 +324,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Next, we must instruct our multi-group cross section objects to generate the tallies needed to calculate each of them in OpenMC. This can be done with the `MGXS.create_tallies()` routine." + "Each multi-group cross section object stores its tallies in a Python dictionary called `tallies`. We can inspect the tallies in the dictionary for our `NuFission` object as follows. " ] }, { @@ -333,34 +333,12 @@ "metadata": { "collapsed": false }, - "outputs": [], - "source": [ - "# Instruct each multi-group cross section to generate tallies\n", - "transport.create_tallies()\n", - "nufission.create_tallies()\n", - "nuscatter.create_tallies()\n", - "chi.create_tallies()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Each multi-group cross section object stores its tallies in a Python dictionary called `tallies`. We can inspect the tallies in the dictionary for our `NuFission` object as follows. " - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, "outputs": [ { "data": { "text/plain": [ "OrderedDict([('flux', Tally\n", - "\tID =\t10003\n", + "\tID =\t10000\n", "\tName =\t\n", "\tFilters =\t\n", " \t\tcell\t[1]\n", @@ -371,7 +349,7 @@ "\tScores =\t['flux']\n", "\tEstimator =\ttracklength\n", "), ('nu-fission', Tally\n", - "\tID =\t10004\n", + "\tID =\t10001\n", "\tName =\t\n", "\tFilters =\t\n", " \t\tcell\t[1]\n", @@ -384,7 +362,7 @@ ")])" ] }, - "execution_count": 13, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -402,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": { "collapsed": false }, @@ -440,7 +418,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "metadata": { "collapsed": false }, @@ -466,7 +444,7 @@ " License: http://mit-crpg.github.io/openmc/license.html\n", " Version: 0.7.0\n", " Git SHA1: 21738db07debeabde824c9b955bd3bf0c9a16366\n", - " Date/Time: 2015-10-27 17:26:51\n", + " Date/Time: 2015-10-28 10:30:50\n", " MPI Processes: 1\n", "\n", " ===========================================================================\n", @@ -552,20 +530,20 @@ "\n", " =======================> TIMING STATISTICS <=======================\n", "\n", - " Total time for initialization = 1.0480E+00 seconds\n", - " Reading cross sections = 3.3600E-01 seconds\n", - " Total time in simulation = 2.8493E+01 seconds\n", - " Time in transport only = 2.8402E+01 seconds\n", - " Time in inactive batches = 3.3050E+00 seconds\n", - " Time in active batches = 2.5188E+01 seconds\n", - " Time synchronizing fission bank = 6.0000E-03 seconds\n", + " Total time for initialization = 3.9900E-01 seconds\n", + " Reading cross sections = 9.3000E-02 seconds\n", + " Total time in simulation = 1.3697E+01 seconds\n", + " Time in transport only = 1.3685E+01 seconds\n", + " Time in inactive batches = 1.8610E+00 seconds\n", + " Time in active batches = 1.1836E+01 seconds\n", + " Time synchronizing fission bank = 1.0000E-03 seconds\n", " Sampling source sites = 1.0000E-03 seconds\n", - " SEND/RECV source sites = 4.0000E-03 seconds\n", + " SEND/RECV source sites = 0.0000E+00 seconds\n", " Time accumulating tallies = 0.0000E+00 seconds\n", - " Total time for finalization = 3.0000E-03 seconds\n", - " Total time elapsed = 2.9569E+01 seconds\n", - " Calculation Rate (inactive) = 7564.30 neutrons/second\n", - " Calculation Rate (active) = 3970.14 neutrons/second\n", + " Total time for finalization = 2.0000E-03 seconds\n", + " Total time elapsed = 1.4106E+01 seconds\n", + " Calculation Rate (inactive) = 13433.6 neutrons/second\n", + " Calculation Rate (active) = 8448.80 neutrons/second\n", "\n", " ============================> RESULTS <============================\n", "\n", @@ -583,7 +561,7 @@ "0" ] }, - "execution_count": 15, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -610,7 +588,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 15, "metadata": { "collapsed": false }, @@ -629,7 +607,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -649,7 +627,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 17, "metadata": { "collapsed": false }, @@ -671,7 +649,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 18, "metadata": { "collapsed": false }, @@ -714,7 +692,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 19, "metadata": { "collapsed": false }, @@ -755,11 +733,18 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/mgxs/mgxs.py:1250: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)\n" + ] + }, { "data": { "text/html": [ @@ -885,7 +870,7 @@ "54 1 2 2 total 0.266499 0.001265" ] }, - "execution_count": 21, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -904,7 +889,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 21, "metadata": { "collapsed": true }, @@ -922,7 +907,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 22, "metadata": { "collapsed": true }, @@ -950,7 +935,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 23, "metadata": { "collapsed": false }, @@ -972,7 +957,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 24, "metadata": { "collapsed": true }, @@ -1006,7 +991,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 25, "metadata": { "collapsed": false }, @@ -1015,9 +1000,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "[ NORMAL ] Importing ray tracing data from file...\n", + "[ NORMAL ] Ray tracing for track segmentation...\n", + "[ NORMAL ] Dumping tracks to file...\n", "[ NORMAL ] Computing the eigenvalue...\n", - "[ NORMAL ] Iteration 0:\tk_eff = 0.685184\tres = 8.020E-317\n", + "[ NORMAL ] Iteration 0:\tk_eff = 0.685184\tres = 1.350E-316\n", "[ NORMAL ] Iteration 1:\tk_eff = 0.785642\tres = 3.148E-01\n", "[ NORMAL ] Iteration 2:\tk_eff = 0.750185\tres = 1.466E-01\n", "[ NORMAL ] Iteration 3:\tk_eff = 0.728846\tres = 4.513E-02\n", @@ -1167,7 +1153,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 26, "metadata": { "collapsed": false }, @@ -1230,7 +1216,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 27, "metadata": { "collapsed": false }, @@ -1264,7 +1250,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 28, "metadata": { "collapsed": true }, @@ -1290,7 +1276,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 29, "metadata": { "collapsed": true }, @@ -1319,7 +1305,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 30, "metadata": { "collapsed": false }, @@ -1356,7 +1342,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 31, "metadata": { "collapsed": false }, @@ -1381,7 +1367,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 32, "metadata": { "collapsed": true }, @@ -1408,7 +1394,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 33, "metadata": { "collapsed": false }, @@ -1431,7 +1417,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 34, "metadata": { "collapsed": false }, @@ -1462,7 +1448,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 35, "metadata": { "collapsed": false }, @@ -1481,9 +1467,6 @@ " \n", " # Tally cross sections by nuclide (e.g., micro cross sections)\n", " xs_library[cell.id][rxn_type].by_nuclide = True\n", - " \n", - " # Create OpenMC tallies for this cross section\n", - " xs_library[cell.id][rxn_type].create_tallies()\n", " \n", " # Add OpenMC tallies to the tallies file for XML generation\n", " for tally in xs_library[cell.id][rxn_type].tallies.values():\n", @@ -1502,7 +1485,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 36, "metadata": { "collapsed": false }, @@ -1528,7 +1511,7 @@ " License: http://mit-crpg.github.io/openmc/license.html\n", " Version: 0.7.0\n", " Git SHA1: 21738db07debeabde824c9b955bd3bf0c9a16366\n", - " Date/Time: 2015-10-27 17:27:22\n", + " Date/Time: 2015-10-28 10:31:06\n", " MPI Processes: 1\n", "\n", " ===========================================================================\n", @@ -1605,7 +1588,7 @@ " 48/1 1.23570 1.22442 +/- 0.00187\n", " 49/1 1.22288 1.22438 +/- 0.00182\n", " 50/1 1.20470 1.22389 +/- 0.00184\n", - " Triggers unsatisfied, max unc./thresh. is 1.18932 for flux in tally 10090\n", + " Triggers unsatisfied, max unc./thresh. is 1.18932 for flux in tally 10080\n", " The estimated number of batches is 67\n", " Creating state point statepoint.050.h5...\n", " 51/1 1.24158 1.22432 +/- 0.00185\n", @@ -1635,20 +1618,20 @@ "\n", " =======================> TIMING STATISTICS <=======================\n", "\n", - " Total time for initialization = 1.2520E+00 seconds\n", - " Reading cross sections = 2.9400E-01 seconds\n", - " Total time in simulation = 3.6113E+02 seconds\n", - " Time in transport only = 3.6098E+02 seconds\n", - " Time in inactive batches = 2.7487E+01 seconds\n", - " Time in active batches = 3.3365E+02 seconds\n", - " Time synchronizing fission bank = 3.4000E-02 seconds\n", - " Sampling source sites = 2.2000E-02 seconds\n", - " SEND/RECV source sites = 1.2000E-02 seconds\n", - " Time accumulating tallies = 2.0000E-03 seconds\n", - " Total time for finalization = 1.5000E-02 seconds\n", - " Total time elapsed = 3.6247E+02 seconds\n", - " Calculation Rate (inactive) = 3638.08 neutrons/second\n", - " Calculation Rate (active) = 1198.88 neutrons/second\n", + " Total time for initialization = 3.8900E-01 seconds\n", + " Reading cross sections = 8.4000E-02 seconds\n", + " Total time in simulation = 2.2985E+02 seconds\n", + " Time in transport only = 2.2979E+02 seconds\n", + " Time in inactive batches = 1.3571E+01 seconds\n", + " Time in active batches = 2.1628E+02 seconds\n", + " Time synchronizing fission bank = 1.5000E-02 seconds\n", + " Sampling source sites = 1.0000E-02 seconds\n", + " SEND/RECV source sites = 5.0000E-03 seconds\n", + " Time accumulating tallies = 0.0000E+00 seconds\n", + " Total time for finalization = 8.0000E-03 seconds\n", + " Total time elapsed = 2.3028E+02 seconds\n", + " Calculation Rate (inactive) = 7368.65 neutrons/second\n", + " Calculation Rate (active) = 1849.45 neutrons/second\n", "\n", " ============================> RESULTS <============================\n", "\n", @@ -1666,7 +1649,7 @@ "0" ] }, - "execution_count": 37, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -1696,7 +1679,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 37, "metadata": { "collapsed": false }, @@ -1717,7 +1700,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 38, "metadata": { "collapsed": false }, @@ -1753,7 +1736,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 39, "metadata": { "collapsed": false }, @@ -1807,7 +1790,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 40, "metadata": { "collapsed": false }, @@ -1849,7 +1832,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 41, "metadata": { "collapsed": false }, @@ -1979,7 +1962,7 @@ "119 10002 1 5 O-16 0.000000 0.000000" ] }, - "execution_count": 42, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1999,7 +1982,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 42, "metadata": { "collapsed": false }, @@ -2027,7 +2010,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 43, "metadata": { "collapsed": false }, @@ -2036,7 +2019,7 @@ "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWYAAADDCAYAAACxgLv/AAAABHNCSVQICAg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M9luklxGiHrRDLsF3JeUXGuRm4AthUQltS\nNQF/AWYA55YQpx/2m8XjgJnAXSR7U6VorbOHKK8L5zO323Rel6MwN5XhNUrRFRtfugTrYRRrE7YL\n2Rs4kuLOTzwe+Bgbn/LVWz4cWzmHAxdivYNidAAOBG53f9cBV5XYtsTsIX8qMU4lKK8L4zu323Re\nl6Mwf0jzcZY+WO8iBB2BR4EHgMmeYq4BngIOLuK5hwEnYONnDwNHAfeV2J4l7u8n2CzQg4qMs9hd\nXnPXJ2KJXIo8s4cETXldGN+5rbwuUQdsrKUa25KUcpAEF8fHQZIqLDFu9hCrJ3ZkF2Br4EXg6BJj\n1lD6kettgG3d/12AvwJDS4j3IrCH+78OuKGEWGDjsmeWGKNSlNfFKzW3ldeeDMeODr8H/LyEOA8D\nHwFfYON7I0uINQTbTZtN8vSWYUXG2g8bn5qNncJzRQntSqih9CPX/bA2zcZOnSrlvQfYH+tZvIHN\n+lHK0esuwHKSK1hrpLwuTqm5rbwWERERERERERERERERERERERERERERERGRtu3/AZvD3wdjaiUx\nAAAAAElFTkSuQmCC\n", "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -2067,7 +2050,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 44, "metadata": { "collapsed": true }, @@ -2089,7 +2072,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 45, "metadata": { "collapsed": false }, @@ -2128,7 +2111,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 46, "metadata": { "collapsed": false }, @@ -2211,7 +2194,7 @@ "2 10000 2 O-16 3.798833 0.010031" ] }, - "execution_count": 47, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } @@ -2237,7 +2220,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 47, "metadata": { "collapsed": false }, @@ -2259,7 +2242,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 48, "metadata": { "collapsed": false }, @@ -2307,7 +2290,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 49, "metadata": { "collapsed": false }, @@ -2335,7 +2318,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 50, "metadata": { "collapsed": false }, @@ -2370,7 +2353,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 51, "metadata": { "collapsed": false }, @@ -2411,7 +2394,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 52, "metadata": { "collapsed": false }, @@ -2429,7 +2412,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 53, "metadata": { "collapsed": false }, diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 32f9c937a..c135eeea7 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -248,7 +248,6 @@ class Library(object): if isinstance(mgxs, openmc.mgxs.ScatterMatrixXS): mgxs.correction = self.correction - mgxs.create_tallies() self.all_mgxs[domain.id][mgxs_type] = mgxs def add_to_tallies_file(self, tallies_file, merge=True): diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 775c51941..65e80f0d3 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -41,7 +41,7 @@ DOMAIN_TYPES = ['cell', # Supported domain classes # TODO: Implement Mesh domains -_DOMAINS = [openmc.Cell, +DOMAINS = [openmc.Cell, openmc.Universe, openmc.Material] @@ -106,7 +106,7 @@ class MGXS(object): self._domain_type = None self._energy_groups = None self._tally_trigger = None - self._tallies = OrderedDict() + self._tallies = None self._xs_tally = None self.name = name @@ -409,7 +409,6 @@ class MGXS(object): return densities - @abc.abstractmethod def create_tallies(self, scores, all_filters, keys, estimator): """Instantiates tallies needed to compute the multi-group cross section. @@ -437,6 +436,8 @@ class MGXS(object): cv.check_type('keys', keys, Iterable, basestring) cv.check_value('estimator', estimator, ['analog', 'tracklength']) + self._tallies = OrderedDict() + # Create a domain Filter object domain_filter = openmc.Filter(self.domain_type, self.domain.id) @@ -535,9 +536,6 @@ class MGXS(object): 'which is not yet supported'.format(self.domain_type) raise ValueError(msg) - # Create Tallies to search for in StatePoint - self.create_tallies() - # Use tally "slicing" to ensure that tallies correspond to our domain # NOTE: This is important if tally merging was used if self.domain_type != 'distribcell': @@ -1263,7 +1261,8 @@ class TotalXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'total' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two tracklength tallies to compute the 'flux' @@ -1272,18 +1271,24 @@ class TotalXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'total'] - estimator = 'tracklength' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'total'] + estimator = 'tracklength' + keys = scores - # Initialize the Tallies - super(TotalXS, self).create_tallies(scores, filters, keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter]] + + # Initialize the Tallies + super(TotalXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(TotalXS, self).tallies def compute_xs(self): """Computes the multi-group total cross sections using OpenMC @@ -1303,7 +1308,8 @@ class TransportXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'transport' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs three analog tallies to compute the 'flux', @@ -1312,20 +1318,25 @@ class TransportXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'total', 'scatter-P1'] - estimator = 'analog' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - energyout_filter = openmc.Filter('energyout', group_edges) - filters = [[energy_filter], [energy_filter], [energyout_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'total', 'scatter-P1'] + estimator = 'analog' + keys = scores - # Initialize the Tallies - super(TransportXS, self).create_tallies(scores, filters, - keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + energyout_filter = openmc.Filter('energyout', group_edges) + filters = [[energy_filter], [energy_filter], [energyout_filter]] + + # Initialize the Tallies + super(TransportXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(TransportXS, self).tallies def load_from_statepoint(self, statepoint): """Extracts tallies in an OpenMC StatePoint with the data needed to @@ -1375,7 +1386,8 @@ class AbsorptionXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'absorption' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two tracklength tallies to compute the 'flux' @@ -1384,19 +1396,24 @@ class AbsorptionXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'absorption'] - estimator = 'tracklength' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'absorption'] + estimator = 'tracklength' + keys = scores - # Initialize the Tallies - super(AbsorptionXS, self).create_tallies(scores, filters, - keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter]] + + # Initialize the Tallies + super(AbsorptionXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(AbsorptionXS, self).tallies def compute_xs(self): """Computes the multi-group absorption cross sections using OpenMC @@ -1415,7 +1432,8 @@ class CaptureXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'capture' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two tracklength tallies to compute the 'flux' @@ -1424,18 +1442,24 @@ class CaptureXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'absorption', 'fission'] - estimator = 'tracklength' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'absorption', 'fission'] + estimator = 'tracklength' + keys = scores - # Initialize the Tallies - super(CaptureXS, self).create_tallies(scores, filters, keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter], [energy_filter]] + + # Initialize the Tallies + super(CaptureXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(CaptureXS, self).tallies def compute_xs(self): """Computes the multi-group capture cross sections using OpenMC @@ -1455,7 +1479,8 @@ class FissionXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'fission' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two tracklength tallies to compute the 'flux' @@ -1464,18 +1489,24 @@ class FissionXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'fission'] - estimator = 'tracklength' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'fission'] + estimator = 'tracklength' + keys = scores - # Initialize the Tallies - super(FissionXS, self).create_tallies(scores, filters, keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter]] + + # Initialize the Tallies + super(FissionXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(FissionXS, self).tallies def compute_xs(self): """Computes the multi-group fission cross sections using OpenMC @@ -1494,7 +1525,8 @@ class NuFissionXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'nu-fission' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two tracklength tallies to compute the 'flux' @@ -1503,19 +1535,24 @@ class NuFissionXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'nu-fission'] - estimator = 'tracklength' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'nu-fission'] + estimator = 'tracklength' + keys = scores - # Initialize the Tallies - super(NuFissionXS, self).create_tallies(scores, filters, - keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter]] + + # Initialize the Tallies + super(NuFissionXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(NuFissionXS, self).tallies def compute_xs(self): """Computes the multi-group nu-fission cross sections using OpenMC @@ -1534,7 +1571,8 @@ class ScatterXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'scatter' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two tracklength tallies to compute the 'flux' @@ -1543,18 +1581,24 @@ class ScatterXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'scatter'] - estimator = 'tracklength' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'scatter'] + estimator = 'tracklength' + keys = scores - # Intialize the Tallies - super(ScatterXS, self).create_tallies(scores, filters, keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter]] + + # Intialize the Tallies + super(ScatterXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(ScatterXS, self).tallies def compute_xs(self): """Computes the scattering multi-group cross sections using @@ -1573,7 +1617,8 @@ class NuScatterXS(MGXS): groups, by_nuclide, name) self._rxn_type = 'nu-scatter' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two analog tallies to compute the 'flux' @@ -1582,19 +1627,24 @@ class NuScatterXS(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['flux', 'nu-scatter'] - estimator = 'analog' - keys = scores + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy_filter = openmc.Filter('energy', group_edges) - filters = [[energy_filter], [energy_filter]] + # Create a list of scores for each Tally to be created + scores = ['flux', 'nu-scatter'] + estimator = 'analog' + keys = scores - # Initialize the Tallies - super(NuScatterXS, self).create_tallies(scores, filters, - keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy_filter = openmc.Filter('energy', group_edges) + filters = [[energy_filter], [energy_filter]] + + # Initialize the Tallies + super(NuScatterXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(NuScatterXS, self).tallies def compute_xs(self): """Computes the nu-scattering multi-group cross section using OpenMC @@ -1630,12 +1680,8 @@ class ScatterMatrixXS(MGXS): def correction(self): return self._correction - @correction.setter - def correction(self, correction): - cv.check_value('correction', correction, ('P0', None)) - self._correction = correction - - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs three analog tallies to compute the 'flux', @@ -1644,24 +1690,34 @@ class ScatterMatrixXS(MGXS): """ - group_edges = self.energy_groups.group_edges - energy = openmc.Filter('energy', group_edges) - energyout = openmc.Filter('energyout', group_edges) + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create a list of scores for each Tally to be created - if self.correction == 'P0': - scores = ['flux', 'scatter', 'scatter-P1'] - filters = [[energy], [energy, energyout], [energyout]] - else: - scores = ['flux', 'scatter'] - filters = [[energy], [energy, energyout]] + group_edges = self.energy_groups.group_edges + energy = openmc.Filter('energy', group_edges) + energyout = openmc.Filter('energyout', group_edges) - estimator = 'analog' - keys = scores + # Create a list of scores for each Tally to be created + if self.correction == 'P0': + scores = ['flux', 'scatter', 'scatter-P1'] + filters = [[energy], [energy, energyout], [energyout]] + else: + scores = ['flux', 'scatter'] + filters = [[energy], [energy, energyout]] - # Initialize the Tallies - super(ScatterMatrixXS, self).create_tallies(scores, filters, - keys, estimator) + estimator = 'analog' + keys = scores + + # Initialize the Tallies + super(ScatterMatrixXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(ScatterMatrixXS, self).tallies + + @correction.setter + def correction(self, correction): + cv.check_value('correction', correction, ('P0', None)) + self._correction = correction def compute_xs(self, correction='P0'): """Computes the multi-group scattering matrix using OpenMC @@ -1943,7 +1999,8 @@ class NuScatterMatrixXS(ScatterMatrixXS): groups, by_nuclide, name) self._rxn_type = 'nu-scatter matrix' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs three analog tallies to compute the 'flux', @@ -1952,26 +2009,31 @@ class NuScatterMatrixXS(ScatterMatrixXS): """ - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energy = openmc.Filter('energy', group_edges) - energyout = openmc.Filter('energyout', group_edges) + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create a list of scores for each Tally to be created - if self.correction == 'P0': - scores = ['flux', 'nu-scatter', 'scatter-P1'] - estimator = 'analog' - keys = ['flux', 'scatter', 'scatter-P1'] - filters = [[energy], [energy, energyout], [energyout]] - else: - scores = ['flux', 'nu-scatter'] - estimator = 'analog' - keys = ['flux', 'scatter'] - filters = [[energy], [energy, energyout]] + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energy = openmc.Filter('energy', group_edges) + energyout = openmc.Filter('energyout', group_edges) - # Intialize the Tallies - super(ScatterMatrixXS, self).create_tallies(scores, filters, - keys, estimator) + # Create a list of scores for each Tally to be created + if self.correction == 'P0': + scores = ['flux', 'nu-scatter', 'scatter-P1'] + estimator = 'analog' + keys = ['flux', 'scatter', 'scatter-P1'] + filters = [[energy], [energy, energyout], [energyout]] + else: + scores = ['flux', 'nu-scatter'] + estimator = 'analog' + keys = ['flux', 'scatter'] + filters = [[energy], [energy, energyout]] + + # Intialize the Tallies + super(ScatterMatrixXS, self).create_tallies(scores, filters, + keys, estimator) + + return super(ScatterMatrixXS, self).tallies class Chi(MGXS): """The fission spectrum.""" @@ -1981,7 +2043,8 @@ class Chi(MGXS): super(Chi, self).__init__(domain, domain_type, groups, by_nuclide, name) self._rxn_type = 'chi' - def create_tallies(self): + @property + def tallies(self): """Construct the OpenMC tallies needed to compute this cross section. This method constructs two analog tallies to compute 'nu-fission' @@ -1990,19 +2053,24 @@ class Chi(MGXS): """ - # Create a list of scores for each Tally to be created - scores = ['nu-fission', 'nu-fission'] - estimator = 'analog' - keys = ['nu-fission-in', 'nu-fission-out'] + # Instantiate tallies if they do not exist + if self._tallies is None: - # Create the non-domain specific Filters for the Tallies - group_edges = self.energy_groups.group_edges - energyout = openmc.Filter('energyout', group_edges) - energyin = openmc.Filter('energy', [group_edges[0], group_edges[-1]]) - filters = [[energyin], [energyout]] + # Create a list of scores for each Tally to be created + scores = ['nu-fission', 'nu-fission'] + estimator = 'analog' + keys = ['nu-fission-in', 'nu-fission-out'] - # Intialize the Tallies - super(Chi, self).create_tallies(scores, filters, keys, estimator) + # Create the non-domain specific Filters for the Tallies + group_edges = self.energy_groups.group_edges + energyout = openmc.Filter('energyout', group_edges) + energyin = openmc.Filter('energy', [group_edges[0], group_edges[-1]]) + filters = [[energyin], [energyout]] + + # Intialize the Tallies + super(Chi, self).create_tallies(scores, filters, keys, estimator) + + return super(Chi, self).tallies def compute_xs(self): """Computes chi fission spectrum using OpenMC tally arithmetic."""