diff --git a/examples/jupyter/mgxs-part-i.ipynb b/examples/jupyter/mgxs-part-i.ipynb
index 6fa0c02b1..660c916ba 100644
--- a/examples/jupyter/mgxs-part-i.ipynb
+++ b/examples/jupyter/mgxs-part-i.ipynb
@@ -28,9 +28,7 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -134,9 +132,7 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
@@ -157,9 +153,7 @@
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate some Nuclides\n",
@@ -180,9 +174,7 @@
{
"cell_type": "code",
"execution_count": 4,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate a Material and register the Nuclides\n",
@@ -205,9 +197,7 @@
{
"cell_type": "code",
"execution_count": 5,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate a Materials collection and export to XML\n",
@@ -225,9 +215,7 @@
{
"cell_type": "code",
"execution_count": 6,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate boundary Planes\n",
@@ -247,9 +235,7 @@
{
"cell_type": "code",
"execution_count": 7,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate a Cell\n",
@@ -272,9 +258,7 @@
{
"cell_type": "code",
"execution_count": 8,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate Universe\n",
@@ -292,9 +276,7 @@
{
"cell_type": "code",
"execution_count": 9,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Create Geometry and set root Universe\n",
@@ -315,9 +297,7 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# OpenMC simulation parameters\n",
@@ -351,9 +331,7 @@
{
"cell_type": "code",
"execution_count": 11,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate a 2-group EnergyGroups object\n",
@@ -390,9 +368,7 @@
{
"cell_type": "code",
"execution_count": 12,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Instantiate a few different sections\n",
@@ -415,21 +391,19 @@
{
"cell_type": "code",
"execution_count": 13,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"OrderedDict([('flux', Tally\n",
- " \tID =\t10000\n",
+ " \tID =\t1\n",
" \tName =\t\n",
" \tFilters =\tCellFilter, EnergyFilter\n",
" \tNuclides =\ttotal \n",
" \tScores =\t['flux']\n",
" \tEstimator =\ttracklength), ('absorption', Tally\n",
- " \tID =\t10001\n",
+ " \tID =\t2\n",
" \tName =\t\n",
" \tFilters =\tCellFilter, EnergyFilter\n",
" \tNuclides =\ttotal \n",
@@ -456,10 +430,19 @@
{
"cell_type": "code",
"execution_count": 14,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/home/icmeyer/miniconda3/lib/python3.6/site-packages/openmc-0.9.0-py3.6-linux-x86_64.egg/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=3.\n",
+ " warn(msg, IDWarning)\n",
+ "/home/icmeyer/miniconda3/lib/python3.6/site-packages/openmc-0.9.0-py3.6-linux-x86_64.egg/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=4.\n",
+ " warn(msg, IDWarning)\n"
+ ]
+ }
+ ],
"source": [
"# Instantiate an empty Tallies object\n",
"tallies_file = openmc.Tallies()\n",
@@ -486,172 +469,9 @@
},
{
"cell_type": "code",
- "execution_count": 15,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\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",
- " | The OpenMC Monte Carlo Code\n",
- " Copyright | 2011-2017 Massachusetts Institute of Technology\n",
- " License | http://openmc.readthedocs.io/en/latest/license.html\n",
- " Version | 0.8.0\n",
- " Git SHA1 | 43b141e9ba542da8b28c078cf2df8a6777cfb2ad\n",
- " Date/Time | 2017-02-28 11:52:00\n",
- " OpenMP Threads | 4\n",
- "\n",
- " ===========================================================================\n",
- " ========================> INITIALIZATION <=========================\n",
- " ===========================================================================\n",
- "\n",
- " Reading settings XML file...\n",
- " Reading geometry XML file...\n",
- " Reading materials XML file...\n",
- " Reading cross sections XML file...\n",
- " Reading H1 from\n",
- " /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/H1.h5\n",
- " Reading O16 from\n",
- " /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/O16.h5\n",
- " Reading U235 from\n",
- " /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/U235.h5\n",
- " Reading U238 from\n",
- " /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/U238.h5\n",
- " Reading Zr90 from\n",
- " /home/wbinventor/Documents/NSE-CRPG-Codes/openmc/data/nndc_hdf5/Zr90.h5\n",
- " Maximum neutron transport energy: 2.00000E+07 eV for H1\n",
- " Reading tallies XML file...\n",
- " Building neighboring cells lists for each surface...\n",
- " Initializing source particles...\n",
- "\n",
- " ===========================================================================\n",
- " ====================> K EIGENVALUE SIMULATION <====================\n",
- " ===========================================================================\n",
- "\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.17478 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",
- "\n",
- " ===========================================================================\n",
- " ======================> SIMULATION FINISHED <======================\n",
- " ===========================================================================\n",
- "\n",
- "\n",
- " =======================> TIMING STATISTICS <=======================\n",
- "\n",
- " Total time for initialization = 3.0114E-01 seconds\n",
- " Reading cross sections = 1.8743E-01 seconds\n",
- " Total time in simulation = 9.7641E+00 seconds\n",
- " Time in transport only = 9.5168E+00 seconds\n",
- " Time in inactive batches = 1.2602E+00 seconds\n",
- " Time in active batches = 8.5039E+00 seconds\n",
- " Time synchronizing fission bank = 5.4293E-03 seconds\n",
- " Sampling source sites = 4.3508E-03 seconds\n",
- " SEND/RECV source sites = 9.9399E-04 seconds\n",
- " Time accumulating tallies = 1.2758E-04 seconds\n",
- " Total time for finalization = 3.6982E-04 seconds\n",
- " Total time elapsed = 1.0075E+01 seconds\n",
- " Calculation Rate (inactive) = 19838.7 neutrons/second\n",
- " Calculation Rate (active) = 11759.3 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",
- " Leakage Fraction = 0.00000 +/- 0.00000\n",
- "\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "0"
- ]
- },
- "execution_count": 15,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"# Run OpenMC\n",
"openmc.run()"
@@ -673,10 +493,8 @@
},
{
"cell_type": "code",
- "execution_count": 16,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
"source": [
"# Load the last statepoint file\n",
@@ -699,10 +517,8 @@
},
{
"cell_type": "code",
- "execution_count": 17,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
"source": [
"# Load the tallies from the statepoint into each MGXS object\n",
@@ -734,28 +550,9 @@
},
{
"cell_type": "code",
- "execution_count": 18,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Multi-Group XS\n",
- "\tReaction Type =\ttotal\n",
- "\tDomain Type =\tcell\n",
- "\tDomain ID =\t1\n",
- "\tCross Sections [cm^-1]:\n",
- " Group 1 [0.625 - 20000000.0eV]:\t6.81e-01 +/- 2.69e-01%\n",
- " Group 2 [0.0 - 0.625 eV]:\t1.40e+00 +/- 5.93e-01%\n",
- "\n",
- "\n",
- "\n"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"total.print_xs()"
]
@@ -769,58 +566,9 @@
},
{
"cell_type": "code",
- "execution_count": 19,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " cell | \n",
- " group in | \n",
- " nuclide | \n",
- " mean | \n",
- " std. dev. | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " | 1 | \n",
- " 1 | \n",
- " 1 | \n",
- " total | \n",
- " 0.667787 | \n",
- " 0.001802 | \n",
- "
\n",
- " \n",
- " | 0 | \n",
- " 1 | \n",
- " 2 | \n",
- " total | \n",
- " 1.292013 | \n",
- " 0.007642 | \n",
- "
\n",
- " \n",
- "
\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"
- ]
- },
- "execution_count": 19,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"df = scattering.get_pandas_dataframe()\n",
"df.head(10)"
@@ -835,10 +583,8 @@
},
{
"cell_type": "code",
- "execution_count": 20,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
"source": [
"absorption.export_xs_data(filename='absorption-xs', format='excel')"
@@ -853,10 +599,8 @@
},
{
"cell_type": "code",
- "execution_count": 21,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": null,
+ "metadata": {},
"outputs": [],
"source": [
"total.build_hdf5_store(filename='mgxs', append=True)\n",
@@ -880,68 +624,9 @@
},
{
"cell_type": "code",
- "execution_count": 22,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " cell | \n",
- " energy low [eV] | \n",
- " energy high [eV] | \n",
- " nuclide | \n",
- " score | \n",
- " mean | \n",
- " std. dev. | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " | 0 | \n",
- " 1 | \n",
- " 0.000 | \n",
- " 6.250000e-01 | \n",
- " total | \n",
- " (((total / flux) - (absorption / flux)) - (sca... | \n",
- " -1.110223e-15 | \n",
- " 0.011292 | \n",
- "
\n",
- " \n",
- " | 1 | \n",
- " 1 | \n",
- " 0.625 | \n",
- " 2.000000e+07 | \n",
- " total | \n",
- " (((total / flux) - (absorption / flux)) - (sca... | \n",
- " 1.776357e-15 | \n",
- " 0.002570 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " cell energy low [eV] energy high [eV] nuclide \\\n",
- "0 1 0.00e+00 6.25e-01 total \n",
- "1 1 6.25e-01 2.00e+07 total \n",
- "\n",
- " score mean std. dev. \n",
- "0 (((total / flux) - (absorption / flux)) - (sca... -1.11e-15 1.13e-02 \n",
- "1 (((total / flux) - (absorption / flux)) - (sca... 1.78e-15 2.57e-03 "
- ]
- },
- "execution_count": 22,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"# Use tally arithmetic to compute the difference between the total, absorption and scattering\n",
"difference = total.xs_tally - absorption.xs_tally - scattering.xs_tally\n",
@@ -959,68 +644,9 @@
},
{
"cell_type": "code",
- "execution_count": 23,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " cell | \n",
- " energy low [eV] | \n",
- " energy high [eV] | \n",
- " nuclide | \n",
- " score | \n",
- " mean | \n",
- " std. dev. | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " | 0 | \n",
- " 1 | \n",
- " 0.000 | \n",
- " 6.250000e-01 | \n",
- " total | \n",
- " ((absorption / flux) / (total / flux)) | \n",
- " 0.076115 | \n",
- " 0.000649 | \n",
- "
\n",
- " \n",
- " | 1 | \n",
- " 1 | \n",
- " 0.625 | \n",
- " 2.000000e+07 | \n",
- " total | \n",
- " ((absorption / flux) / (total / flux)) | \n",
- " 0.019263 | \n",
- " 0.000095 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " cell energy low [eV] energy high [eV] nuclide \\\n",
- "0 1 0.00e+00 6.25e-01 total \n",
- "1 1 6.25e-01 2.00e+07 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 "
- ]
- },
- "execution_count": 23,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"# Use tally arithmetic to compute the absorption-to-total MGXS ratio\n",
"absorption_to_total = absorption.xs_tally / total.xs_tally\n",
@@ -1031,68 +657,9 @@
},
{
"cell_type": "code",
- "execution_count": 24,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " cell | \n",
- " energy low [eV] | \n",
- " energy high [eV] | \n",
- " nuclide | \n",
- " score | \n",
- " mean | \n",
- " std. dev. | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " | 0 | \n",
- " 1 | \n",
- " 0.000 | \n",
- " 6.250000e-01 | \n",
- " total | \n",
- " ((scatter / flux) / (total / flux)) | \n",
- " 0.923885 | \n",
- " 0.007736 | \n",
- "
\n",
- " \n",
- " | 1 | \n",
- " 1 | \n",
- " 0.625 | \n",
- " 2.000000e+07 | \n",
- " total | \n",
- " ((scatter / flux) / (total / flux)) | \n",
- " 0.980737 | \n",
- " 0.003737 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " cell energy low [eV] energy high [eV] nuclide \\\n",
- "0 1 0.00e+00 6.25e-01 total \n",
- "1 1 6.25e-01 2.00e+07 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 "
- ]
- },
- "execution_count": 24,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"# Use tally arithmetic to compute the scattering-to-total MGXS ratio\n",
"scattering_to_total = scattering.xs_tally / total.xs_tally\n",
@@ -1110,68 +677,9 @@
},
{
"cell_type": "code",
- "execution_count": 25,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " cell | \n",
- " energy low [eV] | \n",
- " energy high [eV] | \n",
- " nuclide | \n",
- " score | \n",
- " mean | \n",
- " std. dev. | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " | 0 | \n",
- " 1 | \n",
- " 0.000 | \n",
- " 6.250000e-01 | \n",
- " total | \n",
- " (((absorption / flux) / (total / flux)) + ((sc... | \n",
- " 1.0 | \n",
- " 0.007763 | \n",
- "
\n",
- " \n",
- " | 1 | \n",
- " 1 | \n",
- " 0.625 | \n",
- " 2.000000e+07 | \n",
- " total | \n",
- " (((absorption / flux) / (total / flux)) + ((sc... | \n",
- " 1.0 | \n",
- " 0.003739 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " cell energy low [eV] energy high [eV] nuclide \\\n",
- "0 1 0.00e+00 6.25e-01 total \n",
- "1 1 6.25e-01 2.00e+07 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 "
- ]
- },
- "execution_count": 25,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"# Use tally arithmetic to ensure that the absorption- and scattering-to-total MGXS ratios sum to unity\n",
"sum_ratio = absorption_to_total + scattering_to_total\n",
@@ -1197,9 +705,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.5.2"
+ "version": "3.6.3"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
}
diff --git a/openmc/data/endf.py b/openmc/data/endf.py
index 0fa75ded8..e2876a951 100644
--- a/openmc/data/endf.py
+++ b/openmc/data/endf.py
@@ -288,7 +288,7 @@ class Evaluation(object):
Attributes
----------
info : dict
- Miscallaneous information about the evaluation.
+ Miscellaneous information about the evaluation.
target : dict
Information about the target material, such as its mass, isomeric state,
whether it's stable, and whether it's fissionable.
diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py
index ed2f4f8b7..670307707 100644
--- a/openmc/data/neutron.py
+++ b/openmc/data/neutron.py
@@ -25,6 +25,7 @@ from .njoy import make_ace
from .product import Product
from .reaction import Reaction, _get_photon_products_ace
from . import resonance as res
+from . import resonance_covariance as res_cov
from .urr import ProbabilityTables
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
@@ -151,6 +152,8 @@ class IncidentNeutron(EqualityMixin):
and the values are Reaction objects.
resonances : openmc.data.Resonances or None
Resonance parameters
+ resonance_covariance : openmc.data.ResonanceCovariance or None
+ Covariance for resonance parameters
summed_reactions : collections.OrderedDict
Contains summed cross sections, e.g., the total cross section. The keys
are the MT values and the values are Reaction objects.
@@ -231,6 +234,10 @@ class IncidentNeutron(EqualityMixin):
def resonances(self):
return self._resonances
+ @property
+ def resonance_covariance(self):
+ return self._resoncance_covariance
+
@property
def summed_reactions(self):
return self._summed_reactions
@@ -292,6 +299,11 @@ class IncidentNeutron(EqualityMixin):
cv.check_type('resonances', resonances, res.Resonances)
self._resonances = resonances
+ @resonance_covariance.setter
+ def resonance_covariance(self, resonance_covariance):
+ cv.check_type('resonances', resonances, res.ResonanceCovariance)
+ self._resonacne_covariance = resonance_covariance
+
@summed_reactions.setter
def summed_reactions(self, summed_reactions):
cv.check_type('summed reactions', summed_reactions, Mapping)
@@ -748,7 +760,7 @@ class IncidentNeutron(EqualityMixin):
return data
@classmethod
- def from_endf(cls, ev_or_filename):
+ def from_endf(cls, ev_or_filename, get_covariance=False):
"""Generate incident neutron continuous-energy data from an ENDF evaluation
Parameters
@@ -757,6 +769,10 @@ class IncidentNeutron(EqualityMixin):
ENDF evaluation to read from. If given as a string, it is assumed to
be the filename for the ENDF file.
+ get_covariance : bool
+ Flag to indicate whether or not covariance data from File 32 should be
+ retrieved
+
Returns
-------
openmc.data.IncidentNeutron
@@ -788,6 +804,9 @@ class IncidentNeutron(EqualityMixin):
if (2, 151) in ev.section:
data.resonances = res.Resonances.from_endf(ev)
+ if (32, 151) in ev.section and get_covariance:
+ data.res_covariance = res_cov.ResonanceCovariance.from_endf(ev)
+
# Read each reaction
for mf, mt, nc, mod in ev.reaction_list:
if mf == 3:
diff --git a/openmc/data/resonance_covariance.py b/openmc/data/resonance_covariance.py
new file mode 100644
index 000000000..dc1a7f8cb
--- /dev/null
+++ b/openmc/data/resonance_covariance.py
@@ -0,0 +1,232 @@
+from collections import defaultdict, MutableSequence, Iterable
+import io
+
+import numpy as np
+from numpy.polynomial import Polynomial
+import pandas as pd
+
+from .data import NEUTRON_MASS
+from .endf import get_head_record, get_cont_record, get_tab1_record, get_list_record
+import openmc.checkvalue as cv
+from .resonance import ResonanceRange
+
+class ResonanceCovariance(object):
+ """Resolved resonance covariance data
+
+ Parameters
+ ----------
+ ranges : list of openmc.data.ResonanceRange
+ Distinct energy ranges for resonance data
+
+ Attributes
+ ----------
+ ranges : list of openmc.data.ResonanceRange
+ Distinct energy ranges for resonance data
+ resolved : openmc.data.ResonanceRange or None
+ Resolved resonance range
+ unresolved : openmc.data.Unresolved or None
+ Unresolved resonance range
+
+ """
+
+ def __init__(self, ranges):
+ self.ranges = ranges
+
+ def __iter__(self):
+ for r in self.ranges:
+ yield r
+
+ @property
+ def ranges(self):
+ return self._ranges
+
+ @ranges.setter
+ def ranges(self, ranges):
+ cv.check_type('resonance ranges', ranges, MutableSequence)
+ self._ranges = cv.CheckedList(ResonanceRange, 'resonance ranges',
+ ranges)
+
+ @classmethod
+ def from_endf(cls, ev):
+ """Generate resonance covariance data from an ENDF evaluation.
+
+ Parameters
+ ----------
+ ev : openmc.data.endf.Evaluation
+ ENDF evaluation
+
+ Returns
+ -------
+ openmc.data.ResonanceCovariance
+ Resonance covariance data
+
+ """
+ file_obj = io.StringIO(ev.section[32, 151])
+
+ # Determine whether discrete or continuous representation
+ items = get_head_record(file_obj)
+ n_isotope = items[4] # Number of isotopes
+
+ ranges = []
+ for iso in range(n_isotope):
+ items = get_cont_record(file_obj)
+ abundance = items[1]
+ fission_widths = (items[3] == 1) # fission widths are given?
+ n_ranges = items[4] # number of resonance energy ranges
+
+ for j in range(n_ranges):
+ items = get_cont_record(file_obj)
+ resonance_flag = items[2] # flag for resolved (1)/unresolved (2)
+ formalism = items[3] # resonance formalism
+
+ # Throw error for unsupported formalisms
+ if formalism in [0,1,2,7]:
+ raise TypeError('LRF= ', formalism,
+ ' covariance not supported for this formalism')
+
+ if resonance_flag in (0, 1):
+ # resolved resonance region
+ erange = _FORMALISMS[formalism].from_endf(ev, file_obj, items)
+
+ elif resonance_flag == 2:
+ raise TypeError('Unresolved resonance not supported')
+
+ #erange.material = self
+ ranges.append(erange)
+
+ return cls(ranges)
+
+
+class ReichMooreCovariance(ResonanceRange):
+ """Reich-Moore resolved resonance formalism covariance data.
+
+ Reich-Moore resolved resonance data is identified by LRF=3 in the ENDF-6
+ format.
+
+
+ Parameters
+ ----------
+ target_spin : float
+ Intrinsic spin, :math:`I`, of the target nuclide
+ energy_min : float
+ Minimum energy of the resolved resonance range in eV
+ energy_max : float
+ Maximum energy of the resolved resonance range in eV
+ channel : dict
+ Dictionary whose keys are l-values and values are channel radii as a
+ function of energy
+ scattering : dict
+ Dictionary whose keys are l-values and values are scattering radii as a
+ function of energy
+
+ Attributes
+ ----------
+ cov_paramaters: list
+ The parameters that are included in the covariance matrix
+ covariance_matrix : array
+ The covariance matrix contained within the ENDF evaluation
+
+
+ """
+
+ def __init__(self, energy_min, energy_max):
+ self.parameters = None
+ self.covariance = None
+
+ @classmethod
+ def from_endf(cls, ev, file_obj, items):
+ """Create Reich-Moore resonance covariance data from an ENDF evaluation.
+ Includes the resonance parameters contained separately in File 32.
+
+ Parameters
+ ----------
+ ev : openmc.data.endf.Evaluation
+ ENDF evaluation
+ file_obj : file-like object
+ ENDF file positioned at the second record of a resonance range
+ subsection in MF=2, MT=151
+ items : list
+ Items from the CONT record at the start of the resonance range
+ subsection
+
+ Returns
+ -------
+ openmc.data.ReichMooreCovariance
+ Reich-Moore resonance covariance parameters
+
+ """
+ # Read energy-dependent scattering radius if present
+ energy_min, energy_max = items[0:2]
+ nro, naps = items[4:6]
+ if nro != 0:
+ params, ape = get_tab1_record(file_obj)
+
+ # Other scatter radius parameters
+ items = get_cont_record(file_obj)
+ target_spin = items[0]
+ ap = Polynomial((items[1],))
+ LCOMP = items[3] # Flag for compatibility 0,1,2 - 2 is compact form
+ NLS = items[4] # Number of l-values
+
+
+ # Build covariance matrix for General Resolved Resonance Formats
+ if LCOMP == 1:
+ items = get_cont_record(file_obj)
+ awri = items[0]
+ num_short_range = items[4] #Number of short range type resonance
+ #covariances
+ num_long_range = items[5] #Number of long range type resonance
+ #covariances
+ # Read resonance widths, J values, etc
+ channel_radius = {}
+ scattering_radius = {}
+ records = []
+ for i in range(num_short_range):
+ items, values = get_list_record(file_obj)
+ num_parameters = items[2]
+ num_res = items[5]
+ num_par_vals = num_res*6
+ res_values = values[:num_par_vals]
+ cov_values = values[num_par_vals:]
+
+ energy = res_values[0::6]
+ spin = res_values[1::6]
+ gn = res_values[2::6]
+ gg = res_values[3::6]
+ gfa = res_values[4::6]
+ gfb = res_values[5::6]
+
+ for i, E in enumerate(energy):
+ records.append([energy[i], spin[i], gn[i], gg[i],
+ gfa[i], gfb[i]])
+
+ #Build the upper-triangular covariance matrix
+ cov_dim = num_parameters*num_res
+ cov = np.zeros([cov_dim,cov_dim])
+ indices = np.triu_indices(cov_dim)
+ cov[indices] = cov_values
+
+ # Create pandas DataFrame with resonance data
+ columns = ['energy', 'J', 'neutronWidth', 'captureWidth',
+ 'fissionWidthA', 'fissionWidthB']
+ parameters = pd.DataFrame.from_records(records, columns=columns)
+
+ # Create instance of ReichMooreCovariance
+ rmc = cls(energy_min, energy_max)
+ rmc.parameters = parameters
+ rmc.covariance = cov
+
+ return rmc
+
+ elif LCOMP in [0,2]:
+ TypeError('LCOMP = ',LCOMP,' not supported')
+
+
+# _FORMALISMS = {0: ResonanceRange,
+# 1: SingleLevelBreitWigner,
+# 2: MultiLevelBreitWigner,
+# 3: ReichMoore,
+# 7: RMatrixLimited}
+_FORMALISMS = {3: ReichMooreCovariance}
+
+