Updated docstrings for MultiGroupXS subclasses in Python API

This commit is contained in:
Will Boyd 2015-10-03 02:57:06 -04:00
parent 3baaacda99
commit 40f893e6d0
3 changed files with 813 additions and 438 deletions

File diff suppressed because one or more lines are too long

View file

@ -369,7 +369,7 @@
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdC\nAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAxQTFRF\n////chIS6YCRTb/E6kGE+wAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAALKSURB\nVGje7dpLcqQwDAbgHHE2YeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmN\nP+HDhw8fPnz48Kf6VH9G+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4\nzPji99z0/AJ4n1lfvJ6fnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6\npA0wfln+ho/fwgYYn19C/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tN\nDbSGz7T0SBEWw4vLXzbQ6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X5\n8wZaxWd1+fMGiuFvir8bvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV\n873hB8UnM3xzANtf8nb4dwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7\nT/ppARBvp48UwJnelT5SACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4/\n/Jve+fhsH6Ctv7n8PTzjvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V\n32/o9+fl389Xnx+g5x/o+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6\n/4Le/6D3T/D9V67Y/ZsVQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/\ngPs/0P4TtP8F7r9J3AIO9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTu\nf4X7b+H+X7T/+BPuf3aM8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIw\nMTUtMTAtMDNUMDE6MTQ6MjctMDQ6MDC2Fcw9AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTEwLTAz\nVDAxOjE0OjI3LTA0OjAwx0h0gQAAAABJRU5ErkJggg==\n",
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdC\nAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAxQTFRF\n////chIS6YCRTb/E6kGE+wAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAALKSURB\nVGje7dpLcqQwDAbgHHE2YeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmN\nP+HDhw8fPnz48Kf6VH9G+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4\nzPji99z0/AJ4n1lfvJ6fnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6\npA0wfln+ho/fwgYYn19C/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tN\nDbSGz7T0SBEWw4vLXzbQ6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X5\n8wZaxWd1+fMGiuFvir8bvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV\n873hB8UnM3xzANtf8nb4dwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7\nT/ppARBvp48UwJnelT5SACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4/\n/Jve+fhsH6Ctv7n8PTzjvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V\n32/o9+fl389Xnx+g5x/o+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6\n/4Le/6D3T/D9V67Y/ZsVQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/\ngPs/0P4TtP8F7r9J3AIO9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTu\nf4X7b+H+X7T/+BPuf3aM8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIw\nMTUtMTAtMDNUMDI6NTA6NDctMDQ6MDB0gnqMAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTEwLTAz\nVDAyOjUwOjQ3LTA0OjAwBd/CMAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
@ -580,7 +580,7 @@
" License: http://mit-crpg.github.io/openmc/license.html\n",
" Version: 0.7.0\n",
" Git SHA1: e0c2aace2e73367536fa03e153b67a2d038cd2b3\n",
" Date/Time: 2015-10-03 01:14:27\n",
" Date/Time: 2015-10-03 02:50:47\n",
" MPI Processes: 1\n",
"\n",
" ===========================================================================\n",
@ -636,20 +636,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 6.7400E-01 seconds\n",
" Reading cross sections = 1.5200E-01 seconds\n",
" Total time in simulation = 2.4330E+01 seconds\n",
" Time in transport only = 2.4308E+01 seconds\n",
" Time in inactive batches = 2.4220E+00 seconds\n",
" Time in active batches = 2.1908E+01 seconds\n",
" Total time for initialization = 1.1480E+00 seconds\n",
" Reading cross sections = 2.9100E-01 seconds\n",
" Total time in simulation = 2.7345E+01 seconds\n",
" Time in transport only = 2.7286E+01 seconds\n",
" Time in inactive batches = 5.8310E+00 seconds\n",
" Time in active batches = 2.1514E+01 seconds\n",
" Time synchronizing fission bank = 1.0000E-03 seconds\n",
" Sampling source sites = 1.0000E-03 seconds\n",
" SEND/RECV source sites = 0.0000E+00 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 1.0000E-03 seconds\n",
" Total time elapsed = 2.5018E+01 seconds\n",
" Calculation Rate (inactive) = 5161.02 neutrons/second\n",
" Calculation Rate (active) = 1711.70 neutrons/second\n",
" Total time for finalization = 2.0000E-03 seconds\n",
" Total time elapsed = 2.8526E+01 seconds\n",
" Calculation Rate (inactive) = 2143.71 neutrons/second\n",
" Calculation Rate (active) = 1743.05 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
@ -721,20 +721,7 @@
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"ename": "KeyError",
"evalue": "10003",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-25-3cd87b8121ef>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;31m# Load the summary file and link with statepoint\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0msu\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mSummary\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'summary.h5'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0msp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlink_with_summary\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msu\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;32m/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/statepoint.pyc\u001b[0m in \u001b[0;36mlink_with_summary\u001b[1;34m(self, summary)\u001b[0m\n\u001b[0;32m 610\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mtally_id\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtally\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtallies\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 611\u001b[0m \u001b[1;31m# Get the Tally name from the summary file\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 612\u001b[1;33m \u001b[0mtally\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msummary\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtallies\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mtally_id\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 613\u001b[0m \u001b[0mtally\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwith_summary\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 614\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mKeyError\u001b[0m: 10003"
]
}
],
"outputs": [],
"source": [
"# Load the summary file and link with statepoint\n",
"su = Summary('summary.h5')\n",
@ -752,11 +739,47 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.046353</td>\n",
" <td>0.00935</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" nuclide score mean std. dev.\n",
"0 total (nu-fission / absorption) 1.046353 0.00935"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Compute k-infinity using tally arithmetic\n",
"fiss_rate = sp.get_tally(name='fiss. rate')\n",
@ -776,11 +799,49 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>energy [MeV]</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>(0.0e+00 - 6.2e-01)</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.95873</td>\n",
" <td>0.00774</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] nuclide score mean std. dev.\n",
"0 (0.0e+00 - 6.2e-01) total absorption 0.95873 0.00774"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Compute resonance escape probability using tally arithmetic\n",
"therm_abs_rate = sp.get_tally(name='therm. abs. rate')\n",
@ -798,11 +859,47 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>total</td>\n",
" <td>nu-fission</td>\n",
" <td>1.091622</td>\n",
" <td>0.011163</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" nuclide score mean std. dev.\n",
"0 total nu-fission 1.091622 0.011163"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Compute fast fission factor factor using tally arithmetic\n",
"therm_fiss_rate = sp.get_tally(name='therm. fiss. rate')\n",
@ -821,11 +918,51 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>energy [MeV]</th>\n",
" <th>cell</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>(0.0e+00 - 6.2e-01)</td>\n",
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.802012</td>\n",
" <td>0.006609</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] cell nuclide score mean std. dev.\n",
"0 (0.0e+00 - 6.2e-01) 10000 total absorption 0.802012 0.006609"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Compute thermal flux utilization factor using tally arithmetic\n",
"fuel_therm_abs_rate = sp.get_tally(name='fuel therm. abs. rate')\n",
@ -842,11 +979,49 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>energy [MeV]</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>(0.0e+00 - 6.2e-01)</td>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.246604</td>\n",
" <td>0.011825</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] nuclide score mean std. dev.\n",
"0 (0.0e+00 - 6.2e-01) total (nu-fission / absorption) 1.246604 0.011825"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Compute neutrons produced per absorption (eta) using tally arithmetic\n",
"eta = therm_fiss_rate / fuel_therm_abs_rate\n",
@ -862,11 +1037,52 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>energy [MeV]</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>(0.0e+00 - 6.2e-01)</td>\n",
" <td>total</td>\n",
" <td>(((absorption * nu-fission) * absorption) * (n...</td>\n",
" <td>1.046353</td>\n",
" <td>0.01894</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] nuclide \\\n",
"0 (0.0e+00 - 6.2e-01) total \n",
"\n",
" score mean std. dev. \n",
"0 (((absorption * nu-fission) * absorption) * (n... 1.046353 0.01894 "
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"keff = res_esc * fast_fiss * therm_util * eta\n",
"keff.get_pandas_dataframe()"
@ -883,7 +1099,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 32,
"metadata": {
"collapsed": false,
"scrolled": true
@ -899,11 +1115,131 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>cell</th>\n",
" <th>energy [MeV]</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>6.641746e-07</td>\n",
" <td>6.859257e-09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>2.099861e-01</td>\n",
" <td>1.966887e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>3.556665e-01</td>\n",
" <td>3.717881e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>5.554650e-03</td>\n",
" <td>5.218094e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>7.165057e-03</td>\n",
" <td>5.625590e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>2.276535e-01</td>\n",
" <td>8.544314e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>8.089493e-03</td>\n",
" <td>5.080374e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>3.370111e-03</td>\n",
" <td>1.361116e-05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell energy [MeV] nuclide score \\\n",
"0 10000 (0.0e+00 - 6.3e-07) (U-238 / total) (nu-fission / flux) \n",
"1 10000 (0.0e+00 - 6.3e-07) (U-238 / total) (scatter / flux) \n",
"2 10000 (0.0e+00 - 6.3e-07) (U-235 / total) (nu-fission / flux) \n",
"3 10000 (0.0e+00 - 6.3e-07) (U-235 / total) (scatter / flux) \n",
"4 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (nu-fission / flux) \n",
"5 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (scatter / flux) \n",
"6 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (nu-fission / flux) \n",
"7 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (scatter / flux) \n",
"\n",
" mean std. dev. \n",
"0 6.641746e-07 6.859257e-09 \n",
"1 2.099861e-01 1.966887e-03 \n",
"2 3.556665e-01 3.717881e-03 \n",
"3 5.554650e-03 5.218094e-05 \n",
"4 7.165057e-03 5.625590e-05 \n",
"5 2.276535e-01 8.544314e-04 \n",
"6 8.089493e-03 5.080374e-05 \n",
"7 3.370111e-03 1.361116e-05 "
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fuel_xs = fuel_rxn_rates / flux\n",
"fuel_xs.get_pandas_dataframe()"
@ -918,11 +1254,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 6.64174599e-07]\n",
" [ 3.55666541e-01]]\n",
"\n",
" [[ 7.16505734e-03]\n",
" [ 8.08949336e-03]]]\n"
]
}
],
"source": [
"# Show how to use Tally.get_values(...) with a CrossScore\n",
"nu_fiss_xs = fuel_xs.get_values(scores=['(nu-fission / flux)'])\n",
@ -938,11 +1286,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 35,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.00555465]]\n",
"\n",
" [[ 0.00337011]]]\n"
]
}
],
"source": [
"# Show how to use Tally.get_values(...) with a CrossScore and CrossNuclide\n",
"u235_scatter_xs = fuel_xs.get_values(nuclides=['(U-235 / total)'], \n",
@ -952,11 +1310,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.22765348]\n",
" [ 0.00337011]]]\n"
]
}
],
"source": [
"# Show how to use Tally.get_values(...) with a CrossFilter and CrossScore\n",
"fast_scatter_xs = fuel_xs.get_values(filters=['energy'], \n",
@ -974,11 +1341,81 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>cell</th>\n",
" <th>energy [MeV]</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>U-238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000002</td>\n",
" <td>1.284890e-08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>U-235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.867982</td>\n",
" <td>7.022256e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>U-238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.082801</td>\n",
" <td>6.087096e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>U-235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.093484</td>\n",
" <td>5.275039e-04</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell energy [MeV] nuclide score mean std. dev.\n",
"0 10000 (0.0e+00 - 6.3e-07) U-238 nu-fission 0.000002 1.284890e-08\n",
"1 10000 (0.0e+00 - 6.3e-07) U-235 nu-fission 0.867982 7.022256e-03\n",
"2 10000 (6.3e-07 - 2.0e+01) U-238 nu-fission 0.082801 6.087096e-04\n",
"3 10000 (6.3e-07 - 2.0e+01) U-235 nu-fission 0.093484 5.275039e-04"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# \"Slice\" the nu-fission data into a new derived Tally\n",
"nu_fission_rates = fuel_rxn_rates.get_slice(scores=['nu-fission'])\n",
@ -987,11 +1424,131 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>cell</th>\n",
" <th>energy [MeV]</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10002</td>\n",
" <td>(1.0e-08 - 1.1e-07)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>4.620525</td>\n",
" <td>0.038249</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10002</td>\n",
" <td>(1.1e-07 - 1.2e-06)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.036841</td>\n",
" <td>0.013203</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10002</td>\n",
" <td>(1.2e-06 - 1.3e-05)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.659916</td>\n",
" <td>0.010107</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10002</td>\n",
" <td>(1.3e-05 - 1.4e-04)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.861546</td>\n",
" <td>0.013328</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10002</td>\n",
" <td>(1.4e-04 - 1.5e-03)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.049664</td>\n",
" <td>0.008215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10002</td>\n",
" <td>(1.5e-03 - 1.6e-02)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.162157</td>\n",
" <td>0.010245</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10002</td>\n",
" <td>(1.6e-02 - 1.7e-01)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.224496</td>\n",
" <td>0.013796</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10002</td>\n",
" <td>(1.7e-01 - 1.9e+00)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.997585</td>\n",
" <td>0.009161</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>10002</td>\n",
" <td>(1.9e+00 - 2.0e+01)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>0.373472</td>\n",
" <td>0.003922</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell energy [MeV] nuclide score mean std. dev.\n",
"0 10002 (1.0e-08 - 1.1e-07) H-1 scatter 4.620525 0.038249\n",
"1 10002 (1.1e-07 - 1.2e-06) H-1 scatter 2.036841 0.013203\n",
"2 10002 (1.2e-06 - 1.3e-05) H-1 scatter 1.659916 0.010107\n",
"3 10002 (1.3e-05 - 1.4e-04) H-1 scatter 1.861546 0.013328\n",
"4 10002 (1.4e-04 - 1.5e-03) H-1 scatter 2.049664 0.008215\n",
"5 10002 (1.5e-03 - 1.6e-02) H-1 scatter 2.162157 0.010245\n",
"6 10002 (1.6e-02 - 1.7e-01) H-1 scatter 2.224496 0.013796\n",
"7 10002 (1.7e-01 - 1.9e+00) H-1 scatter 1.997585 0.009161\n",
"8 10002 (1.9e+00 - 2.0e+01) H-1 scatter 0.373472 0.003922"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# \"Slice\" the H-1 scatter data in the moderator Cell into a new derived Tally\n",
"need_to_slice = sp.get_tally(name='need-to-slice')\n",

View file

@ -1119,14 +1119,22 @@ class MultiGroupXS(object):
class TotalXS(MultiGroupXS):
"""A total multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(TotalXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(TotalXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'total'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two tracklength tallies to compute the 'flux'
and 'total' reaction rates in the spatial domain and energy groups
of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'total']
@ -1143,21 +1151,30 @@ class TotalXS(MultiGroupXS):
def compute_xs(self):
"""Computes the multi-group total cross sections using OpenMC
tally arithmetic."""
tally arithmetic.
"""
self._xs_tally = self.tallies['total'] / self.tallies['flux']
super(TotalXS, self).compute_xs()
class TransportXS(MultiGroupXS):
"""A transport-corrected total multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(TransportXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(TransportXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'transport'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs three analog tallies to compute the 'flux',
'total' and 'scatter-P1' reaction rates in the spatial domain and
energy groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'total', 'scatter-P1']
@ -1171,10 +1188,35 @@ class TransportXS(MultiGroupXS):
filters = [[energy_filter], [energy_filter], [energyout_filter]]
# Initialize the Tallies
super(TransportXS, self).create_tallies(scores, filters, keys, estimator)
super(TransportXS, self).create_tallies(scores, filters,
keys, estimator)
def load_from_statepoint(self, statepoint):
"""Extracts tallies in an OpenMC StatePoint with the data needed to
compute multi-group cross sections.
This method is needed to compute cross section data from tallies
in an OpenMC StatePoint object.
NOTE: The statepoint must first be linked with an OpenMC Summary object.
Parameters
----------
statepoint : openmc.StatePoint
An OpenMC StatePoint object with tally data
Raises
------
ValueError
When this method is called with a statepoint that has not been
linked with a summary object.
"""
# Load the tallies from the statepoint using the parent class method
super(TransportXS, self).load_from_statepoint(statepoint)
# Use tally slicing to remove scatter-P0 data from scatter-P1 tally
scatter_p1 = self.tallies['scatter-P1']
self.tallies['scatter-P1'] = scatter_p1.get_slice(scores=['scatter-P1'])
self.tallies['scatter-P1'].filters[-1].type = 'energy'
@ -1189,14 +1231,22 @@ class TransportXS(MultiGroupXS):
class AbsorptionXS(MultiGroupXS):
"""An absorption multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(AbsorptionXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(AbsorptionXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'absorption'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two tracklength tallies to compute the 'flux'
and 'absorption' reaction rates in the spatial domain and energy
groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'absorption']
@ -1209,7 +1259,8 @@ class AbsorptionXS(MultiGroupXS):
filters = [[energy_filter], [energy_filter]]
# Initialize the Tallies
super(AbsorptionXS, self).create_tallies(scores, filters, keys, estimator)
super(AbsorptionXS, self).create_tallies(scores, filters,
keys, estimator)
def compute_xs(self):
"""Computes the multi-group absorption cross sections using OpenMC
@ -1220,14 +1271,22 @@ class AbsorptionXS(MultiGroupXS):
class CaptureXS(MultiGroupXS):
"""A capture multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(CaptureXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(CaptureXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'capture'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two tracklength tallies to compute the 'flux'
and 'capture' reaction rates in the spatial domain and energy
groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'absorption', 'fission']
@ -1252,14 +1311,22 @@ class CaptureXS(MultiGroupXS):
class FissionXS(MultiGroupXS):
"""A fission multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(FissionXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(FissionXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'fission'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two tracklength tallies to compute the 'flux'
and 'fission' reaction rates in the spatial domain and energy
groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'fission']
@ -1283,14 +1350,22 @@ class FissionXS(MultiGroupXS):
class NuFissionXS(MultiGroupXS):
"""A fission production multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(NuFissionXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(NuFissionXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'nu-fission'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two tracklength tallies to compute the 'flux'
and 'nu-fission' reaction rates in the spatial domain and energy
groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'nu-fission']
@ -1303,7 +1378,8 @@ class NuFissionXS(MultiGroupXS):
filters = [[energy_filter], [energy_filter]]
# Initialize the Tallies
super(NuFissionXS, self).create_tallies(scores, filters, keys, estimator)
super(NuFissionXS, self).create_tallies(scores, filters,
keys, estimator)
def compute_xs(self):
"""Computes the multi-group nu-fission cross sections using OpenMC
@ -1314,14 +1390,22 @@ class NuFissionXS(MultiGroupXS):
class ScatterXS(MultiGroupXS):
"""A scatter multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(ScatterXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(ScatterXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'scatter'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two tracklength tallies to compute the 'flux'
and 'scatter' reaction rates in the spatial domain and energy
groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'scatter']
@ -1345,14 +1429,22 @@ class ScatterXS(MultiGroupXS):
class NuScatterXS(MultiGroupXS):
"""A nu-scatter multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(NuScatterXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(NuScatterXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'nu-scatter'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two analog tallies to compute the 'flux'
and 'nu-scatter' reaction rates in the spatial domain and energy
groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'nu-scatter']
@ -1365,7 +1457,8 @@ class NuScatterXS(MultiGroupXS):
filters = [[energy_filter], [energy_filter]]
# Initialize the Tallies
super(NuScatterXS, self).create_tallies(scores, filters, keys, estimator)
super(NuScatterXS, self).create_tallies(scores, filters,
keys, estimator)
def compute_xs(self):
"""Computes the nu-scattering multi-group cross section using OpenMC
@ -1376,14 +1469,22 @@ class NuScatterXS(MultiGroupXS):
class ScatterMatrixXS(MultiGroupXS):
"""A scattering matrix multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(ScatterMatrixXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(ScatterMatrixXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'scatter matrix'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs three analog tallies to compute the 'flux',
'scatter' and 'scatter-P1' reaction rates in the spatial domain and
energy groups of interest.
"""
group_edges = self.energy_groups.group_edges
energy = openmc.Filter('energy', group_edges)
@ -1397,7 +1498,8 @@ class ScatterMatrixXS(MultiGroupXS):
keys = scores
# Initialize the Tallies
super(ScatterMatrixXS, self).create_tallies(scores, filters, keys, estimator)
super(ScatterMatrixXS, self).create_tallies(scores, filters,
keys, estimator)
def compute_xs(self, correction='P0'):
"""Computes the multi-group scattering matrix using OpenMC
@ -1425,9 +1527,9 @@ class ScatterMatrixXS(MultiGroupXS):
self._xs_tally = rxn_tally / self.tallies['flux']
super(ScatterMatrixXS, self).compute_xs()
def get_xs(self, in_groups='all', out_groups='all', subdomains='all',
nuclides='all', order_groups='increasing',
xs_type='macro', value='mean'):
def get_xs(self, in_groups='all', out_groups='all',
subdomains='all', nuclides='all', xs_type='macro',
order_groups='increasing', value='mean'):
"""Returns an array of multi-group cross sections.
This method constructs a 2D NumPy array for the requested scattering
@ -1448,15 +1550,16 @@ class ScatterMatrixXS(MultiGroupXS):
return the cross section summed over all nuclides.
xs_type: {'macro' or 'micro'}
Return the macro or micro cross section in units of cm^-1 or barns
xs_type: {'macro' or 'micro'}
Return the macro or micro cross section in units of cm^-1 or barns
order_groups: {'increasing', 'decreasing'}
Return the cross section indexed according to increasing (default)
or decreasing energy groups (decreasing or increasing energies)
value : str
A string for the type of value to return - 'mean' (default),
'std_dev' or 'rel_err' are accepted
Returns
-------
xs : ndarray
ndarray
A NumPy array of the multi-group cross section indexed in the order
each group and subdomain is listed in the parameters.
@ -1500,8 +1603,6 @@ class ScatterMatrixXS(MultiGroupXS):
filter_bins.append((self.energy_groups.get_group_bounds(group),))
# Construct a collection of the nuclides to retrieve from the xs tally
# NOTE: We must not override the "nuclides" parameter since it is used
# to retrieve atomic number densities for micro xs
if self.by_nuclide:
if nuclides == 'all' or nuclides == 'sum' or nuclides == ['sum']:
query_nuclides = self.get_all_nuclides()
@ -1516,8 +1617,9 @@ class ScatterMatrixXS(MultiGroupXS):
xs = xs_tally.get_values(filters=filters,
filter_bins=filter_bins, value=value)
else:
xs = self.xs_tally.get_values(filters=filters, filter_bins=filter_bins,
nuclides=query_nuclides, value=value)
xs = self.xs_tally.get_values(filters=filters,
filter_bins=filter_bins,
nuclides=query_nuclides, value=value)
xs = np.nan_to_num(xs)
@ -1533,7 +1635,6 @@ class ScatterMatrixXS(MultiGroupXS):
# 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 in_groups == 'all':
num_in_groups = self.num_groups
else:
@ -1542,6 +1643,8 @@ class ScatterMatrixXS(MultiGroupXS):
num_out_groups = self.num_groups
else:
num_out_groups = len(out_groups)
# Reshape tally data array with separate axes for domain and energy
num_subdomains = xs.shape[0] / (num_in_groups * num_out_groups)
new_shape = (num_subdomains, num_in_groups, num_out_groups)
new_shape += xs.shape[1:]
@ -1648,13 +1751,15 @@ class ScatterMatrixXS(MultiGroupXS):
for out_group in range(1, self.num_groups+1):
string += template.format('', in_group, out_group)
average = \
self.get_xs([in_group], [out_group], [subdomain],
[nuclide], xs_type=xs_type, value='mean')
self.get_xs([in_group], [out_group],
[subdomain], [nuclide],
xs_type=xs_type, value='mean')
rel_err = \
self.get_xs([in_group], [out_group], [subdomain],
[nuclide], xs_type=xs_type, value='rel_err') * 100
average = np.nan_to_num(average.flatten())[0]
rel_err = np.nan_to_num(rel_err.flatten())[0]
self.get_xs([in_group], [out_group],
[subdomain], [nuclide],
xs_type=xs_type, value='rel_err')
average = average.flatten()[0]
rel_err = rel_err.flatten()[0] * 100.
string += '{:1.2e} +/- {:1.2e}%'.format(average, rel_err)
string += '\n'
string += '\n'
@ -1665,14 +1770,22 @@ class ScatterMatrixXS(MultiGroupXS):
class NuScatterMatrixXS(ScatterMatrixXS):
"""A scattering production matrix multi-group cross section."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
super(NuScatterMatrixXS, self).__init__(domain, domain_type, groups, by_nuclide, name)
super(NuScatterMatrixXS, self).__init__(domain, domain_type,
groups, by_nuclide, name)
self._rxn_type = 'nu-scatter matrix'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs three analog tallies to compute the 'flux',
'nu-scatter' and 'scatter-P1' reaction rates in the spatial domain and
energy groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['flux', 'scatter', 'scatter-P1']
@ -1686,9 +1799,11 @@ class NuScatterMatrixXS(ScatterMatrixXS):
filters = [[energy], [energy, energyout], [energyout]]
# Intialize the Tallies
super(ScatterMatrixXS, self).create_tallies(scores, filters, keys, estimator)
super(ScatterMatrixXS, self).create_tallies(scores, filters,
keys, estimator)
class Chi(MultiGroupXS):
"""The fission spectrum."""
def __init__(self, domain=None, domain_type=None,
groups=None, by_nuclide=False, name=''):
@ -1696,7 +1811,13 @@ class Chi(MultiGroupXS):
self._rxn_type = 'chi'
def create_tallies(self):
"""Construct the OpenMC tallies needed to compute this cross section."""
"""Construct the OpenMC tallies needed to compute this cross section.
This method constructs two analog tallies to compute 'nu-fission'
reaction rates with 'energy' and 'energyout' filters in the spatial
domain and energy groups of interest.
"""
# Create a list of scores for each Tally to be created
scores = ['nu-fission', 'nu-fission']
@ -1732,8 +1853,8 @@ class Chi(MultiGroupXS):
super(Chi, self).compute_xs()
def get_xs(self, groups='all', subdomains='all', nuclides='all',
order_groups='increasing', xs_type='macro', value='mean'):
"""Returns an array of multi-group cross sections.
xs_type='macro', order_groups='increasing', value='mean'):
"""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.
@ -1749,18 +1870,19 @@ class Chi(MultiGroupXS):
special string 'all' (default) 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.
xs_type: {'macro' or 'micro'}
Return the macro or micro cross section in units of cm^-1 or barns
xs_type: {'macro' or 'micro'}
This parameter is not relevant for chi but is included here to
mirror the parent MultiGroupXS.get_xs(...) class method
order_groups: {'increasing', 'decreasing'}
Return the cross section indexed according to increasing (default)
or decreasing energy groups (decreasing or increasing energies)
value : str
A string for the type of value to return - 'mean' (default),
'std_dev' or 'rel_err' are accepted
Returns
-------
xs : ndarray
ndarray
A NumPy array of the multi-group cross section indexed in the order
each group, subdomain and nuclide is listed in the parameters.
@ -1812,8 +1934,8 @@ class Chi(MultiGroupXS):
nu_fission_in = nu_fission_in.summation(nuclides=nuclides)
nu_fission_out = nu_fission_out.summation(nuclides=nuclides)
# Compute chi and store it as the xs_tally attribute so we can use
# the generic get_xs(...) method
# 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
xs = xs_tally.get_values(filters=filters,
filter_bins=filter_bins, value=value)
@ -1821,13 +1943,15 @@ class Chi(MultiGroupXS):
# 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,
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,
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