Fixed merge conflicts with develop

This commit is contained in:
Will Boyd 2016-05-09 12:53:12 -04:00
commit ae58827601
28 changed files with 900 additions and 851 deletions

View file

@ -417,24 +417,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\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), ('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)])"
]
},
"execution_count": 13,
@ -508,12 +506,11 @@
" 888\n",
" 888\n",
"\n",
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
" License: http://mit-crpg.github.io/openmc/license.html\n",
" Copyright: 2011-2016 Massachusetts Institute of Technology\n",
" License: http://openmc.readthedocs.org/en/latest/license.html\n",
" Version: 0.7.1\n",
" Git SHA1: eeb5091ca3a34cc85df73a3318cae2b6c7097413\n",
" Date/Time: 2016-04-13 11:24:09\n",
" MPI Processes: 1\n",
" Git SHA1: df280b60eb1c6d7b7f842e05ede734a4883a0fc8\n",
" Date/Time: 2016-05-05 13:43:54\n",
"\n",
" ===========================================================================\n",
" ========================> INITIALIZATION <=========================\n",
@ -598,20 +595,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 4.6300E-01 seconds\n",
" Reading cross sections = 1.2100E-01 seconds\n",
" Total time in simulation = 1.6504E+01 seconds\n",
" Time in transport only = 1.6479E+01 seconds\n",
" Time in inactive batches = 1.9620E+00 seconds\n",
" Time in active batches = 1.4542E+01 seconds\n",
" Time synchronizing fission bank = 1.0000E-02 seconds\n",
" Sampling source sites = 4.0000E-03 seconds\n",
" SEND/RECV source sites = 3.0000E-03 seconds\n",
" Total time for initialization = 5.7300E-01 seconds\n",
" Reading cross sections = 1.7600E-01 seconds\n",
" Total time in simulation = 2.1188E+01 seconds\n",
" Time in transport only = 2.1173E+01 seconds\n",
" Time in inactive batches = 2.6880E+00 seconds\n",
" Time in active batches = 1.8500E+01 seconds\n",
" Time synchronizing fission bank = 3.0000E-03 seconds\n",
" Sampling source sites = 2.0000E-03 seconds\n",
" SEND/RECV source sites = 1.0000E-03 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 0.0000E+00 seconds\n",
" Total time elapsed = 1.6977E+01 seconds\n",
" Calculation Rate (inactive) = 12742.1 neutrons/second\n",
" Calculation Rate (active) = 6876.63 neutrons/second\n",
" Total time elapsed = 2.1776E+01 seconds\n",
" Calculation Rate (inactive) = 9300.60 neutrons/second\n",
" Calculation Rate (active) = 5405.41 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
@ -669,20 +666,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In addition to the statepoint file, our simulation also created a summary file which encapsulates information about the materials and geometry. This is necessary for the `openmc.mgxs` module to properly process the tally data. We first create a `Summary` object and link it with the statepoint."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Load the summary file and link it with the statepoint\n",
"su = openmc.Summary('summary.h5')\n",
"sp.link_with_summary(su)"
"In addition to the statepoint file, our simulation also created a summary file which encapsulates information about the materials and geometry. By default, a `Summary` object is automatically linked when a `StatePoint` is loaded. This is necessary for the `openmc.mgxs` module to properly process the tally data."
]
},
{
@ -694,7 +678,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 17,
"metadata": {
"collapsed": false
},
@ -729,7 +713,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 18,
"metadata": {
"collapsed": false
},
@ -764,7 +748,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 19,
"metadata": {
"collapsed": false
},
@ -811,7 +795,7 @@
"0 1 2 total 1.292013 0.007642"
]
},
"execution_count": 20,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
@ -830,7 +814,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 20,
"metadata": {
"collapsed": true
},
@ -848,7 +832,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 21,
"metadata": {
"collapsed": false
},
@ -875,7 +859,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 22,
"metadata": {
"collapsed": false
},
@ -932,7 +916,7 @@
"1 (((total / flux) - (absorption / flux)) - (sca... 1.44e-15 2.57e-03 "
]
},
"execution_count": 23,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
@ -954,7 +938,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 23,
"metadata": {
"collapsed": false
},
@ -1011,7 +995,7 @@
"1 ((absorption / flux) / (total / flux)) 1.93e-02 9.46e-05 "
]
},
"execution_count": 24,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
@ -1026,7 +1010,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 24,
"metadata": {
"collapsed": false
},
@ -1083,7 +1067,7 @@
"1 ((scatter / flux) / (total / flux)) 9.81e-01 3.74e-03 "
]
},
"execution_count": 25,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
@ -1105,7 +1089,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 25,
"metadata": {
"collapsed": false
},
@ -1135,7 +1119,7 @@
" <td>6.250000e-07</td>\n",
" <td>total</td>\n",
" <td>(((absorption / flux) / (total / flux)) + ((sc...</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>0.007763</td>\n",
" </tr>\n",
" <tr>\n",
@ -1145,7 +1129,7 @@
" <td>2.000000e+01</td>\n",
" <td>total</td>\n",
" <td>(((absorption / flux) / (total / flux)) + ((sc...</td>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>0.003739</td>\n",
" </tr>\n",
" </tbody>\n",
@ -1162,7 +1146,7 @@
"1 (((absorption / flux) / (total / flux)) + ((sc... 1.00e+00 3.74e-03 "
]
},
"execution_count": 26,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@ -1178,21 +1162,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"pygments_lexer": "ipython3",
"version": "3.5.1"
}
},
"nbformat": 4,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,9 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook shows the how tallies can be combined (added, subtracted, multiplied, etc.) using the Python API in order to create derived tallies. Since no covariance information is obtained, it is assumed that tallies are completely independent of one another when propagating uncertainties. The target problem is a simple pin cell.\n",
"\n",
"**Note:** that this Notebook was created using the latest Pandas v0.16.1. Everything in the Notebook will wun with older versions of Pandas, but the multi-indexing option in >v0.15.0 makes the tables look prettier."
"This notebook shows the how tallies can be combined (added, subtracted, multiplied, etc.) using the Python API in order to create derived tallies. Since no covariance information is obtained, it is assumed that tallies are completely independent of one another when propagating uncertainties. The target problem is a simple pin cell."
]
},
{
@ -16,18 +14,6 @@
"collapsed": false
},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import glob\n",
"from IPython.display import Image\n",
@ -52,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {
"collapsed": true
},
@ -76,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"collapsed": false
},
@ -111,7 +97,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"collapsed": false
},
@ -134,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {
"collapsed": false
},
@ -163,7 +149,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {
"collapsed": false
},
@ -200,7 +186,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {
"collapsed": false
},
@ -227,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"metadata": {
"collapsed": false
},
@ -240,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"metadata": {
"collapsed": false
},
@ -259,7 +245,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 10,
"metadata": {
"collapsed": true
},
@ -295,7 +281,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {
"collapsed": false
},
@ -323,7 +309,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {
"collapsed": false
},
@ -334,7 +320,7 @@
"0"
]
},
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@ -346,19 +332,19 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AEHgslKE7FoLIAAALKSURBVGje7dpLcqQwDAbgHHE2\nYeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmNP+HDhw8fPnz48Kf6VH9G\n+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4zPji99z0/AJ4n1lfvJ6f\nnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6pA0wfln+ho/fwgYYn19C\n/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tNDbSGz7T0SBEWw4vLXzbQ\n6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X58wZaxWd1+fMGiuFvir8b\nvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV873hB8UnM3xzANtf8nb4\ndwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7T/ppARBvp48UwJnelT5S\nACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4//Jve+fhsH6Ctv7n8PTzj\nvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V32/o9+fl389Xnx+g5x/o\n+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6/4Le/6D3T/D9V67Y/ZsV\nQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/gPs/0P4TtP8F7r9J3AIO\n9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTuf4X7b+H+X7T/+BPuf3aM\n8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDQtMzBUMDY6Mzc6\nNDAtMDU6MDAMbOxZAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTA0LTMwVDA2OjM3OjQwLTA1OjAw\nfTFU5QAAAABJRU5ErkJggg==\n",
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AFBRQzLY81/IkAAALKSURBVGje7dpLcqQwDAbgHHE2\nYeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmNP+HDhw8fPnz48Kf6VH9G\n+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4zPji99z0/AJ4n1lfvJ6f\nnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6pA0wfln+ho/fwgYYn19C\n/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tNDbSGz7T0SBEWw4vLXzbQ\n6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X58wZaxWd1+fMGiuFvir8b\nvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV873hB8UnM3xzANtf8nb4\ndwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7T/ppARBvp48UwJnelT5S\nACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4//Jve+fhsH6Ctv7n8PTzj\nvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V32/o9+fl389Xnx+g5x/o\n+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6/4Le/6D3T/D9V67Y/ZsV\nQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/gPs/0P4TtP8F7r9J3AIO\n9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTuf4X7b+H+X7T/+BPuf3aM\n8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDUtMDVUMTQ6NTE6\nNDUtMDY6MDCqOITjAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTA1LTA1VDE0OjUxOjQ1LTA2OjAw\n22U8XwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@ -380,7 +366,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {
"collapsed": false
},
@ -392,7 +378,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 15,
"metadata": {
"collapsed": false
},
@ -429,7 +415,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 16,
"metadata": {
"collapsed": true
},
@ -445,7 +431,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 17,
"metadata": {
"collapsed": false
},
@ -460,7 +446,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 18,
"metadata": {
"collapsed": false
},
@ -476,7 +462,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 19,
"metadata": {
"collapsed": true
},
@ -491,7 +477,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 20,
"metadata": {
"collapsed": true
},
@ -511,7 +497,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 21,
"metadata": {
"collapsed": false
},
@ -530,7 +516,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 22,
"metadata": {
"collapsed": false,
"scrolled": true
@ -556,8 +542,8 @@
" Copyright: 2011-2016 Massachusetts Institute of Technology\n",
" License: http://openmc.readthedocs.org/en/latest/license.html\n",
" Version: 0.7.1\n",
" Git SHA1: ae083cf5d491e6a778d5b762dad19c8d5fe45238\n",
" Date/Time: 2016-04-30 06:37:41\n",
" Git SHA1: df280b60eb1c6d7b7f842e05ede734a4883a0fc8\n",
" Date/Time: 2016-05-05 14:51:45\n",
"\n",
" ===========================================================================\n",
" ========================> INITIALIZATION <=========================\n",
@ -613,20 +599,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 7.0900E-01 seconds\n",
" Reading cross sections = 4.0400E-01 seconds\n",
" Total time in simulation = 1.7108E+01 seconds\n",
" Time in transport only = 1.7093E+01 seconds\n",
" Time in inactive batches = 3.3970E+00 seconds\n",
" Time in active batches = 1.3711E+01 seconds\n",
" Total time for initialization = 7.2500E-01 seconds\n",
" Reading cross sections = 4.4400E-01 seconds\n",
" Total time in simulation = 1.5547E+01 seconds\n",
" Time in transport only = 1.5527E+01 seconds\n",
" Time in inactive batches = 2.2880E+00 seconds\n",
" Time in active batches = 1.3259E+01 seconds\n",
" Time synchronizing fission bank = 1.0000E-03 seconds\n",
" Sampling source sites = 1.0000E-03 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 = 1.0000E-03 seconds\n",
" Total time elapsed = 1.7835E+01 seconds\n",
" Calculation Rate (inactive) = 3679.72 neutrons/second\n",
" Calculation Rate (active) = 2735.03 neutrons/second\n",
" Time accumulating tallies = 1.0000E-03 seconds\n",
" Total time for finalization = 2.0000E-03 seconds\n",
" Total time elapsed = 1.6291E+01 seconds\n",
" Calculation Rate (inactive) = 5463.29 neutrons/second\n",
" Calculation Rate (active) = 2828.27 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
@ -644,7 +630,7 @@
"0"
]
},
"execution_count": 23,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
@ -673,7 +659,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 23,
"metadata": {
"collapsed": false,
"scrolled": true
@ -684,27 +670,6 @@
"sp = openmc.StatePoint('statepoint.20.h5')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You may have also noticed we instructed OpenMC to create a summary file with lots of geometry information in it. This can help to produce more sensible output from the Python API, so we will use the summary file to link against."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
"source": [
"# Load the summary file and link with statepoint\n",
"su = openmc.Summary('summary.h5')\n",
"sp.link_with_summary(su)"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -716,7 +681,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 24,
"metadata": {
"collapsed": false
},
@ -752,7 +717,7 @@
"0 total (nu-fission / absorption) 1.04e+00 6.14e-03"
]
},
"execution_count": 26,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
@ -776,7 +741,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 25,
"metadata": {
"collapsed": false
},
@ -816,7 +781,7 @@
"0 0.00e+00 6.25e-07 total absorption 6.93e-01 4.11e-03"
]
},
"execution_count": 27,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@ -838,7 +803,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 26,
"metadata": {
"collapsed": false
},
@ -878,7 +843,7 @@
"0 0.00e+00 6.25e-07 total nu-fission 1.20e+00 7.60e-03"
]
},
"execution_count": 28,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
@ -901,7 +866,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 27,
"metadata": {
"collapsed": false
},
@ -946,7 +911,7 @@
"0 4.72e-03 "
]
},
"execution_count": 29,
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
@ -967,7 +932,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 28,
"metadata": {
"collapsed": false
},
@ -1012,7 +977,7 @@
"0 (nu-fission / absorption) 1.66e+00 1.13e-02 "
]
},
"execution_count": 30,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
@ -1032,7 +997,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 29,
"metadata": {
"collapsed": false
},
@ -1077,7 +1042,7 @@
"0 (((absorption * nu-fission) * absorption) * (n... 1.04e+00 1.32e-02 "
]
},
"execution_count": 31,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
@ -1098,7 +1063,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 30,
"metadata": {
"collapsed": false,
"scrolled": true
@ -1114,7 +1079,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 31,
"metadata": {
"collapsed": false
},
@ -1243,7 +1208,7 @@
"7 (scatter / flux) 3.37e-03 1.44e-05 "
]
},
"execution_count": 33,
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
@ -1262,7 +1227,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 32,
"metadata": {
"collapsed": false
},
@ -1294,7 +1259,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 33,
"metadata": {
"collapsed": false
},
@ -1318,7 +1283,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 34,
"metadata": {
"collapsed": false
},
@ -1349,7 +1314,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 35,
"metadata": {
"collapsed": false
},
@ -1430,7 +1395,7 @@
"3 7.32e-04 "
]
},
"execution_count": 37,
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
@ -1443,7 +1408,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 36,
"metadata": {
"collapsed": false
},
@ -1584,7 +1549,7 @@
"8 3.20e-03 "
]
},
"execution_count": 38,
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}

View file

@ -33,6 +33,10 @@ class Cell(object):
automatically be assigned.
name : str, optional
Name of the cell. If not specified, the name is the empty string.
fill : openmc.Material or openmc.Universe or openmc.Lattice or 'void' or iterable of openmc.Material, optional
Indicates what the region of space is filled with
region : openmc.Region, optional
Region of space that is assigned to the cell.
Attributes
----------
@ -58,7 +62,7 @@ class Cell(object):
"""
def __init__(self, cell_id=None, name=''):
def __init__(self, cell_id=None, name='', fill=None, region=None):
# Initialize Cell class attributes
self.id = cell_id
self.name = name
@ -70,6 +74,11 @@ class Cell(object):
self._offsets = None
self._distribcell_index = None
if fill is not None:
self.fill = fill
if region is not None:
self.region = region
def __eq__(self, other):
if not isinstance(other, Cell):
return False

1
openmc/data/__init__.py Normal file
View file

@ -0,0 +1 @@
from .data import *

101
openmc/data/data.py Normal file
View file

@ -0,0 +1,101 @@
# Isotopic abundances from M. Berglund and M. E. Wieser, "Isotopic compositions
# of the elements 2009 (IUPAC Technical Report)", Pure. Appl. Chem. 83 (2),
# pp. 397--410 (2011).
natural_abundance = {
'H-1': 0.999885, 'H-2': 0.000115, 'He-3': 1.34e-06,
'He-4': 0.99999866, 'Li-6': 0.0759, 'Li-7': 0.9241,
'Be-9': 1.0, 'B-10': 0.199, 'B-11': 0.801,
'C-12': 0.9893, 'C-13': 0.0107, 'N-14': 0.99636,
'N-15': 0.00364, 'O-16': 0.99757, 'O-17': 0.00038,
'O-18': 0.00205, 'F-19': 1.0, 'Ne-20': 0.9048,
'Ne-21': 0.0027, 'Ne-22': 0.0925, 'Na-23': 1.0,
'Mg-24': 0.7899, 'Mg-25': 0.1, 'Mg-26': 0.1101,
'Al-27': 1.0, 'Si-28': 0.92223, 'Si-29': 0.04685,
'Si-30': 0.03092, 'P-31': 1.0, 'S-32': 0.9499,
'S-33': 0.0075, 'S-34': 0.0425, 'S-36': 0.0001,
'Cl-35': 0.7576, 'Cl-37': 0.2424, 'Ar-36': 0.003336,
'Ar-38': 0.000629, 'Ar-40': 0.996035, 'K-39': 0.932581,
'K-40': 0.000117, 'K-41': 0.067302, 'Ca-40': 0.96941,
'Ca-42': 0.00647, 'Ca-43': 0.00135, 'Ca-44': 0.02086,
'Ca-46': 4e-05, 'Ca-48': 0.00187, 'Sc-45': 1.0,
'Ti-46': 0.0825, 'Ti-47': 0.0744, 'Ti-48': 0.7372,
'Ti-49': 0.0541, 'Ti-50': 0.0518, 'V-50': 0.0025,
'V-51': 0.9975, 'Cr-50': 0.04345, 'Cr-52': 0.83789,
'Cr-53': 0.09501, 'Cr-54': 0.02365, 'Mn-55': 1.0,
'Fe-54': 0.05845, 'Fe-56': 0.91754, 'Fe-57': 0.02119,
'Fe-58': 0.00282, 'Co-59': 1.0, 'Ni-58': 0.68077,
'Ni-60': 0.26223, 'Ni-61': 0.011399, 'Ni-62': 0.036346,
'Ni-64': 0.009255, 'Cu-63': 0.6915, 'Cu-65': 0.3085,
'Zn-64': 0.4917, 'Zn-66': 0.2773, 'Zn-67': 0.0404,
'Zn-68': 0.1845, 'Zn-70': 0.0061, 'Ga-69': 0.60108,
'Ga-71': 0.39892, 'Ge-70': 0.2057, 'Ge-72': 0.2745,
'Ge-73': 0.0775, 'Ge-74': 0.365, 'Ge-76': 0.0773,
'As-75': 1.0, 'Se-74': 0.0089, 'Se-76': 0.0937,
'Se-77': 0.0763, 'Se-78': 0.2377, 'Se-80': 0.4961,
'Se-82': 0.0873, 'Br-79': 0.5069, 'Br-81': 0.4931,
'Kr-78': 0.00355, 'Kr-80': 0.02286, 'Kr-82': 0.11593,
'Kr-83': 0.115, 'Kr-84': 0.56987, 'Kr-86': 0.17279,
'Rb-85': 0.7217, 'Rb-87': 0.2783, 'Sr-84': 0.0056,
'Sr-86': 0.0986, 'Sr-87': 0.07, 'Sr-88': 0.8258,
'Y-89': 1.0, 'Zr-90': 0.5145, 'Zr-91': 0.1122,
'Zr-92': 0.1715, 'Zr-94': 0.1738, 'Zr-96': 0.028,
'Nb-93': 1.0, 'Mo-92': 0.1453, 'Mo-94': 0.0915,
'Mo-95': 0.1584, 'Mo-96': 0.1667, 'Mo-97': 0.096,
'Mo-98': 0.2439, 'Mo-100': 0.0982, 'Ru-96': 0.0554,
'Ru-98': 0.0187, 'Ru-99': 0.1276, 'Ru-100': 0.126,
'Ru-101': 0.1706, 'Ru-102': 0.3155, 'Ru-104': 0.1862,
'Rh-103': 1.0, 'Pd-102': 0.0102, 'Pd-104': 0.1114,
'Pd-105': 0.2233, 'Pd-106': 0.2733, 'Pd-108': 0.2646,
'Pd-110': 0.1172, 'Ag-107': 0.51839, 'Ag-109': 0.48161,
'Cd-106': 0.0125, 'Cd-108': 0.0089, 'Cd-110': 0.1249,
'Cd-111': 0.128, 'Cd-112': 0.2413, 'Cd-113': 0.1222,
'Cd-114': 0.2873, 'Cd-116': 0.0749, 'In-113': 0.0429,
'In-115': 0.9571, 'Sn-112': 0.0097, 'Sn-114': 0.0066,
'Sn-115': 0.0034, 'Sn-116': 0.1454, 'Sn-117': 0.0768,
'Sn-118': 0.2422, 'Sn-119': 0.0859, 'Sn-120': 0.3258,
'Sn-122': 0.0463, 'Sn-124': 0.0579, 'Sb-121': 0.5721,
'Sb-123': 0.4279, 'Te-120': 0.0009, 'Te-122': 0.0255,
'Te-123': 0.0089, 'Te-124': 0.0474, 'Te-125': 0.0707,
'Te-126': 0.1884, 'Te-128': 0.3174, 'Te-130': 0.3408,
'I-127': 1.0, 'Xe-124': 0.000952, 'Xe-126': 0.00089,
'Xe-128': 0.019102, 'Xe-129': 0.264006, 'Xe-130': 0.04071,
'Xe-131': 0.212324, 'Xe-132': 0.269086, 'Xe-134': 0.104357,
'Xe-136': 0.088573, 'Cs-133': 1.0, 'Ba-130': 0.00106,
'Ba-132': 0.00101, 'Ba-134': 0.02417, 'Ba-135': 0.06592,
'Ba-136': 0.07854, 'Ba-137': 0.11232, 'Ba-138': 0.71698,
'La-138': 0.0008881, 'La-139': 0.9991119, 'Ce-136': 0.00185,
'Ce-138': 0.00251, 'Ce-140': 0.8845, 'Ce-142': 0.11114,
'Pr-141': 1.0, 'Nd-142': 0.27152, 'Nd-143': 0.12174,
'Nd-144': 0.23798, 'Nd-145': 0.08293, 'Nd-146': 0.17189,
'Nd-148': 0.05756, 'Nd-150': 0.05638, 'Sm-144': 0.0307,
'Sm-147': 0.1499, 'Sm-148': 0.1124, 'Sm-149': 0.1382,
'Sm-150': 0.0738, 'Sm-152': 0.2675, 'Sm-154': 0.2275,
'Eu-151': 0.4781, 'Eu-153': 0.5219, 'Gd-152': 0.002,
'Gd-154': 0.0218, 'Gd-155': 0.148, 'Gd-156': 0.2047,
'Gd-157': 0.1565, 'Gd-158': 0.2484, 'Gd-160': 0.2186,
'Tb-159': 1.0, 'Dy-156': 0.00056, 'Dy-158': 0.00095,
'Dy-160': 0.02329, 'Dy-161': 0.18889, 'Dy-162': 0.25475,
'Dy-163': 0.24896, 'Dy-164': 0.2826, 'Ho-165': 1.0,
'Er-162': 0.00139, 'Er-164': 0.01601, 'Er-166': 0.33503,
'Er-167': 0.22869, 'Er-168': 0.26978, 'Er-170': 0.1491,
'Tm-169': 1.0, 'Yb-168': 0.00123, 'Yb-170': 0.02982,
'Yb-171': 0.1409, 'Yb-172': 0.2168, 'Yb-173': 0.16103,
'Yb-174': 0.32026, 'Yb-176': 0.12996, 'Lu-175': 0.97401,
'Lu-176': 0.02599, 'Hf-174': 0.0016, 'Hf-176': 0.0526,
'Hf-177': 0.186, 'Hf-178': 0.2728, 'Hf-179': 0.1362,
'Hf-180': 0.3508, 'Ta-180': 0.0001201, 'Ta-181': 0.9998799,
'W-180': 0.0012, 'W-182': 0.265, 'W-183': 0.1431,
'W-184': 0.3064, 'W-186': 0.2843, 'Re-185': 0.374,
'Re-187': 0.626, 'Os-184': 0.0002, 'Os-186': 0.0159,
'Os-187': 0.0196, 'Os-188': 0.1324, 'Os-189': 0.1615,
'Os-190': 0.2626, 'Os-192': 0.4078, 'Ir-191': 0.373,
'Ir-193': 0.627, 'Pt-190': 0.00012, 'Pt-192': 0.00782,
'Pt-194': 0.3286, 'Pt-195': 0.3378, 'Pt-196': 0.2521,
'Pt-198': 0.07356, 'Au-197': 1.0, 'Hg-196': 0.0015,
'Hg-198': 0.0997, 'Hg-199': 0.1687, 'Hg-200': 0.231,
'Hg-201': 0.1318, 'Hg-202': 0.2986, 'Hg-204': 0.0687,
'Tl-203': 0.2952, 'Tl-205': 0.7048, 'Pb-204': 0.014,
'Pb-206': 0.241, 'Pb-207': 0.221, 'Pb-208': 0.524,
'Bi-209': 1.0, 'Th-232': 1.0, 'Pa-231': 1.0,
'U-234': 5.4e-05, 'U-235': 0.007204, 'U-238': 0.992742
}

View file

@ -1,6 +1,8 @@
import sys
import openmc
from openmc.checkvalue import check_type
from openmc.data import natural_abundance
if sys.version_info[0] >= 3:
basestring = str
@ -109,3 +111,22 @@ class Element(object):
raise ValueError(msg)
self._scattering = scattering
def expand(self):
"""Expand natural element into its naturally-occurring isotopes.
Returns
-------
isotopes : list
Naturally-occurring isotopes of the element. Each item of the list
is a tuple consisting of an openmc.Nuclide instance and the natural
abundance of the isotope.
"""
isotopes = []
for isotope, abundance in natural_abundance.items():
if isotope.startswith(self.name):
nuc = openmc.Nuclide(isotope, self.xs)
isotopes.append((nuc, abundance))
return isotopes

View file

@ -32,11 +32,11 @@ class Lattice(object):
Name of the lattice
pitch : float
Pitch of the lattice in cm
outer : int
The unique identifier of a universe to fill all space outside the
lattice
universes : numpy.ndarray of openmc.Universe
An array of universes filling each element of the lattice
outer : openmc.Universe
A universe to fill all space outside the lattice
universes : Iterable of Iterable of openmc.Universe
A two- or three-dimensional list/array of universes filling each element
of the lattice
"""
@ -259,6 +259,13 @@ class RectLattice(Lattice):
lower_left : Iterable of float
The coordinates of the lower-left corner of the lattice. If the lattice
is two-dimensional, only the x- and y-coordinates are specified.
pitch : float
Pitch of the lattice in cm
outer : openmc.Universe
A universe to fill all space outside the lattice
universes : Iterable of Iterable of openmc.Universe
A two- or three-dimensional list/array of universes filling each element
of the lattice
"""
@ -505,6 +512,13 @@ class HexLattice(Lattice):
center : Iterable of float
Coordinates of the center of the lattice. If the lattice does not have
axial sections then only the x- and y-coordinates are specified
pitch : float
Pitch of the lattice in cm
outer : openmc.Universe
A universe to fill all space outside the lattice
universes : Iterable of Iterable of openmc.Universe
A two- or three-dimensional list/array of universes filling each element
of the lattice
"""
@ -635,7 +649,7 @@ class HexLattice(Lattice):
# Set the number of rings and make sure this number is consistent for
# all axial positions.
if n_dims == 3:
self.num_rings = len(self._universes)
self.num_rings = len(self._universes[0])
for rings in self._universes:
if len(rings) != self._num_rings:
msg = 'HexLattice ID={0:d} has an inconsistent number of ' \

View file

@ -10,6 +10,7 @@ if sys.version_info[0] >= 3:
import openmc
import openmc.checkvalue as cv
from openmc.clean_xml import *
from openmc.data import natural_abundance
# A static variable for auto-generated Material IDs
@ -49,6 +50,14 @@ class Material(object):
Units used for `density`. Can be one of 'g/cm3', 'g/cc', 'kg/cm3',
'atom/b-cm', 'atom/cm3', 'sum', or 'macro'. The 'macro' unit only
applies in the case of a multi-group calculation.
elements : collections.OrderedDict
Dictionary whose keys are element names and values are 3-tuples
consisting of an :class:`openmc.Element` instance, the percent density,
and the percent type (atom or weight fraction).
nuclides : collections.OrderedDict
Dictionary whose keys are nuclide names and values are 3-tuples
consisting of an :class:`openmc.Nuclide` instance, the percent density,
and the percent type (atom or weight fraction).
"""
@ -186,6 +195,14 @@ class Material(object):
def density_units(self):
return self._density_units
@property
def elements(self):
return self._elements
@property
def nuclides(self):
return self._nuclides
@property
def convert_to_distrib_comps(self):
return self._convert_to_distrib_comps
@ -382,7 +399,7 @@ class Material(object):
if macroscopic._name == self._macroscopic.name:
self._macroscopic = None
def add_element(self, element, percent, percent_type='ao'):
def add_element(self, element, percent, percent_type='ao', expand=False):
"""Add a natural element to the material
Parameters
@ -391,8 +408,12 @@ class Material(object):
Element to add
percent : float
Atom or weight percent
percent_type : {'ao', 'wo'}
'ao' for atom percent and 'wo' for weight percent
percent_type : {'ao', 'wo'}, optional
'ao' for atom percent and 'wo' for weight percent. Defaults to atom
percent.
expand : bool, optional
Whether to expand the natural element into its naturally-occurring
isotopes. Defaults to False.
"""
@ -422,7 +443,15 @@ class Material(object):
else:
element = openmc.Element(element)
self._elements[element._name] = (element, percent, percent_type)
if expand:
if percent_type == 'wo':
raise NotImplementedError('Expanding natural element based on '
'weight percent is not yet supported.')
for isotope, abundance in element.expand():
self._nuclides[isotope.name] = (
isotope, percent*abundance, percent_type)
else:
self._elements[element.name] = (element, percent, percent_type)
def remove_element(self, element):
"""Remove a natural element from the material
@ -491,6 +520,14 @@ class Material(object):
density = nuclide_tuple[1]
nuclides[nuclide._name] = (nuclide, density)
for element_name, element_tuple in self._elements.items():
element = element_tuple[0]
density = element_tuple[1]
# Expand natural element into isotopes
for isotope, abundance in element.expand():
nuclides[isotope.name] = (isotope, density*abundance)
return nuclides
def _get_nuclide_xml(self, nuclide, distrib=False):

View file

@ -575,7 +575,8 @@ class Library(object):
return subdomain_avg_library
def build_hdf5_store(self, filename='mgxs.h5', directory='mgxs',
subdomains='all', nuclides='all', xs_type='macro'):
subdomains='all', nuclides='all', xs_type='macro',
row_column='inout'):
"""Export the multi-group cross section library to an HDF5 binary file.
This method constructs an HDF5 file which stores the library's
@ -605,6 +606,10 @@ class Library(object):
xs_type: {'macro', 'micro'}
Store the macro or micro cross section in units of cm^-1 or barns.
Defaults to 'macro'.
row_column: {'inout', 'outin'}
Store scattering matrices indexed first by incoming group and
second by outgoing group ('inout'), or vice versa ('outin').
Defaults to 'inout'.
Raises
------
@ -646,8 +651,8 @@ class Library(object):
if subdomains == 'avg':
mgxs = mgxs.get_subdomain_avg_xs()
mgxs.build_hdf5_store(filename, directory,
xs_type=xs_type, nuclides=nuclides)
mgxs.build_hdf5_store(filename, directory, xs_type=xs_type,
nuclides=nuclides, row_column=row_column)
def dump_to_file(self, filename='mgxs', directory='mgxs'):
"""Store this Library object in a pickle binary file.

View file

@ -654,7 +654,8 @@ class MGXS(object):
self.tallies[tally_type] = sp_tally
def get_xs(self, groups='all', subdomains='all', nuclides='all',
xs_type='macro', order_groups='increasing', value='mean'):
xs_type='macro', order_groups='increasing',
value='mean', **kwargs):
"""Returns an array of multi-group cross sections.
This method constructs a 2D NumPy array for the requested multi-group
@ -1143,7 +1144,7 @@ class MGXS(object):
def build_hdf5_store(self, filename='mgxs.h5', directory='mgxs',
subdomains='all', nuclides='all',
xs_type='macro', append=True):
xs_type='macro', row_column='inout', append=True):
"""Export the multi-group cross section data to an HDF5 binary file.
This method constructs an HDF5 file which stores the multi-group
@ -1172,6 +1173,10 @@ class MGXS(object):
xs_type: {'macro', 'micro'}
Store the macro or micro cross section in units of cm^-1 or barns.
Defaults to 'macro'.
row_column: {'inout', 'outin'}
Store scattering matrices indexed first by incoming group and
second by outgoing group ('inout'), or vice versa ('outin').
Defaults to 'inout'.
append : bool
If true, appends to an existing HDF5 file with the same filename
directory (if one exists). Defaults to True.
@ -1258,9 +1263,9 @@ class MGXS(object):
# Extract the cross section for this subdomain and nuclide
average = self.get_xs(subdomains=[subdomain], nuclides=[nuclide],
xs_type=xs_type, value='mean')
xs_type=xs_type, value='mean', row_column=row_column)
std_dev = self.get_xs(subdomains=[subdomain], nuclides=[nuclide],
xs_type=xs_type, value='std_dev')
xs_type=xs_type, value='std_dev', row_column=row_column)
average = average.squeeze()
std_dev = std_dev.squeeze()
@ -1972,7 +1977,8 @@ class ScatterMatrixXS(MGXS):
def get_xs(self, in_groups='all', out_groups='all',
subdomains='all', nuclides='all', xs_type='macro',
order_groups='increasing', value='mean'):
order_groups='increasing', row_column='inout',
value='mean', **kwargs):
"""Returns an array of multi-group cross sections.
This method constructs a 2D NumPy array for the requested scattering
@ -1998,6 +2004,10 @@ class ScatterMatrixXS(MGXS):
Return the cross section indexed according to increasing or
decreasing energy groups (decreasing or increasing energies).
Defaults to 'increasing'.
row_column: {'inout', 'outin'}
Return the cross section indexed first by incoming group and
second by outgoing group ('inout'), or vice versa ('outin').
Defaults to 'inout'.
value : str
A string for the type of value to return - 'mean', 'std_dev', or
'rel_err' are accepted. Defaults to the empty string.
@ -2091,6 +2101,10 @@ class ScatterMatrixXS(MGXS):
new_shape += xs.shape[1:]
xs = np.reshape(xs, new_shape)
# Transpose the scattering matrix if requested by user
if row_column == 'outin':
xs = np.swapaxes(xs, 1, 2)
# Reverse energies to align with increasing energy groups
xs = xs[:, ::-1, ::-1, :]
@ -2421,7 +2435,8 @@ class Chi(MGXS):
return merged_mgxs
def get_xs(self, groups='all', subdomains='all', nuclides='all',
xs_type='macro', order_groups='increasing', value='mean'):
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

View file

@ -1,5 +1,6 @@
import sys
import re
import os
import numpy as np
import openmc
@ -14,6 +15,14 @@ class StatePoint(object):
of a given batch). Statepoints can be used to analyze tally results as well
as restart a simulation.
Parameters
----------
filename : str
Path to file to load
autolink : bool, optional
Whether to automatically link in metadata from a summary.h5
file. Defaults to True.
Attributes
----------
cmfd_on : bool
@ -93,7 +102,7 @@ class StatePoint(object):
"""
def __init__(self, filename):
def __init__(self, filename, autolink=True):
import h5py
self._f = h5py.File(filename, 'r')
@ -116,10 +125,17 @@ class StatePoint(object):
# Set flags for what data has been read
self._meshes_read = False
self._tallies_read = False
self._summary = False
self._summary = None
self._global_tallies = None
self._sparse = False
# Automatically link in a summary file if one exists
if autolink:
path_summary = os.path.join(os.path.dirname(filename), 'summary.h5')
if os.path.exists(path_summary):
su = openmc.Summary(path_summary)
self.link_with_summary(su)
def close(self):
self._f.close()
@ -612,6 +628,11 @@ class StatePoint(object):
"""
if self.summary is not None:
warnings.warn('A Summary object has already been linked.',
RuntimeWarning)
return
if not isinstance(summary, openmc.summary.Summary):
msg = 'Unable to link statepoint with "{0}" which ' \
'is not a Summary object'.format(summary)

View file

@ -65,9 +65,10 @@ class Summary(object):
self.n_batches = self._f['n_batches'].value
self.n_particles = self._f['n_particles'].value
self.n_active = self._f['n_active'].value
self.n_inactive = self._f['n_inactive'].value
self.gen_per_batch = self._f['gen_per_batch'].value
if 'n_inactive' in self._f:
self.n_active = self._f['n_active'].value
self.n_inactive = self._f['n_inactive'].value
self.gen_per_batch = self._f['gen_per_batch'].value
self.n_procs = self._f['n_procs'].value
def _read_geometry(self):
@ -378,11 +379,11 @@ class Summary(object):
self.lattices[index] = lattice
if lattice_type == 'hexagonal':
n_rings = self._f['geometry/lattices'][key]['n_rings'][0]
n_axial = self._f['geometry/lattices'][key]['n_axial'][0]
n_rings = self._f['geometry/lattices'][key]['n_rings'].value
n_axial = self._f['geometry/lattices'][key]['n_axial'].value
center = self._f['geometry/lattices'][key]['center'][...]
pitch = self._f['geometry/lattices'][key]['pitch'][...]
outer = self._f['geometry/lattices'][key]['outer'][0]
outer = self._f['geometry/lattices'][key]['outer'].value
universe_ids = self._f[
'geometry/lattices'][key]['universes'][...]

View file

@ -36,6 +36,8 @@ class Universe(object):
automatically be assigned
name : str, optional
Name of the universe. If not specified, the name is the empty string.
cells : Iterable of openmc.Cell, optional
Cells to add to the universe. By default no cells are added.
Attributes
----------
@ -49,7 +51,7 @@ class Universe(object):
"""
def __init__(self, universe_id=None, name=''):
def __init__(self, universe_id=None, name='', cells=None):
# Initialize Cell class attributes
self.id = universe_id
self.name = name
@ -61,7 +63,9 @@ class Universe(object):
# Keys - Cell IDs
# Values - Offsets
self._cell_offsets = OrderedDict()
self._num_regions = 0
if cells is not None:
self.add_cells(cells)
def __eq__(self, other):
if not isinstance(other, Universe):
@ -87,8 +91,6 @@ class Universe(object):
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
string += '{0: <16}{1}{2}\n'.format('\tCells', '=\t',
list(self._cells.keys()))
string += '{0: <16}{1}{2}\n'.format('\t# Regions', '=\t',
self._num_regions)
return string
@property

View file

@ -11,7 +11,7 @@ except ImportError:
kwargs = {'name': 'openmc',
'version': '0.7.1',
'packages': ['openmc', 'openmc.mgxs', 'openmc.stats'],
'packages': ['openmc', 'openmc.data', 'openmc.mgxs', 'openmc.stats'],
'scripts': glob.glob('scripts/openmc-*'),
# Metadata

View file

@ -54,7 +54,7 @@ contains
write(UNIT=OUTPUT_UNIT, FMT=*) &
' Copyright: 2011-2016 Massachusetts Institute of Technology'
write(UNIT=OUTPUT_UNIT, FMT=*) &
' License: http://openmc.readthedocs.org/en/latest/license.html'
' License: http://openmc.readthedocs.io/en/latest/license.html'
write(UNIT=OUTPUT_UNIT, FMT='(6X,"Version:",8X,I1,".",I1,".",I1)') &
VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE
#ifdef GIT_SHA1

View file

@ -82,11 +82,6 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Extract the tally of interest
tally = sp.get_tally(name='distribcell tally')
@ -96,8 +91,8 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
outstr += ', '.join(map(str, tally.std_dev.flatten())) + '\n'
# Extract fuel assembly lattices from the summary
core = su.get_cell_by_id(1)
fuel = su.get_cell_by_id(80)
core = sp.summary.get_cell_by_id(1)
fuel = sp.summary.get_cell_by_id(80)
fuel = fuel.fill
core = core.fill

View file

@ -43,11 +43,6 @@ class MGXSTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Load the MGXS library from the statepoint
self.mgxs_lib.load_from_statepoint(sp)

View file

@ -46,11 +46,6 @@ class MGXSTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Load the MGXS library from the statepoint
self.mgxs_lib.load_from_statepoint(sp)

View file

@ -44,11 +44,6 @@ class MGXSTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Load the MGXS library from the statepoint
self.mgxs_lib.load_from_statepoint(sp)

View file

@ -43,11 +43,6 @@ class MGXSTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Load the MGXS library from the statepoint
self.mgxs_lib.load_from_statepoint(sp)

View file

@ -43,11 +43,6 @@ class MGXSTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Load the MGXS library from the statepoint
self.mgxs_lib.load_from_statepoint(sp)

View file

@ -43,11 +43,6 @@ class TallyAggregationTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Extract the tally of interest
tally = sp.get_tally(name='distribcell tally')

View file

@ -62,11 +62,6 @@ class TallyArithmeticTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Load the tallies
tally_1 = sp.get_tally(name='tally 1')
tally_2 = sp.get_tally(name='tally 2')

View file

@ -83,11 +83,6 @@ class TallySliceMergeTestHarness(PyAPITestHarness):
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
sp = openmc.StatePoint(statepoint)
# Read the summary file.
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
su = openmc.Summary(summary)
sp.link_with_summary(su)
# Extract the cell tally
tallies = [sp.get_tally(name='cell tally')]