diff --git a/docs/source/pythonapi/examples/mgxs-part-i.ipynb b/docs/source/pythonapi/examples/mgxs-part-i.ipynb index ea75bec722..5c51b11d38 100644 --- a/docs/source/pythonapi/examples/mgxs-part-i.ipynb +++ b/docs/source/pythonapi/examples/mgxs-part-i.ipynb @@ -183,7 +183,7 @@ "cell_type": "code", "execution_count": 4, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ @@ -208,7 +208,7 @@ "cell_type": "code", "execution_count": 5, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ @@ -229,7 +229,7 @@ "cell_type": "code", "execution_count": 6, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ @@ -324,9 +324,9 @@ "outputs": [], "source": [ "# OpenMC simulation parameters\n", - "batches = 50\n", + "batches = 20\n", "inactive = 10\n", - "particles = 2500\n", + "particles = 1000\n", "\n", "# Instantiate a Settings object\n", "settings_file = openmc.Settings()\n", @@ -395,10 +395,20 @@ }, "outputs": [], "source": [ + "# Instantiate a tally Mesh\n", + "mesh = openmc.Mesh(name='mesh')\n", + "mesh.type = 'regular'\n", + "mesh.dimension = [1, 1]\n", + "mesh.lower_left = [-0.63, -0.63]\n", + "mesh.upper_right = [+0.63, +0.63]\n", + "\n", "# Instantiate a few different sections\n", - "total = mgxs.TotalXS(domain=cell, groups=groups)\n", - "absorption = mgxs.AbsorptionXS(domain=cell, groups=groups)\n", - "scattering = mgxs.ScatterXS(domain=cell, groups=groups)" + "total = mgxs.TotalXS(domain=mesh, groups=groups)\n", + "absorption = mgxs.AbsorptionXS(domain=mesh, groups=groups)\n", + "scattering = mgxs.ScatterXS(domain=mesh, groups=groups)\n", + "#total = mgxs.TotalXS(domain=cell, groups=groups)\n", + "#absorption = mgxs.AbsorptionXS(domain=cell, groups=groups)\n", + "#scattering = mgxs.ScatterXS(domain=cell, groups=groups)" ] }, { @@ -419,24 +429,22 @@ "data": { "text/plain": [ "OrderedDict([('flux', Tally\n", - "\tID =\t10000\n", - "\tName =\t\n", - "\tFilters =\t\n", - " \t\tcell\t[1]\n", - " \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n", - "\tNuclides =\ttotal \n", - "\tScores =\t['flux']\n", - "\tEstimator =\ttracklength\n", - "), ('absorption', Tally\n", - "\tID =\t10001\n", - "\tName =\t\n", - "\tFilters =\t\n", - " \t\tcell\t[1]\n", - " \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n", - "\tNuclides =\ttotal \n", - "\tScores =\t['absorption']\n", - "\tEstimator =\ttracklength\n", - ")])" + " \tID =\t10000\n", + " \tName =\t\n", + " \tFilters =\t\n", + " \t\tmesh\t[10000]\n", + " \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n", + " \tNuclides =\ttotal \n", + " \tScores =\t['flux']\n", + " \tEstimator =\ttracklength), ('absorption', Tally\n", + " \tID =\t10001\n", + " \tName =\t\n", + " \tFilters =\t\n", + " \t\tmesh\t[10000]\n", + " \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n", + " \tNuclides =\ttotal \n", + " \tScores =\t['absorption']\n", + " \tEstimator =\ttracklength)])" ] }, "execution_count": 13, @@ -513,8 +521,8 @@ " Copyright: 2011-2016 Massachusetts Institute of Technology\n", " License: http://openmc.readthedocs.io/en/latest/license.html\n", " Version: 0.7.1\n", - " Git SHA1: 19feb55e6d5e8350398627f39fb55ee8e2e63011\n", - " Date/Time: 2016-05-13 10:19:16\n", + " Git SHA1: d30d010aea2c1cba90c993a9c501be9d5d81921d\n", + " Date/Time: 2016-06-28 13:31:05\n", " MPI Processes: 1\n", "\n", " ===========================================================================\n", @@ -541,57 +549,27 @@ "\n", " Bat./Gen. k Average k \n", " ========= ======== ==================== \n", - " 1/1 1.11184 \n", - " 2/1 1.15820 \n", - " 3/1 1.18468 \n", - " 4/1 1.17492 \n", - " 5/1 1.19645 \n", - " 6/1 1.18436 \n", - " 7/1 1.14070 \n", - " 8/1 1.15150 \n", - " 9/1 1.19202 \n", - " 10/1 1.17677 \n", - " 11/1 1.20272 \n", - " 12/1 1.21366 1.20819 +/- 0.00547\n", - " 13/1 1.15906 1.19181 +/- 0.01668\n", - " 14/1 1.14687 1.18058 +/- 0.01629\n", - " 15/1 1.14570 1.17360 +/- 0.01442\n", - " 16/1 1.13480 1.16713 +/- 0.01343\n", - " 17/1 1.17680 1.16852 +/- 0.01144\n", - " 18/1 1.16866 1.16853 +/- 0.00990\n", - " 19/1 1.19253 1.17120 +/- 0.00913\n", - " 20/1 1.18124 1.17220 +/- 0.00823\n", - " 21/1 1.19206 1.17401 +/- 0.00766\n", - " 22/1 1.17681 1.17424 +/- 0.00700\n", - " 23/1 1.17634 1.17440 +/- 0.00644\n", - " 24/1 1.13659 1.17170 +/- 0.00654\n", - " 25/1 1.17144 1.17169 +/- 0.00609\n", - " 26/1 1.20649 1.17386 +/- 0.00610\n", - " 27/1 1.11238 1.17024 +/- 0.00678\n", - " 28/1 1.18911 1.17129 +/- 0.00647\n", - " 29/1 1.14681 1.17000 +/- 0.00626\n", - " 30/1 1.12152 1.16758 +/- 0.00641\n", - " 31/1 1.12729 1.16566 +/- 0.00639\n", - " 32/1 1.15399 1.16513 +/- 0.00612\n", - " 33/1 1.13547 1.16384 +/- 0.00599\n", - " 34/1 1.17723 1.16440 +/- 0.00576\n", - " 35/1 1.09296 1.16154 +/- 0.00622\n", - " 36/1 1.19621 1.16287 +/- 0.00612\n", - " 37/1 1.12560 1.16149 +/- 0.00605\n", - " 38/1 1.17872 1.16211 +/- 0.00586\n", - " 39/1 1.17721 1.16263 +/- 0.00568\n", - " 40/1 1.13724 1.16178 +/- 0.00555\n", - " 41/1 1.18526 1.16254 +/- 0.00542\n", - " 42/1 1.13779 1.16177 +/- 0.00531\n", - " 43/1 1.15066 1.16143 +/- 0.00516\n", - " 44/1 1.12174 1.16026 +/- 0.00514\n", - " 45/1 1.17479 1.16068 +/- 0.00501\n", - " 46/1 1.14146 1.16014 +/- 0.00489\n", - " 47/1 1.20464 1.16135 +/- 0.00491\n", - " 48/1 1.15119 1.16108 +/- 0.00479\n", - " 49/1 1.17938 1.16155 +/- 0.00468\n", - " 50/1 1.15798 1.16146 +/- 0.00457\n", - " Creating state point statepoint.50.h5...\n", + " 1/1 1.07993 \n", + " 2/1 1.23691 \n", + " 3/1 1.17407 \n", + " 4/1 1.08258 \n", + " 5/1 1.21012 \n", + " 6/1 1.23825 \n", + " 7/1 1.18016 \n", + " 8/1 1.20989 \n", + " 9/1 1.15475 \n", + " 10/1 1.13462 \n", + " 11/1 1.12749 \n", + " 12/1 1.09502 1.11125 +/- 0.01623\n", + " 13/1 1.24722 1.15657 +/- 0.04628\n", + " 14/1 1.14700 1.15418 +/- 0.03281\n", + " 15/1 1.13889 1.15112 +/- 0.02560\n", + " 16/1 1.19008 1.15762 +/- 0.02189\n", + " 17/1 1.11320 1.15127 +/- 0.01956\n", + " 18/1 1.12093 1.14748 +/- 0.01736\n", + " 19/1 1.13809 1.14643 +/- 0.01534\n", + " 20/1 1.09886 1.14168 +/- 0.01452\n", + " Creating state point statepoint.20.h5...\n", "\n", " ===========================================================================\n", " ======================> SIMULATION FINISHED <======================\n", @@ -600,27 +578,27 @@ "\n", " =======================> TIMING STATISTICS <=======================\n", "\n", - " Total time for initialization = 4.2300E-01 seconds\n", - " Reading cross sections = 9.3000E-02 seconds\n", - " Total time in simulation = 1.6549E+01 seconds\n", - " Time in transport only = 1.6535E+01 seconds\n", - " Time in inactive batches = 2.3650E+00 seconds\n", - " Time in active batches = 1.4184E+01 seconds\n", - " Time synchronizing fission bank = 5.0000E-03 seconds\n", - " Sampling source sites = 3.0000E-03 seconds\n", + " Total time for initialization = 8.1200E-01 seconds\n", + " Reading cross sections = 2.4200E-01 seconds\n", + " Total time in simulation = 2.8910E+00 seconds\n", + " Time in transport only = 2.8710E+00 seconds\n", + " Time in inactive batches = 8.5700E-01 seconds\n", + " Time in active batches = 2.0340E+00 seconds\n", + " Time synchronizing fission bank = 0.0000E+00 seconds\n", + " Sampling source sites = 0.0000E+00 seconds\n", " SEND/RECV source sites = 0.0000E+00 seconds\n", " Time accumulating tallies = 0.0000E+00 seconds\n", - " Total time for finalization = 0.0000E+00 seconds\n", - " Total time elapsed = 1.6981E+01 seconds\n", - " Calculation Rate (inactive) = 10570.8 neutrons/second\n", - " Calculation Rate (active) = 7050.20 neutrons/second\n", + " Total time for finalization = 1.0000E-03 seconds\n", + " Total time elapsed = 3.7090E+00 seconds\n", + " Calculation Rate (inactive) = 11668.6 neutrons/second\n", + " Calculation Rate (active) = 4916.42 neutrons/second\n", "\n", " ============================> RESULTS <============================\n", "\n", - " k-effective (Collision) = 1.15984 +/- 0.00411\n", - " k-effective (Track-length) = 1.16146 +/- 0.00457\n", - " k-effective (Absorption) = 1.16177 +/- 0.00380\n", - " Combined k-effective = 1.16105 +/- 0.00364\n", + " k-effective (Collision) = 1.14223 +/- 0.01330\n", + " k-effective (Track-length) = 1.14168 +/- 0.01452\n", + " k-effective (Absorption) = 1.16108 +/- 0.00876\n", + " Combined k-effective = 1.15408 +/- 0.00566\n", " Leakage Fraction = 0.00000 +/- 0.00000\n", "\n" ] @@ -664,7 +642,7 @@ "outputs": [], "source": [ "# Load the last statepoint file\n", - "sp = openmc.StatePoint('statepoint.50.h5')" + "sp = openmc.StatePoint('statepoint.20.h5')" ] }, { @@ -729,11 +707,11 @@ "text": [ "Multi-Group XS\n", "\tReaction Type =\ttotal\n", - "\tDomain Type =\tcell\n", - "\tDomain ID =\t1\n", + "\tDomain Type =\tmesh\n", + "\tDomain ID =\t10000\n", "\tCross Sections [cm^-1]:\n", - " Group 1 [6.25e-07 - 20.0 MeV]:\t6.81e-01 +/- 2.69e-01%\n", - " Group 2 [0.0 - 6.25e-07 MeV]:\t1.40e+00 +/- 5.93e-01%\n", + " Group 1 [6.25e-07 - 20.0 MeV]:\t6.79e-01 +/- 7.64e-01%\n", + " Group 2 [0.0 - 6.25e-07 MeV]:\t1.40e+00 +/- 1.79e+00%\n", "\n", "\n", "\n" @@ -764,40 +742,55 @@ "
\n", "\n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
cellmesh 10000group innuclidemeanstd. dev.
xyz
11111total0.6677870.0018020.6662610.005072
01112total1.2920130.0076421.2924510.022969
\n", "
" ], "text/plain": [ - " cell group in nuclide mean std. dev.\n", - "1 1 1 total 0.667787 0.001802\n", - "0 1 2 total 1.292013 0.007642" + " mesh 10000 group in nuclide mean std. dev.\n", + " x y z \n", + "1 1 1 1 1 total 0.666261 0.005072\n", + "0 1 1 1 2 total 1.292451 0.022969" ] }, "execution_count": 19, @@ -821,11 +814,11 @@ "cell_type": "code", "execution_count": 20, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ - "absorption.export_xs_data(filename='absorption-xs', format='excel')" + "#absorption.export_xs_data(filename='absorption-xs', format='excel')" ] }, { @@ -875,9 +868,9 @@ "
\n", "\n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -885,40 +878,58 @@ " \n", " \n", " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
cellmesh 10000energy low [MeV]energy high [MeV]nuclidemeanstd. dev.
xyz
01110.000000e+006.250000e-07total(((total / flux) - (absorption / flux)) - (sca...-3.774758e-150.011292-1.554312e-150.033991
11116.250000e-072.000000e+01total(((total / flux) - (absorption / flux)) - (sca...1.443290e-150.002570-2.886580e-150.007258
\n", "
" ], "text/plain": [ - " cell energy low [MeV] energy high [MeV] nuclide \\\n", - "0 1 0.00e+00 6.25e-07 total \n", - "1 1 6.25e-07 2.00e+01 total \n", + " mesh 10000 energy low [MeV] energy high [MeV] nuclide \\\n", + " x y z \n", + "0 1 1 1 0.00e+00 6.25e-07 total \n", + "1 1 1 1 6.25e-07 2.00e+01 total \n", "\n", - " score mean std. dev. \n", - "0 (((total / flux) - (absorption / flux)) - (sca... -3.77e-15 1.13e-02 \n", - "1 (((total / flux) - (absorption / flux)) - (sca... 1.44e-15 2.57e-03 " + " score mean std. dev. \n", + " \n", + "0 (((total / flux) - (absorption / flux)) - (sca... -1.55e-15 3.40e-02 \n", + "1 (((total / flux) - (absorption / flux)) - (sca... -2.89e-15 7.26e-03 " ] }, "execution_count": 22, @@ -954,9 +965,9 @@ "
\n", "\n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -964,40 +975,58 @@ " \n", " \n", " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
cellmesh 10000energy low [MeV]energy high [MeV]nuclidemeanstd. dev.
xyz
01110.000000e+006.250000e-07total((absorption / flux) / (total / flux))0.0761150.0006490.0761440.001984
11116.250000e-072.000000e+01total((absorption / flux) / (total / flux))0.0192630.0000950.0192240.000329
\n", "
" ], "text/plain": [ - " cell energy low [MeV] energy high [MeV] nuclide \\\n", - "0 1 0.00e+00 6.25e-07 total \n", - "1 1 6.25e-07 2.00e+01 total \n", + " mesh 10000 energy low [MeV] energy high [MeV] nuclide \\\n", + " x y z \n", + "0 1 1 1 0.00e+00 6.25e-07 total \n", + "1 1 1 1 6.25e-07 2.00e+01 total \n", "\n", - " score mean std. dev. \n", - "0 ((absorption / flux) / (total / flux)) 7.61e-02 6.49e-04 \n", - "1 ((absorption / flux) / (total / flux)) 1.93e-02 9.46e-05 " + " score mean std. dev. \n", + " \n", + "0 ((absorption / flux) / (total / flux)) 7.61e-02 1.98e-03 \n", + "1 ((absorption / flux) / (total / flux)) 1.92e-02 3.29e-04 " ] }, "execution_count": 23, @@ -1026,9 +1055,9 @@ "
\n", "\n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -1036,40 +1065,58 @@ " \n", " \n", " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
cellmesh 10000energy low [MeV]energy high [MeV]nuclidemeanstd. dev.
xyz
01110.000000e+006.250000e-07total((scatter / flux) / (total / flux))0.9238850.0077360.9238560.023272
11116.250000e-072.000000e+01total((scatter / flux) / (total / flux))0.9807370.0037370.9807760.010576
\n", "
" ], "text/plain": [ - " cell energy low [MeV] energy high [MeV] nuclide \\\n", - "0 1 0.00e+00 6.25e-07 total \n", - "1 1 6.25e-07 2.00e+01 total \n", + " mesh 10000 energy low [MeV] energy high [MeV] nuclide \\\n", + " x y z \n", + "0 1 1 1 0.00e+00 6.25e-07 total \n", + "1 1 1 1 6.25e-07 2.00e+01 total \n", "\n", - " score mean std. dev. \n", - "0 ((scatter / flux) / (total / flux)) 9.24e-01 7.74e-03 \n", - "1 ((scatter / flux) / (total / flux)) 9.81e-01 3.74e-03 " + " score mean std. dev. \n", + " \n", + "0 ((scatter / flux) / (total / flux)) 9.24e-01 2.33e-02 \n", + "1 ((scatter / flux) / (total / flux)) 9.81e-01 1.06e-02 " ] }, "execution_count": 24, @@ -1105,9 +1152,9 @@ "
\n", "\n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -1115,40 +1162,58 @@ " \n", " \n", " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
cellmesh 10000energy low [MeV]energy high [MeV]nuclidemeanstd. dev.
xyz
01110.000000e+006.250000e-07total(((absorption / flux) / (total / flux)) + ((sc...1.00.00776310.023356
11116.250000e-072.000000e+01total(((absorption / flux) / (total / flux)) + ((sc...1.00.00373910.010581
\n", "
" ], "text/plain": [ - " cell energy low [MeV] energy high [MeV] nuclide \\\n", - "0 1 0.00e+00 6.25e-07 total \n", - "1 1 6.25e-07 2.00e+01 total \n", + " mesh 10000 energy low [MeV] energy high [MeV] nuclide \\\n", + " x y z \n", + "0 1 1 1 0.00e+00 6.25e-07 total \n", + "1 1 1 1 6.25e-07 2.00e+01 total \n", "\n", - " score mean std. dev. \n", - "0 (((absorption / flux) / (total / flux)) + ((sc... 1.00e+00 7.76e-03 \n", - "1 (((absorption / flux) / (total / flux)) + ((sc... 1.00e+00 3.74e-03 " + " score mean std. dev. \n", + " \n", + "0 (((absorption / flux) / (total / flux)) + ((sc... 1.00e+00 2.34e-02 \n", + "1 (((absorption / flux) / (total / flux)) + ((sc... 1.00e+00 1.06e-02 " ] }, "execution_count": 25, @@ -1163,6 +1228,24 @@ "# The scattering-to-total ratio is a derived tally which can generate Pandas DataFrames for inspection\n", "sum_ratio.get_pandas_dataframe()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] } ], "metadata": { @@ -1181,7 +1264,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.11" } }, "nbformat": 4, diff --git a/docs/source/pythonapi/examples/mgxs-part-iii.ipynb b/docs/source/pythonapi/examples/mgxs-part-iii.ipynb index 5f0acde3f1..e89a9cb7dc 100644 --- a/docs/source/pythonapi/examples/mgxs-part-iii.ipynb +++ b/docs/source/pythonapi/examples/mgxs-part-iii.ipynb @@ -32,7 +32,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/wboyd/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py:1350: UserWarning: This call to matplotlib.use() has no effect\n", + "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py:1350: UserWarning: This call to matplotlib.use() has no effect\n", "because the backend has already been chosen;\n", "matplotlib.use() must be called *before* pylab, matplotlib.pyplot,\n", "or matplotlib.backends is imported for the first time.\n", @@ -94,7 +94,7 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ @@ -458,7 +458,7 @@ "outputs": [ { "data": { - "image/png": "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\n", + "image/png": "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\n", "text/plain": [ "" ] @@ -557,14 +557,14 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Specify multi-group cross section types to compute\n", - "mgxs_lib.mgxs_types = ['transport', 'nu-fission', 'fission', 'nu-scatter matrix', 'chi']" + "mgxs_lib.mgxs_types = ['transport', 'nu-fission', 'fission', 'nu-scatter matrix', 'chi', 'chi-delayed']" ] }, { @@ -578,7 +578,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "metadata": { "collapsed": true }, @@ -600,7 +600,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 22, "metadata": { "collapsed": true }, @@ -619,7 +619,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 23, "metadata": { "collapsed": true }, @@ -640,7 +640,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 24, "metadata": { "collapsed": true }, @@ -660,7 +660,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 25, "metadata": { "collapsed": false }, @@ -688,7 +688,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 26, "metadata": { "collapsed": true }, @@ -700,7 +700,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 27, "metadata": { "collapsed": false }, @@ -725,8 +725,8 @@ " Copyright: 2011-2016 Massachusetts Institute of Technology\n", " License: http://openmc.readthedocs.io/en/latest/license.html\n", " Version: 0.7.1\n", - " Git SHA1: 47ef320ad517612376e181ec6a6bc42ca0db98ce\n", - " Date/Time: 2016-05-14 12:29:07\n", + " Git SHA1: d30d010aea2c1cba90c993a9c501be9d5d81921d\n", + " Date/Time: 2016-06-17 12:58:23\n", " MPI Processes: 1\n", "\n", " ===========================================================================\n", @@ -778,32 +778,32 @@ " 22/1 1.04175 1.02516 +/- 0.00588\n", " 23/1 1.01909 1.02469 +/- 0.00543\n", " 24/1 1.07119 1.02801 +/- 0.00603\n", - " 25/1 0.97445 1.02444 +/- 0.00665\n", - " 26/1 1.04737 1.02588 +/- 0.00638\n", - " 27/1 1.04656 1.02709 +/- 0.00612\n", - " 28/1 1.03464 1.02751 +/- 0.00578\n", - " 29/1 1.02528 1.02739 +/- 0.00547\n", - " 30/1 1.02799 1.02742 +/- 0.00519\n", - " 31/1 1.05846 1.02890 +/- 0.00516\n", - " 32/1 1.03811 1.02932 +/- 0.00493\n", - " 33/1 1.00894 1.02843 +/- 0.00480\n", - " 34/1 1.02049 1.02810 +/- 0.00460\n", - " 35/1 1.00690 1.02726 +/- 0.00450\n", - " 36/1 1.03129 1.02741 +/- 0.00432\n", - " 37/1 0.98864 1.02597 +/- 0.00440\n", - " 38/1 1.00017 1.02505 +/- 0.00434\n", - " 39/1 1.03635 1.02544 +/- 0.00421\n", - " 40/1 1.07090 1.02696 +/- 0.00434\n", - " 41/1 1.03141 1.02710 +/- 0.00420\n", - " 42/1 1.02624 1.02707 +/- 0.00406\n", - " 43/1 1.02668 1.02706 +/- 0.00394\n", - " 44/1 1.05940 1.02801 +/- 0.00394\n", - " 45/1 1.01149 1.02754 +/- 0.00385\n", - " 46/1 1.06958 1.02871 +/- 0.00392\n", - " 47/1 1.02674 1.02866 +/- 0.00381\n", - " 48/1 1.02542 1.02857 +/- 0.00371\n", - " 49/1 1.03516 1.02874 +/- 0.00362\n", - " 50/1 1.06818 1.02973 +/- 0.00366\n", + " 25/1 0.97414 1.02442 +/- 0.00666\n", + " 26/1 1.04709 1.02584 +/- 0.00639\n", + " 27/1 1.05872 1.02777 +/- 0.00631\n", + " 28/1 1.03930 1.02841 +/- 0.00598\n", + " 29/1 1.01488 1.02770 +/- 0.00570\n", + " 30/1 1.04513 1.02857 +/- 0.00548\n", + " 31/1 0.99538 1.02699 +/- 0.00545\n", + " 32/1 1.00106 1.02581 +/- 0.00532\n", + " 33/1 0.99389 1.02442 +/- 0.00527\n", + " 34/1 0.99938 1.02338 +/- 0.00516\n", + " 35/1 1.02161 1.02331 +/- 0.00495\n", + " 36/1 1.04084 1.02398 +/- 0.00480\n", + " 37/1 0.98801 1.02265 +/- 0.00481\n", + " 38/1 1.01348 1.02232 +/- 0.00464\n", + " 39/1 1.06693 1.02386 +/- 0.00474\n", + " 40/1 1.07729 1.02564 +/- 0.00491\n", + " 41/1 1.03191 1.02585 +/- 0.00475\n", + " 42/1 1.05209 1.02667 +/- 0.00468\n", + " 43/1 1.02997 1.02677 +/- 0.00453\n", + " 44/1 1.07288 1.02812 +/- 0.00460\n", + " 45/1 1.01268 1.02768 +/- 0.00449\n", + " 46/1 1.03759 1.02796 +/- 0.00437\n", + " 47/1 1.02620 1.02791 +/- 0.00425\n", + " 48/1 1.02509 1.02783 +/- 0.00414\n", + " 49/1 1.01043 1.02739 +/- 0.00406\n", + " 50/1 1.01457 1.02707 +/- 0.00397\n", " Creating state point statepoint.50.h5...\n", "\n", " ===========================================================================\n", @@ -813,27 +813,27 @@ "\n", " =======================> TIMING STATISTICS <=======================\n", "\n", - " Total time for initialization = 5.7700E-01 seconds\n", - " Reading cross sections = 1.3400E-01 seconds\n", - " Total time in simulation = 8.0461E+01 seconds\n", - " Time in transport only = 8.0422E+01 seconds\n", - " Time in inactive batches = 6.4060E+00 seconds\n", - " Time in active batches = 7.4055E+01 seconds\n", - " Time synchronizing fission bank = 6.0000E-03 seconds\n", - " Sampling source sites = 2.0000E-03 seconds\n", - " SEND/RECV source sites = 3.0000E-03 seconds\n", - " Time accumulating tallies = 0.0000E+00 seconds\n", + " Total time for initialization = 8.4000E-01 seconds\n", + " Reading cross sections = 2.5400E-01 seconds\n", + " Total time in simulation = 7.0993E+01 seconds\n", + " Time in transport only = 7.0952E+01 seconds\n", + " Time in inactive batches = 5.0170E+00 seconds\n", + " Time in active batches = 6.5976E+01 seconds\n", + " Time synchronizing fission bank = 3.0000E-03 seconds\n", + " Sampling source sites = 1.0000E-03 seconds\n", + " SEND/RECV source sites = 1.0000E-03 seconds\n", + " Time accumulating tallies = 1.0000E-03 seconds\n", " Total time for finalization = 0.0000E+00 seconds\n", - " Total time elapsed = 8.1067E+01 seconds\n", - " Calculation Rate (inactive) = 3902.59 neutrons/second\n", - " Calculation Rate (active) = 1350.35 neutrons/second\n", + " Total time elapsed = 7.1853E+01 seconds\n", + " Calculation Rate (inactive) = 4983.06 neutrons/second\n", + " Calculation Rate (active) = 1515.70 neutrons/second\n", "\n", " ============================> RESULTS <============================\n", "\n", - " k-effective (Collision) = 1.02763 +/- 0.00343\n", - " k-effective (Track-length) = 1.02973 +/- 0.00366\n", - " k-effective (Absorption) = 1.02732 +/- 0.00319\n", - " Combined k-effective = 1.02826 +/- 0.00259\n", + " k-effective (Collision) = 1.02489 +/- 0.00308\n", + " k-effective (Track-length) = 1.02707 +/- 0.00397\n", + " k-effective (Absorption) = 1.02637 +/- 0.00325\n", + " Combined k-effective = 1.02581 +/- 0.00264\n", " Leakage Fraction = 0.00000 +/- 0.00000\n", "\n" ] @@ -844,7 +844,7 @@ "0" ] }, - "execution_count": 26, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -870,7 +870,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 28, "metadata": { "collapsed": false }, @@ -889,7 +889,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 29, "metadata": { "collapsed": false }, @@ -924,7 +924,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 44, "metadata": { "collapsed": false }, @@ -944,19 +944,11 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 45, "metadata": { "collapsed": false }, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/wboyd/Documents/NSE-CRPG-Codes/openmc/openmc/tallies.py:1988: RuntimeWarning: invalid value encountered in true_divide\n", - " self_rel_err = data['self']['std. dev.'] / data['self']['mean']\n" - ] - }, { "data": { "text/html": [ @@ -978,16 +970,16 @@ " 10000\n", " 1\n", " U-235\n", - " 8.055246e-03\n", - " 2.857567e-05\n", + " 8.046809e-03\n", + " 2.697198e-05\n", " \n", " \n", " 4\n", " 10000\n", " 1\n", " U-238\n", - " 7.339215e-03\n", - " 4.349466e-05\n", + " 7.366624e-03\n", + " 4.255197e-05\n", " \n", " \n", " 5\n", @@ -1002,16 +994,16 @@ " 10000\n", " 2\n", " U-235\n", - " 3.615565e-01\n", - " 2.050486e-03\n", + " 3.614917e-01\n", + " 2.135233e-03\n", " \n", " \n", " 1\n", " 10000\n", " 2\n", " U-238\n", - " 6.742638e-07\n", - " 3.795256e-09\n", + " 6.741607e-07\n", + " 3.924924e-09\n", " \n", " \n", " 2\n", @@ -1027,15 +1019,15 @@ ], "text/plain": [ " cell group in nuclide mean std. dev.\n", - "3 10000 1 U-235 8.055246e-03 2.857567e-05\n", - "4 10000 1 U-238 7.339215e-03 4.349466e-05\n", + "3 10000 1 U-235 8.046809e-03 2.697198e-05\n", + "4 10000 1 U-238 7.366624e-03 4.255197e-05\n", "5 10000 1 O-16 0.000000e+00 0.000000e+00\n", - "0 10000 2 U-235 3.615565e-01 2.050486e-03\n", - "1 10000 2 U-238 6.742638e-07 3.795256e-09\n", + "0 10000 2 U-235 3.614917e-01 2.135233e-03\n", + "1 10000 2 U-238 6.741607e-07 3.924924e-09\n", "2 10000 2 O-16 0.000000e+00 0.000000e+00" ] }, - "execution_count": 30, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } @@ -1054,7 +1046,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 32, "metadata": { "collapsed": false }, @@ -1069,13 +1061,13 @@ "\tDomain ID =\t10000\n", "\tNuclide =\tU-235\n", "\tCross Sections [cm^-1]:\n", - " Group 1 [6.25e-07 - 20.0 MeV]:\t8.06e-03 +/- 3.55e-01%\n", - " Group 2 [0.0 - 6.25e-07 MeV]:\t3.62e-01 +/- 5.67e-01%\n", + " Group 1 [6.25e-07 - 20.0 MeV]:\t8.05e-03 +/- 3.35e-01%\n", + " Group 2 [0.0 - 6.25e-07 MeV]:\t3.61e-01 +/- 5.91e-01%\n", "\n", "\tNuclide =\tU-238\n", "\tCross Sections [cm^-1]:\n", - " Group 1 [6.25e-07 - 20.0 MeV]:\t7.34e-03 +/- 5.93e-01%\n", - " Group 2 [0.0 - 6.25e-07 MeV]:\t6.74e-07 +/- 5.63e-01%\n", + " Group 1 [6.25e-07 - 20.0 MeV]:\t7.37e-03 +/- 5.78e-01%\n", + " Group 2 [0.0 - 6.25e-07 MeV]:\t6.74e-07 +/- 5.82e-01%\n", "\n", "\tNuclide =\tO-16\n", "\tCross Sections [cm^-1]:\n", @@ -1100,7 +1092,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 33, "metadata": { "collapsed": false }, @@ -1119,7 +1111,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 34, "metadata": { "collapsed": true }, @@ -1131,7 +1123,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 35, "metadata": { "collapsed": true }, @@ -1150,7 +1142,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 36, "metadata": { "collapsed": true }, @@ -1165,7 +1157,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 41, "metadata": { "collapsed": false }, @@ -1191,16 +1183,16 @@ " 10000\n", " 1\n", " U-235\n", - " 0.074860\n", - " 0.000303\n", + " 0.074734\n", + " 0.000325\n", " \n", " \n", " 1\n", " 10000\n", " 1\n", " U-238\n", - " 0.005952\n", - " 0.000035\n", + " 0.005977\n", + " 0.000034\n", " \n", " \n", " 2\n", @@ -1216,12 +1208,12 @@ ], "text/plain": [ " cell group in nuclide mean std. dev.\n", - "0 10000 1 U-235 0.074860 0.000303\n", - "1 10000 1 U-238 0.005952 0.000035\n", + "0 10000 1 U-235 0.074734 0.000325\n", + "1 10000 1 U-238 0.005977 0.000034\n", "2 10000 1 O-16 0.000000 0.000000" ] }, - "execution_count": 36, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1250,11 +1242,28 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 38, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'RectLattice' object has no attribute 'dimension'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Create an OpenMOC Geometry from the OpenCG Geometry\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mopenmoc_geometry\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_openmoc_geometry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmgxs_lib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopencg_geometry\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/Users/sam/.local/lib/python2.7/site-packages/openmc-0.7.1-py2.7.egg/openmc/mgxs/library.pyc\u001b[0m in \u001b[0;36mopencg_geometry\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 161\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_opencg_geometry\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mopenmc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopencg_compatible\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mget_opencg_geometry\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 163\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_opencg_geometry\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_opencg_geometry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_openmc_geometry\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 164\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_opencg_geometry\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/sam/.local/lib/python2.7/site-packages/openmc-0.7.1-py2.7.egg/openmc/opencg_compatible.pyc\u001b[0m in \u001b[0;36mget_opencg_geometry\u001b[0;34m(openmc_geometry)\u001b[0m\n\u001b[1;32m 997\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 998\u001b[0m \u001b[0mopenmc_root_universe\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopenmc_geometry\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroot_universe\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 999\u001b[0;31m \u001b[0mopencg_root_universe\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_opencg_universe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mopenmc_root_universe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1000\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1001\u001b[0m \u001b[0mopencg_geometry\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopencg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGeometry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/sam/.local/lib/python2.7/site-packages/openmc-0.7.1-py2.7.egg/openmc/opencg_compatible.pyc\u001b[0m in \u001b[0;36mget_opencg_universe\u001b[0;34m(openmc_universe)\u001b[0m\n\u001b[1;32m 746\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 747\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mcell_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mopenmc_cell\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mopenmc_cells\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 748\u001b[0;31m \u001b[0mopencg_cell\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_opencg_cell\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mopenmc_cell\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 749\u001b[0m \u001b[0mopencg_universe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd_cell\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mopencg_cell\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 750\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/sam/.local/lib/python2.7/site-packages/openmc-0.7.1-py2.7.egg/openmc/opencg_compatible.pyc\u001b[0m in \u001b[0;36mget_opencg_cell\u001b[0;34m(openmc_cell)\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0mopencg_cell\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfill\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_opencg_universe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfill\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 455\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 456\u001b[0;31m \u001b[0mopencg_cell\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfill\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_opencg_lattice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfill\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 457\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 458\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mopenmc_cell\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrotation\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/Users/sam/.local/lib/python2.7/site-packages/openmc-0.7.1-py2.7.egg/openmc/opencg_compatible.pyc\u001b[0m in \u001b[0;36mget_opencg_lattice\u001b[0;34m(openmc_lattice)\u001b[0m\n\u001b[1;32m 831\u001b[0m \u001b[0;31m# Create an OpenCG Lattice to represent this OpenMC Lattice\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 832\u001b[0m \u001b[0mname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopenmc_lattice\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 833\u001b[0;31m \u001b[0mdimension\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopenmc_lattice\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdimension\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 834\u001b[0m \u001b[0mpitch\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopenmc_lattice\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpitch\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 835\u001b[0m \u001b[0mlower_left\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopenmc_lattice\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower_left\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAttributeError\u001b[0m: 'RectLattice' object has no attribute 'dimension'" + ] + } + ], "source": [ "# Create an OpenMOC Geometry from the OpenCG Geometry\n", "openmoc_geometry = get_openmoc_geometry(mgxs_lib.opencg_geometry)" @@ -1269,11 +1278,23 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 39, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'openmoc_geometry' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Load the library into the OpenMOC geometry\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mmaterials\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mload_openmc_mgxs_lib\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmgxs_lib\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mopenmoc_geometry\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'openmoc_geometry' is not defined" + ] + } + ], "source": [ "# Load the library into the OpenMOC geometry\n", "materials = load_openmc_mgxs_lib(mgxs_lib, openmoc_geometry)" @@ -1596,21 +1617,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 2", "language": "python", - "name": "python3" + "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 3 + "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.1" + "pygments_lexer": "ipython2", + "version": "2.7.11" } }, "nbformat": 4, diff --git a/docs/source/pythonapi/examples/mgxs-part-iv.ipynb b/docs/source/pythonapi/examples/mgxs-part-iv.ipynb index e5c80c1926..62a6a09da1 100644 --- a/docs/source/pythonapi/examples/mgxs-part-iv.ipynb +++ b/docs/source/pythonapi/examples/mgxs-part-iv.ipynb @@ -1439,21 +1439,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 2", "language": "python", - "name": "python3" + "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 3 + "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.1" + "pygments_lexer": "ipython2", + "version": "2.7.11" } }, "nbformat": 4, diff --git a/examples/xml/basic/materials.xml b/examples/xml/basic/materials.xml index 75ab74dbba..39fce5f278 100644 --- a/examples/xml/basic/materials.xml +++ b/examples/xml/basic/materials.xml @@ -12,7 +12,6 @@ - diff --git a/openmc/__init__.py b/openmc/__init__.py index 0bde0f5843..557e13039f 100644 --- a/openmc/__init__.py +++ b/openmc/__init__.py @@ -9,8 +9,8 @@ from openmc.plots import * from openmc.settings import * from openmc.surface import * from openmc.universe import * -from openmc.mgxs_library import * from openmc.mesh import * +from openmc.mgxs_library import * from openmc.filter import * from openmc.trigger import * from openmc.tallies import * diff --git a/openmc/filter.py b/openmc/filter.py index 72fb3b14ed..4c742352d2 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -564,7 +564,7 @@ class Filter(object): # Initialize dictionary to build Pandas Multi-index column filter_dict = {} - # Append Mesh ID as outermost index of mult-index + # Append Mesh ID as outermost index of multi-index mesh_key = 'mesh {0}'.format(self.mesh.id) # Find mesh dimensions - use 3D indices for simplicity diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 9241892646..9c97942347 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -55,9 +55,10 @@ class Library(object): If true, computes cross sections for each nuclide in each domain mgxs_types : Iterable of str The types of cross sections in the library (e.g., ['total', 'scatter']) - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization - domains : Iterable of openmc.Material, openmc.Cell or openmc.Universe + domains : Iterable of openmc.Material, openmc.Cell, openmc.Universe, or + openmc.Mesh The spatial domain(s) for which MGXS in the Library are computed correction : {'P0', None} Apply the P0 correction to scattering matrices if set to 'P0' @@ -188,6 +189,10 @@ class Library(object): return self.openmc_geometry.get_all_material_cells() elif self.domain_type == 'universe': return self.openmc_geometry.get_all_universes() + # FIXME: Change to get tuples of all domain cells + elif self.domain_type == 'mesh': + raise ValueError('Unable to get all domains for a mesh domain ' + + 'type. The domains must be set to [openmc.Mesh]') else: raise ValueError('Unable to get domains without a domain type') else: @@ -253,11 +258,21 @@ class Library(object): @by_nuclide.setter def by_nuclide(self, by_nuclide): cv.check_type('by_nuclide', by_nuclide, bool) + + if by_nuclide == True and self.domain_type == 'mesh': + raise ValueError('Unable to create MGXS library by nuclide with ' + + 'mesh domain') + self._by_nuclide = by_nuclide @domain_type.setter def domain_type(self, domain_type): cv.check_value('domain type', domain_type, openmc.mgxs.DOMAIN_TYPES) + + if by_nuclide == True and domain_type == 'mesh': + raise ValueError('Unable to create MGXS library by nuclide with ' + + 'mesh domain') + self._domain_type = domain_type @domains.setter @@ -278,6 +293,9 @@ class Library(object): elif self.domain_type == 'universe': cv.check_iterable_type('domain', domains, openmc.Universe) all_domains = self.openmc_geometry.get_all_universes() + elif self.domain_type == 'mesh': + cv.check_iterable_type('domain', domains, openmc.Mesh) + all_domains = domains else: msg = 'Unable to set domains with ' \ 'domain type "{}"'.format(self.domain_type) @@ -458,9 +476,13 @@ class Library(object): Parameters ---------- - domain : Material or Cell or Universe or Integral - The material, cell, or universe object of interest (or its ID) - mgxs_type : {'total', 'transport', 'nu-transport', 'absorption', 'capture', 'fission', 'nu-fission', 'kappa-fission', 'scatter', 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', 'multiplicity matrix', 'nu-fission matrix', chi'} + domain : Material or Cell or Universe or Mesh or Integral + The material, cell, universe, or mesh object of interest (or its ID) + mgxs_type : {'total', 'transport', 'nu-transport', 'absorption', + 'capture', 'fission', 'nu-fission', 'kappa-fission', + 'scatter', 'nu-scatter', 'scatter matrix', + 'nu-scatter matrix', 'multiplicity matrix', + 'nu-fission matrix', chi'} The type of multi-group cross section object to return Returns @@ -482,6 +504,8 @@ class Library(object): cv.check_type('domain', domain, (openmc.Cell, Integral)) elif self.domain_type == 'universe': cv.check_type('domain', domain, (openmc.Universe, Integral)) + elif self.domain_type == 'mesh': + cv.check_type('domain', domain, (openmc.Mesh, Integral)) # Check that requested domain is included in library if isinstance(domain, Integral): @@ -761,7 +785,7 @@ class Library(object): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization xsdata_name : str Name to apply to the "xsdata" entry produced by this method @@ -809,7 +833,7 @@ class Library(object): """ cv.check_type('domain', domain, (openmc.Material, openmc.Cell, - openmc.Cell)) + openmc.Cell, openmc.Mesh)) cv.check_type('xsdata_name', xsdata_name, basestring) cv.check_type('nuclide', nuclide, basestring) cv.check_value('xs_type', xs_type, ['macro', 'micro']) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 088db649fa..fd6d0ee494 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -13,6 +13,7 @@ import numpy as np import openmc import openmc.checkvalue as cv from openmc.mgxs import EnergyGroups +from openmc import Mesh if sys.version_info[0] >= 3: @@ -34,7 +35,10 @@ MGXS_TYPES = ['total', 'nu-scatter matrix', 'multiplicity matrix', 'nu-fission matrix', - 'chi'] + 'chi', + 'chi-delayed', + 'chi-prompt', + 'velocity'] # Supported domain types @@ -42,13 +46,15 @@ MGXS_TYPES = ['total', DOMAIN_TYPES = ['cell', 'distribcell', 'universe', - 'material'] + 'material', + 'mesh'] # Supported domain classes # TODO: Implement Mesh domains _DOMAINS = (openmc.Cell, openmc.Universe, - openmc.Material) + openmc.Material, + openmc.Mesh) class MGXS(object): @@ -63,9 +69,9 @@ class MGXS(object): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + 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 @@ -83,9 +89,9 @@ class MGXS(object): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -111,10 +117,11 @@ class MGXS(object): 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. When the 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). + 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. @@ -260,6 +267,9 @@ class MGXS(object): # Create a domain Filter object domain_filter = openmc.Filter(self.domain_type, self.domain.id) + if self.domain_type == 'mesh': + domain_filter.mesh = self.domain + # 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: @@ -375,6 +385,8 @@ class MGXS(object): 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): @@ -427,11 +439,14 @@ class MGXS(object): Parameters ---------- - mgxs_type : {'total', 'transport', 'nu-transport', 'absorption', 'capture', 'fission', 'nu-fission', 'kappa-fission', 'scatter', 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', 'multiplicity matrix', 'nu-fission matrix', chi'} + mgxs_type : {'total', 'transport', 'nu-transport', 'absorption', + 'capture', 'fission', 'nu-fission', 'kappa-fission', 'scatter', + 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', + 'multiplicity matrix', 'nu-fission matrix', chi'} The type of multi-group cross section object to return - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + 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 @@ -482,6 +497,12 @@ class MGXS(object): mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups) elif mgxs_type == 'chi': mgxs = Chi(domain, domain_type, energy_groups) + elif mgxs_type == 'chi-prompt': + mgxs = ChiPrompt(domain, domain_type, energy_groups) + elif mgxs_type == 'chi-delayed': + mgxs = ChiDelayed(domain, domain_type, energy_groups) + elif mgxs_type == 'velocity': + mgxs = Velocity(domain, domain_type, energy_groups) mgxs.by_nuclide = by_nuclide mgxs.name = name @@ -666,6 +687,8 @@ class MGXS(object): 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) @@ -673,7 +696,23 @@ class MGXS(object): # 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': + if self.domain_type == 'mesh': + filters = [self.domain_type] + bins = [] + if (len(self.domain.dimension) == 3): + nx, ny, nz = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + for z in range(1,nz+1): + bins.append((x, y, z)) + else: + nx, ny = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + bins.append((x, y, 1)) + + filter_bins = [tuple(bins)] + elif self.domain_type != 'distribcell': filters = [self.domain_type] filter_bins = [(self.domain.id,)] # Distribcell filters only accept single cell - neglect it when slicing @@ -752,10 +791,13 @@ class MGXS(object): # Construct a collection of the domain filter bins if not isinstance(subdomains, basestring): - cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=2) + cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=3) for subdomain in subdomains: filters.append(self.domain_type) - filter_bins.append((subdomain,)) + if self.domain_type == 'mesh': + filter_bins.append(subdomain) + else: + filter_bins.append((subdomain,)) # Construct list of energy group bounds tuples for all requested groups if not isinstance(groups, basestring): @@ -1125,6 +1167,20 @@ class MGXS(object): 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': + subdomains_list = [] + if (len(self.domain.dimension) == 3): + nx, ny, nz = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + for z in range(1,nz+1): + subdomains_list.append((x, y, z)) + else: + nx, ny = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + subdomains_list.append((x, y, 1)) + subdomains = [tuple(subdomains_list)] else: subdomains = [self.domain.id] @@ -1261,6 +1317,21 @@ class MGXS(object): elif self.domain_type == 'avg(distribcell)': domain_filter = self.xs_tally.find_filter('avg(distribcell)') subdomains = domain_filter.bins + elif self.domain_type == 'mesh': + bins = [] + if (len(self.domain.dimension) == 3): + nx, ny, nz = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + for z in range(1,nz+1): + bins.append((x, y, z)) + else: + nx, ny = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + bins.append((x, y, 1)) + + subdomains = [tuple(bins)] else: subdomains = [self.domain.id] @@ -1366,8 +1437,8 @@ class MGXS(object): df = self.get_pandas_dataframe(groups=groups, xs_type=xs_type) # Capitalize column label strings - df.columns = df.columns.astype(str) - df.columns = map(str.title, df.columns) + #df.columns = df.columns.astype(str) + #df.columns = map(str.title, df.columns) # Export the data using Pandas IO API if format == 'csv': @@ -1468,7 +1539,10 @@ class MGXS(object): distribcell_paths=distribcell_paths) # Remove the score column since it is homogeneous and redundant - df = df.drop('score', axis=1) + if self.domain_type == 'mesh': + df = df.drop('score', axis=1, level=0) + else: + df = df.drop('score', axis=1) # Override energy groups bounds with indices all_groups = np.arange(self.num_groups, 0, -1, dtype=np.int) @@ -1523,7 +1597,12 @@ class MGXS(object): # Sort the dataframe by domain type id (e.g., distribcell id) and # energy groups such that data is from fast to thermal - df.sort_values(by=[self.domain_type] + columns, inplace=True) + if self.domain_type == 'mesh': + mesh_str = 'mesh {0}'.format(self.domain.id) + df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'y'), \ + (mesh_str, 'z')] + columns, inplace=True) + else: + df.sort_values(by=[self.domain_type] + columns, inplace=True) return df @@ -1542,9 +1621,9 @@ class MatrixMGXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + 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 @@ -1562,9 +1641,9 @@ class MatrixMGXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -1591,9 +1670,10 @@ class MatrixMGXS(MGXS): 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. When the 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). + 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. @@ -1693,7 +1773,10 @@ class MatrixMGXS(MGXS): max_depth=2) for subdomain in subdomains: filters.append(self.domain_type) - filter_bins.append((subdomain,)) + if self.domain_type == 'mesh': + filter_bins.append(subdomain) + else: + filter_bins.append((subdomain,)) # Construct list of energy group bounds tuples for all requested groups if not isinstance(in_groups, basestring): @@ -1852,6 +1935,19 @@ class MatrixMGXS(MGXS): 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': + subdomains = [] + if (len(self.domain.dimension) == 3): + nx, ny, nz = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + for z in range(1,nz+1): + subdomains.append((x, y, z)) + else: + nx, ny = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + subdomains.append((x, y, 1)) else: subdomains = [self.domain.id] @@ -1934,7 +2030,7 @@ class MatrixMGXS(MGXS): class TotalXS(MGXS): - r"""A total multi-group cross section. + """A total multi-group cross section. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated @@ -1961,9 +2057,9 @@ class TotalXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -1981,9 +2077,9 @@ class TotalXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2043,7 +2139,7 @@ class TotalXS(MGXS): class TransportXS(MGXS): - r"""A transport-corrected total multi-group cross section. + """A transport-corrected total multi-group cross section. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated @@ -2079,9 +2175,9 @@ class TransportXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2099,9 +2195,9 @@ class TransportXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2186,7 +2282,7 @@ class TransportXS(MGXS): class NuTransportXS(TransportXS): - r"""A transport-corrected total multi-group cross section which + """A transport-corrected total multi-group cross section which accounts for neutron multiplicity in scattering reactions. This class can be used for both OpenMC input generation and tally data @@ -2209,9 +2305,9 @@ class NuTransportXS(TransportXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2229,9 +2325,9 @@ class NuTransportXS(TransportXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2299,7 +2395,7 @@ class NuTransportXS(TransportXS): class AbsorptionXS(MGXS): - r"""An absorption multi-group cross section. + """An absorption multi-group cross section. Absorption is defined as all reactions that do not produce secondary neutrons (disappearance) plus fission reactions. @@ -2330,9 +2426,9 @@ class AbsorptionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2350,9 +2446,9 @@ class AbsorptionXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2381,9 +2477,10 @@ class AbsorptionXS(MGXS): 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. When the This is equal to the number of cell instances + 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). + 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. @@ -2412,7 +2509,7 @@ class AbsorptionXS(MGXS): class CaptureXS(MGXS): - r"""A capture multi-group cross section. + """A capture multi-group cross section. The neutron capture reaction rate is defined as the difference between OpenMC's 'absorption' and 'fission' reaction rate score types. This includes @@ -2446,9 +2543,9 @@ class CaptureXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2466,9 +2563,9 @@ class CaptureXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2568,9 +2665,9 @@ class FissionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2588,9 +2685,9 @@ class FissionXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2650,7 +2747,7 @@ class FissionXS(MGXS): class NuFissionXS(MGXS): - r"""A fission neutron production multi-group cross section. + """A fission neutron production multi-group cross section. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated @@ -2679,9 +2776,9 @@ class NuFissionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2699,9 +2796,9 @@ class NuFissionXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2761,7 +2858,7 @@ class NuFissionXS(MGXS): class KappaFissionXS(MGXS): - r"""A recoverable fission energy production rate multi-group cross section. + """A recoverable fission energy production rate multi-group cross section. The recoverable energy per fission, :math:`\kappa`, is defined as the fission product kinetic energy, prompt and delayed neutron kinetic energies, @@ -2795,9 +2892,9 @@ class KappaFissionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2815,9 +2912,9 @@ class KappaFissionXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2877,7 +2974,7 @@ class KappaFissionXS(MGXS): class ScatterXS(MGXS): - r"""A scattering multi-group cross section. + """A scattering multi-group cross section. The scattering cross section is defined as the difference between the total and absorption cross sections. @@ -2908,9 +3005,9 @@ class ScatterXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -2928,9 +3025,9 @@ class ScatterXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -2990,7 +3087,7 @@ class ScatterXS(MGXS): class NuScatterXS(MGXS): - r"""A scattering neutron production multi-group cross section. + """A scattering neutron production multi-group cross section. The neutron production from scattering is defined as the average number of neutrons produced from all neutron-producing reactions except for fission. @@ -3023,9 +3120,9 @@ class NuScatterXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -3043,9 +3140,9 @@ class NuScatterXS(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -3109,7 +3206,7 @@ class NuScatterXS(MGXS): class ScatterMatrixXS(MatrixMGXS): - r"""A scattering matrix multi-group cross section for one or more Legendre + """A scattering matrix multi-group cross section for one or more Legendre moments. This class can be used for both OpenMC input generation and tally data @@ -3153,9 +3250,9 @@ class ScatterMatrixXS(MatrixMGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -3177,9 +3274,9 @@ class ScatterMatrixXS(MatrixMGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -3443,7 +3540,7 @@ class ScatterMatrixXS(MatrixMGXS): subdomains='all', nuclides='all', moment='all', xs_type='macro', order_groups='increasing', row_column='inout', value='mean', **kwargs): - r"""Returns an array of multi-group cross sections. + """Returns an array of multi-group cross sections. This method constructs a 2D NumPy array for the requested scattering matrix data data for one or more energy groups and subdomains. @@ -3508,7 +3605,10 @@ class ScatterMatrixXS(MatrixMGXS): cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=2) for subdomain in subdomains: filters.append(self.domain_type) - filter_bins.append((subdomain,)) + if self.domain_type == 'mesh': + filter_bins.append(subdomain) + else: + filter_bins.append((subdomain,)) # Construct list of energy group bounds tuples for all requested groups if not isinstance(in_groups, basestring): @@ -3692,6 +3792,19 @@ class ScatterMatrixXS(MatrixMGXS): 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': + subdomains = [] + if (len(self.domain.dimension) == 3): + nx, ny, nz = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + for z in range(1,nz+1): + subdomains.append((x, y, z)) + else: + nx, ny = self.domain.dimension + for x in range(1,nx+1): + for y in range(1,ny+1): + subdomains.append((x, y, 1)) else: subdomains = [self.domain.id] @@ -4075,9 +4188,9 @@ class NuFissionMatrixXS(MatrixMGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -4095,9 +4208,9 @@ class NuFissionMatrixXS(MatrixMGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -4158,7 +4271,7 @@ class NuFissionMatrixXS(MatrixMGXS): class Chi(MGXS): - r"""The fission spectrum. + """The fission spectrum. This class can be used for both OpenMC input generation and tally data post-processing to compute spatially-homogenized and energy-integrated @@ -4190,9 +4303,9 @@ class Chi(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh The domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization groups : openmc.mgxs.EnergyGroups The energy group structure for energy condensation @@ -4210,9 +4323,9 @@ class Chi(MGXS): 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 + domain : Material or Cell or Universe or Mesh Domain for spatial homogenization - domain_type : {'material', 'cell', 'distribcell', 'universe'} + domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization energy_groups : openmc.mgxs.EnergyGroups Energy group structure for energy condensation @@ -4477,7 +4590,10 @@ class Chi(MGXS): cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=2) for subdomain in subdomains: filters.append(self.domain_type) - filter_bins.append((subdomain,)) + if self.domain_type == 'mesh': + filter_bins.append(subdomain) + else: + filter_bins.append((subdomain,)) # Construct list of energy group bounds tuples for all requested groups if not isinstance(groups, basestring): @@ -4614,3 +4730,396 @@ class Chi(MGXS): df['std. dev.'] *= np.tile(densities, tile_factor) return df + + +class ChiDelayed(Chi): + """The delayed fission spectrum. + + 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:`ChiDelayed.energy_groups` and + :attr:`ChiDelayed.domain` properties. Tallies for the flux and appropriate reaction + rates over the specified domain are generated automatically via the + :attr:`ChiDelayed.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:`Chi.xs_tally` property. + + For a spatial domain :math:`V` and energy group :math:`[E_g,E_{g-1}]`, the + fission spectrum is calculated as: + + .. math:: + + \langle \nu\sigma_{f,\rightarrow g} \phi \rangle &= \int_{r \in V} dr + \int_{4\pi} d\Omega' \int_0^\infty dE' \int_{E_g}^{E_{g-1}} dE \; \chi(E) + \nu\sigma_f (r, E') \psi(r, E', \Omega')\\ + \langle \nu\sigma_f \phi \rangle &= \int_{r \in V} dr \int_{4\pi} + d\Omega' \int_0^\infty dE' \int_0^\infty dE \; \chi(E) \nu\sigma_f (r, + E') \psi(r, E', \Omega') \\ + \chi_g &= \frac{\langle \nu\sigma_{f,\rightarrow g} \phi \rangle}{\langle + \nu\sigma_f \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. + + 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 + 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', '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:`Chi.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. When the 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., 'U-238', 'O-16'). 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=''): + super(ChiDelayed, self).__init__(domain, domain_type, groups, by_nuclide, name) + self._rxn_type = 'chi-delayed' + + @property + def scores(self): + return ['delayed-nu-fission', 'delayed-nu-fission'] + + @property + def tally_keys(self): + return ['delayed-nu-fission-in', 'delayed-nu-fission-out'] + + @property + def rxn_rate_tally(self): + if self._rxn_rate_tally is None: + self._rxn_rate_tally = self.tallies['delayed-nu-fission-out'] + self._rxn_rate_tally.sparse = self.sparse + return self._rxn_rate_tally + + @property + def xs_tally(self): + + if self._xs_tally is None: + nu_fission_in = self.tallies['delayed-nu-fission-in'] + + # Remove coarse energy filter to keep it out of tally arithmetic + energy_filter = nu_fission_in.find_filter('energy') + nu_fission_in.remove_filter(energy_filter) + + # Compute chi + self._xs_tally = self.rxn_rate_tally / nu_fission_in + super(ChiDelayed, self)._compute_xs() + + # Add the coarse energy filter back to the nu-fission tally + nu_fission_in.filters.append(energy_filter) + + return self._xs_tally + + def get_slice(self, nuclides=[], groups=[]): + """Build a sliced Chi 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., ['U-235', 'U-238']; default is []) + groups : list of Integral + A list of energy group indices starting at 1 for the high energies + (e.g., [1, 2, 3]; default is []) + + Returns + ------- + openmc.mgxs.MGXS + A new MGXS which encapsulates the subset of data requested + for the nuclide(s) and/or energy group(s) requested in the + parameters. + + """ + + # Temporarily remove energy filter from nu-fission-in since its + # group structure will work in super MGXS.get_slice(...) method + nu_fission_in = self.tallies['delayed-nu-fission-in'] + energy_filter = nu_fission_in.find_filter('energy') + nu_fission_in.remove_filter(energy_filter) + + # Call super class method and null out derived tallies + slice_xs = super(Chi, self).get_slice(nuclides, groups) + slice_xs._rxn_rate_tally = None + slice_xs._xs_tally = None + + # Slice energy groups if needed + if len(groups) != 0: + filter_bins = [] + for group in groups: + group_bounds = self.energy_groups.get_group_bounds(group) + filter_bins.append(group_bounds) + filter_bins = [tuple(filter_bins)] + + # Slice nu-fission-out tally along energyout filter + nu_fission_out = slice_xs.tallies['delayed-nu-fission-out'] + tally_slice = nu_fission_out.get_slice(filters=['energyout'], + filter_bins=filter_bins) + slice_xs._tallies['delayed-nu-fission-out'] = tally_slice + + # Add energy filter back to nu-fission-in tallies + self.tallies['delayed-nu-fission-in'].add_filter(energy_filter) + slice_xs._tallies['delayed-nu-fission-in'].add_filter(energy_filter) + + slice_xs.sparse = self.sparse + return slice_xs + + def merge(self, other): + """Merge another Chi with this one + + If results have been loaded from a statepoint, then Chi are only + mergeable along one and only one of energy groups or nuclides. + + Parameters + ---------- + other : openmc.mgxs.MGXS + MGXS to merge with this one + + Returns + ------- + merged_mgxs : openmc.mgxs.MGXS + Merged MGXS + """ + + if not self.can_merge(other): + raise ValueError('Unable to merge ChiDelayed') + + # Create deep copy of tally to return as merged tally + merged_mgxs = copy.deepcopy(self) + merged_mgxs._derived = True + merged_mgxs._rxn_rate_tally = None + merged_mgxs._xs_tally = None + + # Merge energy groups + if self.energy_groups != other.energy_groups: + merged_groups = self.energy_groups.merge(other.energy_groups) + merged_mgxs.energy_groups = merged_groups + + # Merge nuclides + if self.nuclides != other.nuclides: + + # The nuclides must be mutually exclusive + for nuclide in self.nuclides: + if nuclide in other.nuclides: + msg = 'Unable to merge Chi Delayed with shared nuclides' + raise ValueError(msg) + + # Concatenate lists of nuclides for the merged MGXS + merged_mgxs.nuclides = self.nuclides + other.nuclides + + # Merge tallies + for tally_key in self.tallies: + merged_tally = self.tallies[tally_key].merge(other.tallies[tally_key]) + merged_mgxs.tallies[tally_key] = merged_tally + + return merged_mgxs + + def get_xs(self, groups='all', subdomains='all', nuclides='all', + xs_type='macro', order_groups='increasing', + value='mean', **kwargs): + """Returns an array of the fission spectrum. + + This method constructs a 2D NumPy array for the requested multi-group + cross section data data for one or more energy groups and subdomains. + + Parameters + ---------- + groups : Iterable of Integral or 'all' + 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., ['U-235', 'U-238']). 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'. + xs_type: {'macro', 'micro'} + This parameter is not relevant for chi but is included here to + mirror the parent MGXS.get_xs(...) class method + order_groups: {'increasing', 'decreasing'} + Return the cross section indexed according to increasing or + decreasing energy groups (decreasing or increasing energies). + Defaults to 'increasing'. + value : {'mean', 'std_dev', 'rel_err'} + A string for the type of value to return. Defaults to 'mean'. + + Returns + ------- + numpy.ndarray + A NumPy array of the multi-group cross section indexed in the order + each group, subdomain and nuclide 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']) + + filters = [] + filter_bins = [] + + # Construct a collection of the domain filter bins + if not isinstance(subdomains, basestring): + cv.check_iterable_type('subdomains', subdomains, Integral, max_depth=2) + for subdomain in subdomains: + filters.append(self.domain_type) + if self.domain_type == 'mesh': + filter_bins.append(subdomain) + else: + filter_bins.append((subdomain,)) + + # Construct list of energy group bounds tuples for all requested groups + if not isinstance(groups, basestring): + cv.check_iterable_type('groups', groups, Integral) + for group in groups: + filters.append('energyout') + filter_bins.append((self.energy_groups.get_group_bounds(group),)) + + # If chi was computed for each nuclide in the domain + if self.by_nuclide: + + # Get the sum as the fission source weighted average chi for all + # nuclides in the domain + if nuclides == 'sum' or nuclides == ['sum']: + + # Retrieve the fission production tallies + nu_fission_in = self.tallies['delayed-nu-fission-in'] + nu_fission_out = self.tallies['delayed-nu-fission-out'] + + # Sum out all nuclides + nuclides = self.get_all_nuclides() + nu_fission_in = nu_fission_in.summation(nuclides=nuclides) + nu_fission_out = nu_fission_out.summation(nuclides=nuclides) + + # Remove coarse energy filter to keep it out of tally arithmetic + energy_filter = nu_fission_in.find_filter('energy') + nu_fission_in.remove_filter(energy_filter) + + # Compute chi and store it as the xs_tally attribute so we can + # use the generic get_xs(...) method + xs_tally = nu_fission_out / nu_fission_in + + # Add the coarse energy filter back to the nu-fission tally + nu_fission_in.filters.append(energy_filter) + + xs = xs_tally.get_values(filters=filters, + filter_bins=filter_bins, value=value) + + # Get chi for all nuclides in the domain + elif nuclides == 'all': + nuclides = self.get_all_nuclides() + xs = self.xs_tally.get_values(filters=filters, + filter_bins=filter_bins, + nuclides=nuclides, value=value) + + # Get chi for user-specified nuclides in the domain + else: + cv.check_iterable_type('nuclides', nuclides, basestring) + xs = self.xs_tally.get_values(filters=filters, + filter_bins=filter_bins, + nuclides=nuclides, value=value) + + # If chi was computed as an average of nuclides in the domain + else: + xs = self.xs_tally.get_values(filters=filters, + filter_bins=filter_bins, value=value) + + # Reverse data if user requested increasing energy groups since + # tally data is stored in order of increasing energies + if order_groups == 'increasing': + + # Reshape tally data array with separate axes for domain and energy + if groups == 'all': + num_groups = self.num_groups + else: + num_groups = len(groups) + num_subdomains = int(xs.shape[0] / num_groups) + new_shape = (num_subdomains, num_groups) + xs.shape[1:] + xs = np.reshape(xs, new_shape) + + # Reverse energies to align with increasing energy groups + xs = xs[:, ::-1, :] + + # Eliminate trivial dimensions + xs = np.squeeze(xs) + xs = np.atleast_1d(xs) + + xs = np.nan_to_num(xs) + return xs