Merge pull request #918 from paulromano/arithmetic-units

Improve handling of units on division for tally arithmetic
This commit is contained in:
Sterling Harper 2017-10-26 22:37:06 -04:00 committed by GitHub
commit 8047f6c134
4 changed files with 326 additions and 189 deletions

View file

@ -11,7 +11,7 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -19,7 +19,6 @@
"\n",
"from IPython.display import Image\n",
"import numpy as np\n",
"\n",
"import openmc"
]
},
@ -65,7 +64,7 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -100,7 +99,7 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -122,7 +121,7 @@
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -151,7 +150,7 @@
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -188,7 +187,7 @@
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -215,7 +214,7 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -228,7 +227,7 @@
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -283,7 +282,7 @@
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -310,9 +309,7 @@
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -333,13 +330,11 @@
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6Ag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sH6Ctv7n8PTzj\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMTAtMjRUMTM6MzU6\nMTktMDU6MDCdcfAWAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTEwLTI0VDEzOjM1OjE5LTA1OjAw\n7CxIqgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
@ -368,7 +363,7 @@
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -380,7 +375,7 @@
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -457,7 +452,7 @@
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -472,7 +467,7 @@
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [],
"source": [
@ -522,10 +517,25 @@
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [],
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=1.\n",
" warn(msg, IDWarning)\n",
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another MeshFilter instance already exists with id=5.\n",
" warn(msg, IDWarning)\n",
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another EnergyFilter instance already exists with id=6.\n",
" warn(msg, IDWarning)\n",
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=3.\n",
" warn(msg, IDWarning)\n",
"/home/romano/openmc/openmc/mixin.py:61: IDWarning: Another CellFilter instance already exists with id=2.\n",
" warn(msg, IDWarning)\n"
]
}
],
"source": [
"# Export to \"tallies.xml\"\n",
"tallies_file.export_to_xml()"
@ -542,7 +552,6 @@
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
@ -578,25 +587,24 @@
" | 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 | bc4683be1c853fe6d0e31bccad416ef219e3efaf\n",
" Date/Time | 2017-04-13 17:26:05\n",
" MPI Processes | 1\n",
" OpenMP Threads | 1\n",
" Version | 0.9.0\n",
" Git SHA1 | 5ca1d06b0c6ac3b56060ef289b7e5215210e7332\n",
" Date/Time | 2017-10-24 13:35:19\n",
" OpenMP Threads | 4\n",
"\n",
" Reading settings XML file...\n",
" Reading geometry XML file...\n",
" Reading materials XML file...\n",
" Reading cross sections XML file...\n",
" Reading U235 from /home/smharper/openmc/data/nndc_hdf5/U235.h5\n",
" Reading U238 from /home/smharper/openmc/data/nndc_hdf5/U238.h5\n",
" Reading O16 from /home/smharper/openmc/data/nndc_hdf5/O16.h5\n",
" Reading H1 from /home/smharper/openmc/data/nndc_hdf5/H1.h5\n",
" Reading B10 from /home/smharper/openmc/data/nndc_hdf5/B10.h5\n",
" Reading Zr90 from /home/smharper/openmc/data/nndc_hdf5/Zr90.h5\n",
" Reading geometry XML file...\n",
" Building neighboring cells lists for each surface...\n",
" Reading U235 from /home/romano/openmc/scripts/nndc_hdf5/U235.h5\n",
" Reading U238 from /home/romano/openmc/scripts/nndc_hdf5/U238.h5\n",
" Reading O16 from /home/romano/openmc/scripts/nndc_hdf5/O16.h5\n",
" Reading H1 from /home/romano/openmc/scripts/nndc_hdf5/H1.h5\n",
" Reading B10 from /home/romano/openmc/scripts/nndc_hdf5/B10.h5\n",
" Reading Zr90 from /home/romano/openmc/scripts/nndc_hdf5/Zr90.h5\n",
" Maximum neutron transport energy: 2.00000E+07 eV for U235\n",
" Reading tallies XML file...\n",
" Building neighboring cells lists for each surface...\n",
" Initializing source particles...\n",
"\n",
" ====================> K EIGENVALUE SIMULATION <====================\n",
@ -627,20 +635,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 2.2576E-01 seconds\n",
" Reading cross sections = 1.8005E-01 seconds\n",
" Total time in simulation = 9.6105E+00 seconds\n",
" Time in transport only = 9.5952E+00 seconds\n",
" Time in inactive batches = 1.4678E+00 seconds\n",
" Time in active batches = 8.1427E+00 seconds\n",
" Time synchronizing fission bank = 2.6325E-03 seconds\n",
" Sampling source sites = 1.5038E-03 seconds\n",
" SEND/RECV source sites = 8.8069E-04 seconds\n",
" Time accumulating tallies = 2.0568E-04 seconds\n",
" Total time for finalization = 1.5435E-03 seconds\n",
" Total time elapsed = 9.8506E+00 seconds\n",
" Calculation Rate (inactive) = 8516.30 neutrons/second\n",
" Calculation Rate (active) = 4605.35 neutrons/second\n",
" Total time for initialization = 4.1497E-01 seconds\n",
" Reading cross sections = 3.6232E-01 seconds\n",
" Total time in simulation = 3.6447E+00 seconds\n",
" Time in transport only = 3.5939E+00 seconds\n",
" Time in inactive batches = 4.4241E-01 seconds\n",
" Time in active batches = 3.2022E+00 seconds\n",
" Time synchronizing fission bank = 2.7734E-03 seconds\n",
" Sampling source sites = 1.1981E-03 seconds\n",
" SEND/RECV source sites = 1.5506E-03 seconds\n",
" Time accumulating tallies = 1.2237E-04 seconds\n",
" Total time for finalization = 1.4924E-03 seconds\n",
" Total time elapsed = 4.0823E+00 seconds\n",
" Calculation Rate (inactive) = 28254.0 neutrons/second\n",
" Calculation Rate (active) = 11710.5 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
@ -689,7 +697,7 @@
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false,
"collapsed": true,
"scrolled": true
},
"outputs": [],
@ -710,14 +718,25 @@
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -777,14 +796,25 @@
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -803,7 +833,7 @@
" <td>0.0</td>\n",
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>(absorption + current)</td>\n",
" <td>((absorption + current) / (absorption + current))</td>\n",
" <td>0.694368</td>\n",
" <td>0.004606</td>\n",
" </tr>\n",
@ -812,11 +842,11 @@
"</div>"
],
"text/plain": [
" energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 0.00e+00 6.25e-01 total (absorption + current) 6.94e-01 \n",
" energy low [eV] energy high [eV] nuclide \\\n",
"0 0.00e+00 6.25e-01 total \n",
"\n",
" std. dev. \n",
"0 4.61e-03 "
" score mean std. dev. \n",
"0 ((absorption + current) / (absorption + current)) 6.94e-01 4.61e-03 "
]
},
"execution_count": 25,
@ -845,14 +875,25 @@
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -871,7 +912,7 @@
" <td>0.0</td>\n",
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>nu-fission</td>\n",
" <td>(nu-fission / nu-fission)</td>\n",
" <td>1.203099</td>\n",
" <td>0.009615</td>\n",
" </tr>\n",
@ -880,8 +921,11 @@
"</div>"
],
"text/plain": [
" energy low [eV] energy high [eV] nuclide score mean std. dev.\n",
"0 0.00e+00 6.25e-01 total nu-fission 1.20e+00 9.61e-03"
" energy low [eV] energy high [eV] nuclide score \\\n",
"0 0.00e+00 6.25e-01 total (nu-fission / nu-fission) \n",
"\n",
" mean std. dev. \n",
"0 1.20e+00 9.61e-03 "
]
},
"execution_count": 26,
@ -908,14 +952,25 @@
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -934,9 +989,9 @@
" <th>0</th>\n",
" <td>0.0</td>\n",
" <td>0.625</td>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>(absorption / absorption)</td>\n",
" <td>0.749423</td>\n",
" <td>0.006089</td>\n",
" </tr>\n",
@ -945,11 +1000,11 @@
"</div>"
],
"text/plain": [
" energy low [eV] energy high [eV] cell nuclide score mean \\\n",
"0 0.00e+00 6.25e-01 10000 total absorption 7.49e-01 \n",
" energy low [eV] energy high [eV] cell nuclide score \\\n",
"0 0.00e+00 6.25e-01 1 total (absorption / absorption) \n",
"\n",
" std. dev. \n",
"0 6.09e-03 "
" mean std. dev. \n",
"0 7.49e-01 6.09e-03 "
]
},
"execution_count": 27,
@ -974,14 +1029,25 @@
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1000,7 +1066,7 @@
" <th>0</th>\n",
" <td>0.0</td>\n",
" <td>0.625</td>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.663727</td>\n",
@ -1011,11 +1077,11 @@
"</div>"
],
"text/plain": [
" energy low [eV] energy high [eV] cell nuclide \\\n",
"0 0.00e+00 6.25e-01 10000 total \n",
" energy low [eV] energy high [eV] cell nuclide score \\\n",
"0 0.00e+00 6.25e-01 1 total (nu-fission / absorption) \n",
"\n",
" score mean std. dev. \n",
"0 (nu-fission / absorption) 1.66e+00 1.44e-02 "
" mean std. dev. \n",
"0 1.66e+00 1.44e-02 "
]
},
"execution_count": 28,
@ -1039,14 +1105,25 @@
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1065,7 +1142,7 @@
" <td>0.0</td>\n",
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>(absorption + current)</td>\n",
" <td>((absorption + current) / (absorption + current))</td>\n",
" <td>0.984668</td>\n",
" <td>0.005509</td>\n",
" </tr>\n",
@ -1074,11 +1151,11 @@
"</div>"
],
"text/plain": [
" energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 0.00e+00 6.25e-01 total (absorption + current) 9.85e-01 \n",
" energy low [eV] energy high [eV] nuclide \\\n",
"0 0.00e+00 6.25e-01 total \n",
"\n",
" std. dev. \n",
"0 5.51e-03 "
" score mean std. dev. \n",
"0 ((absorption + current) / (absorption + current)) 9.85e-01 5.51e-03 "
]
},
"execution_count": 29,
@ -1101,14 +1178,25 @@
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1163,14 +1251,25 @@
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1189,9 +1288,9 @@
" <th>0</th>\n",
" <td>0.0</td>\n",
" <td>0.625</td>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>total</td>\n",
" <td>((((((absorption + current) * nu-fission) * ab...</td>\n",
" <td>(((((((absorption + current) / (absorption + c...</td>\n",
" <td>1.023002</td>\n",
" <td>0.018791</td>\n",
" </tr>\n",
@ -1200,11 +1299,11 @@
"</div>"
],
"text/plain": [
" energy low [eV] energy high [eV] cell nuclide \\\n",
"0 0.00e+00 6.25e-01 10000 total \n",
" energy low [eV] energy high [eV] cell nuclide \\\n",
"0 0.00e+00 6.25e-01 1 total \n",
"\n",
" score mean std. dev. \n",
"0 ((((((absorption + current) * nu-fission) * ab... 1.02e+00 1.88e-02 "
"0 (((((((absorption + current) / (absorption + c... 1.02e+00 1.88e-02 "
]
},
"execution_count": 31,
@ -1230,7 +1329,7 @@
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false,
"collapsed": true,
"scrolled": true
},
"outputs": [],
@ -1245,14 +1344,25 @@
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1269,7 +1379,7 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.000</td>\n",
" <td>6.250000e-01</td>\n",
" <td>(U238 / total)</td>\n",
@ -1279,7 +1389,7 @@
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.000</td>\n",
" <td>6.250000e-01</td>\n",
" <td>(U238 / total)</td>\n",
@ -1289,7 +1399,7 @@
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.000</td>\n",
" <td>6.250000e-01</td>\n",
" <td>(U235 / total)</td>\n",
@ -1299,7 +1409,7 @@
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.000</td>\n",
" <td>6.250000e-01</td>\n",
" <td>(U235 / total)</td>\n",
@ -1309,7 +1419,7 @@
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.625</td>\n",
" <td>2.000000e+07</td>\n",
" <td>(U238 / total)</td>\n",
@ -1319,7 +1429,7 @@
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.625</td>\n",
" <td>2.000000e+07</td>\n",
" <td>(U238 / total)</td>\n",
@ -1329,7 +1439,7 @@
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.625</td>\n",
" <td>2.000000e+07</td>\n",
" <td>(U235 / total)</td>\n",
@ -1339,7 +1449,7 @@
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.625</td>\n",
" <td>2.000000e+07</td>\n",
" <td>(U235 / total)</td>\n",
@ -1352,15 +1462,15 @@
"</div>"
],
"text/plain": [
" cell energy low [eV] energy high [eV] nuclide \\\n",
"0 10000 0.00e+00 6.25e-01 (U238 / total) \n",
"1 10000 0.00e+00 6.25e-01 (U238 / total) \n",
"2 10000 0.00e+00 6.25e-01 (U235 / total) \n",
"3 10000 0.00e+00 6.25e-01 (U235 / total) \n",
"4 10000 6.25e-01 2.00e+07 (U238 / total) \n",
"5 10000 6.25e-01 2.00e+07 (U238 / total) \n",
"6 10000 6.25e-01 2.00e+07 (U235 / total) \n",
"7 10000 6.25e-01 2.00e+07 (U235 / total) \n",
" cell energy low [eV] energy high [eV] nuclide \\\n",
"0 1 0.00e+00 6.25e-01 (U238 / total) \n",
"1 1 0.00e+00 6.25e-01 (U238 / total) \n",
"2 1 0.00e+00 6.25e-01 (U235 / total) \n",
"3 1 0.00e+00 6.25e-01 (U235 / total) \n",
"4 1 6.25e-01 2.00e+07 (U238 / total) \n",
"5 1 6.25e-01 2.00e+07 (U238 / total) \n",
"6 1 6.25e-01 2.00e+07 (U235 / total) \n",
"7 1 6.25e-01 2.00e+07 (U235 / total) \n",
"\n",
" score mean std. dev. \n",
"0 (nu-fission / flux) 6.66e-07 5.63e-09 \n",
@ -1393,9 +1503,7 @@
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@ -1425,9 +1533,7 @@
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@ -1449,9 +1555,7 @@
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@ -1480,14 +1584,25 @@
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1504,7 +1619,7 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.000</td>\n",
" <td>6.250000e-01</td>\n",
" <td>U238</td>\n",
@ -1514,7 +1629,7 @@
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.000</td>\n",
" <td>6.250000e-01</td>\n",
" <td>U235</td>\n",
@ -1524,7 +1639,7 @@
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.625</td>\n",
" <td>2.000000e+07</td>\n",
" <td>U238</td>\n",
@ -1534,7 +1649,7 @@
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>0.625</td>\n",
" <td>2.000000e+07</td>\n",
" <td>U235</td>\n",
@ -1547,11 +1662,11 @@
"</div>"
],
"text/plain": [
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 10000 0.00e+00 6.25e-01 U238 nu-fission 1.60e-06 \n",
"1 10000 0.00e+00 6.25e-01 U235 nu-fission 8.55e-01 \n",
"2 10000 6.25e-01 2.00e+07 U238 nu-fission 8.30e-02 \n",
"3 10000 6.25e-01 2.00e+07 U235 nu-fission 9.06e-02 \n",
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 1 0.00e+00 6.25e-01 U238 nu-fission 1.60e-06 \n",
"1 1 0.00e+00 6.25e-01 U235 nu-fission 8.55e-01 \n",
"2 1 6.25e-01 2.00e+07 U238 nu-fission 8.30e-02 \n",
"3 1 6.25e-01 2.00e+07 U235 nu-fission 9.06e-02 \n",
"\n",
" std. dev. \n",
"0 9.68e-09 \n",
@ -1574,14 +1689,25 @@
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
@ -1598,7 +1724,7 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.000000e-02</td>\n",
" <td>1.080060e-01</td>\n",
" <td>H1</td>\n",
@ -1608,7 +1734,7 @@
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.080060e-01</td>\n",
" <td>1.166529e+00</td>\n",
" <td>H1</td>\n",
@ -1618,7 +1744,7 @@
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.166529e+00</td>\n",
" <td>1.259921e+01</td>\n",
" <td>H1</td>\n",
@ -1628,7 +1754,7 @@
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.259921e+01</td>\n",
" <td>1.360790e+02</td>\n",
" <td>H1</td>\n",
@ -1638,7 +1764,7 @@
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.360790e+02</td>\n",
" <td>1.469734e+03</td>\n",
" <td>H1</td>\n",
@ -1648,7 +1774,7 @@
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.469734e+03</td>\n",
" <td>1.587401e+04</td>\n",
" <td>H1</td>\n",
@ -1658,7 +1784,7 @@
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.587401e+04</td>\n",
" <td>1.714488e+05</td>\n",
" <td>H1</td>\n",
@ -1668,7 +1794,7 @@
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.714488e+05</td>\n",
" <td>1.851749e+06</td>\n",
" <td>H1</td>\n",
@ -1678,7 +1804,7 @@
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>10002</td>\n",
" <td>3</td>\n",
" <td>1.851749e+06</td>\n",
" <td>2.000000e+07</td>\n",
" <td>H1</td>\n",
@ -1691,16 +1817,16 @@
"</div>"
],
"text/plain": [
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 10002 1.00e-02 1.08e-01 H1 scatter 4.54e+00 \n",
"1 10002 1.08e-01 1.17e+00 H1 scatter 2.00e+00 \n",
"2 10002 1.17e+00 1.26e+01 H1 scatter 1.64e+00 \n",
"3 10002 1.26e+01 1.36e+02 H1 scatter 1.82e+00 \n",
"4 10002 1.36e+02 1.47e+03 H1 scatter 2.03e+00 \n",
"5 10002 1.47e+03 1.59e+04 H1 scatter 2.12e+00 \n",
"6 10002 1.59e+04 1.71e+05 H1 scatter 2.18e+00 \n",
"7 10002 1.71e+05 1.85e+06 H1 scatter 2.01e+00 \n",
"8 10002 1.85e+06 2.00e+07 H1 scatter 3.73e-01 \n",
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 3 1.00e-02 1.08e-01 H1 scatter 4.54e+00 \n",
"1 3 1.08e-01 1.17e+00 H1 scatter 2.00e+00 \n",
"2 3 1.17e+00 1.26e+01 H1 scatter 1.64e+00 \n",
"3 3 1.26e+01 1.36e+02 H1 scatter 1.82e+00 \n",
"4 3 1.36e+02 1.47e+03 H1 scatter 2.03e+00 \n",
"5 3 1.47e+03 1.59e+04 H1 scatter 2.12e+00 \n",
"6 3 1.59e+04 1.71e+05 H1 scatter 2.18e+00 \n",
"7 3 1.71e+05 1.85e+06 H1 scatter 2.01e+00 \n",
"8 3 1.85e+06 2.00e+07 H1 scatter 3.73e-01 \n",
"\n",
" std. dev. \n",
"0 2.52e-02 \n",
@ -1744,9 +1870,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}

View file

@ -4,7 +4,7 @@ from collections import Iterable, MutableSequence
import copy
import re
from functools import partial
import itertools
from itertools import product
from numbers import Integral, Real
import warnings
from xml.etree import ElementTree as ET
@ -1329,7 +1329,7 @@ class Tally(IDManagerMixin):
if isinstance(self_filter, openmc.MeshFilter):
dimension = self_filter.mesh.dimension
xyz = [range(1, x+1) for x in dimension]
bins = list(itertools.product(*xyz))
bins = list(product(*xyz))
# Create list of 2-tuples for energy boundary bins
elif isinstance(self_filter, (openmc.EnergyFilter,
@ -1364,7 +1364,7 @@ class Tally(IDManagerMixin):
indices *= self_filter.num_bins
# Apply outer product sum between all filter bin indices
filter_indices = list(map(sum, itertools.product(*filter_indices)))
filter_indices = list(map(sum, product(*filter_indices)))
# If user did not specify any specific Filters, use them all
else:
@ -1880,7 +1880,7 @@ class Tally(IDManagerMixin):
new_tally.filters.append(self_filter)
else:
all_filters = [self_copy.filters, other_copy.filters]
for self_filter, other_filter in itertools.product(*all_filters):
for self_filter, other_filter in product(*all_filters):
new_filter = openmc.CrossFilter(self_filter, other_filter,
binary_op)
new_tally.filters.append(new_filter)
@ -1891,20 +1891,31 @@ class Tally(IDManagerMixin):
new_tally.nuclides.append(self_nuclide)
else:
all_nuclides = [self_copy.nuclides, other_copy.nuclides]
for self_nuclide, other_nuclide in itertools.product(*all_nuclides):
new_nuclide = \
openmc.CrossNuclide(self_nuclide, other_nuclide, binary_op)
for self_nuclide, other_nuclide in product(*all_nuclides):
new_nuclide = openmc.CrossNuclide(self_nuclide, other_nuclide,
binary_op)
new_tally.nuclides.append(new_nuclide)
# Define helper function that handles score units appropriately
# depending on the binary operator
def cross_score(score1, score2, binary_op):
if binary_op == '+' or binary_op == '-':
if score1 == score2:
return score1
else:
return openmc.CrossScore(score1, score2, binary_op)
else:
return openmc.CrossScore(score1, score2, binary_op)
# Add scores to the new tally
if score_product == 'entrywise':
for self_score in self_copy.scores:
new_tally.scores.append(self_score)
new_score = cross_score(self_score, self_score, binary_op)
new_tally.scores.append(new_score)
else:
all_scores = [self_copy.scores, other_copy.scores]
for self_score, other_score in itertools.product(*all_scores):
new_score = openmc.CrossScore(self_score, other_score,
binary_op)
for self_score, other_score in product(*all_scores):
new_score = cross_score(self_score, other_score, binary_op)
new_tally.scores.append(new_score)
# Update the new tally's filter strides
@ -2142,7 +2153,7 @@ class Tally(IDManagerMixin):
std_dev = {}
# Store the data from the misaligned structure
for i, (bin1, bin2) in enumerate(itertools.product(filter1_bins, filter2_bins)):
for i, (bin1, bin2) in enumerate(product(filter1_bins, filter2_bins)):
filter_bins = [(bin1,), (bin2,)]
if self.mean is not None:
@ -2163,7 +2174,7 @@ class Tally(IDManagerMixin):
self._update_filter_strides()
# Realign the data
for i, (bin1, bin2) in enumerate(itertools.product(filter1_bins, filter2_bins)):
for i, (bin1, bin2) in enumerate(product(filter1_bins, filter2_bins)):
filter_bins = [(bin1,), (bin2,)]
indices = self.get_filter_indices(filters, filter_bins)

View file

@ -652,7 +652,7 @@ contains
t_n3 * k_combined(2)
end if
end if
x(:) = mean_stdev(global_tallies(:, LEAKAGE), n)
x(:) = mean_stdev(r(:, LEAKAGE), n)
write(ou,102) "Leakage Fraction", x(1), t_n1 * x(2)
end associate
else

View file

@ -1,2 +1,2 @@
energyfunction nuclide score mean std. dev.
0 02180f5f310ee4 Am241 (n,gamma) 1.00e-01 9.97e-03
energyfunction nuclide score mean std. dev.
0 02180f5f310ee4 Am241 ((n,gamma) / (n,gamma)) 1.00e-01 9.97e-03