Merge pull request #862 from smharper/filter_bin_ids

Allow objects in addition to ids in Filters
This commit is contained in:
Paul Romano 2017-04-30 15:33:48 -05:00 committed by GitHub
commit e143546662
9 changed files with 636 additions and 552 deletions

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

@ -339,7 +339,7 @@
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AKHxE2I67FxwoAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMTAtMzFUMTI6NTQ6\nMzUtMDU6MDAowpdyAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTEwLTMxVDEyOjU0OjM1LTA1OjAw\nWZ8vzgAAAABJRU5ErkJggg==\n",
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX////pgJFyEhJNv8RV\nUZDeAAAAAWJLR0QAiAUdSAAAAAd0SU1FB+EEDRUZLksd2dYAAALKSURBVGje7dpLcqQwDAbgHHE2\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDQtMTNUMTc6MjU6\nNDUtMDQ6MDCJ1tNgAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTA0LTEzVDE3OjI1OjQ1LTA0OjAw\n+Itr3AAAAABJRU5ErkJggg==\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
@ -391,14 +391,14 @@
"\n",
"# Instantiate flux Tally in moderator and fuel\n",
"tally = openmc.Tally(name='flux')\n",
"tally.filters = [openmc.CellFilter([fuel_cell.id, moderator_cell.id])]\n",
"tally.filters = [openmc.CellFilter([fuel_cell, moderator_cell])]\n",
"tally.filters.append(energy_filter)\n",
"tally.scores = ['flux']\n",
"tallies_file.append(tally)\n",
"\n",
"# Instantiate reaction rate Tally in fuel\n",
"tally = openmc.Tally(name='fuel rxn rates')\n",
"tally.filters = [openmc.CellFilter([fuel_cell.id])]\n",
"tally.filters = [openmc.CellFilter(fuel_cell)]\n",
"tally.filters.append(energy_filter)\n",
"tally.scores = ['nu-fission', 'scatter']\n",
"tally.nuclides = [u238, u235]\n",
@ -406,7 +406,7 @@
"\n",
"# Instantiate reaction rate Tally in moderator\n",
"tally = openmc.Tally(name='moderator rxn rates')\n",
"tally.filters = [openmc.CellFilter([moderator_cell.id])]\n",
"tally.filters = [openmc.CellFilter(moderator_cell)]\n",
"tally.filters.append(energy_filter)\n",
"tally.scores = ['absorption', 'total']\n",
"tally.nuclides = [o16, h1]\n",
@ -480,7 +480,7 @@
"fuel_therm_abs_rate = openmc.Tally(name='fuel therm. abs. rate')\n",
"fuel_therm_abs_rate.scores = ['absorption']\n",
"fuel_therm_abs_rate.filters = [openmc.EnergyFilter([0., 0.625]),\n",
" openmc.CellFilter([fuel_cell.id])]\n",
" openmc.CellFilter([fuel_cell])]\n",
"tallies_file.append(fuel_therm_abs_rate)"
]
},
@ -512,7 +512,7 @@
"\n",
"# Instantiate flux Tally in moderator and fuel\n",
"tally = openmc.Tally(name='need-to-slice')\n",
"tally.filters = [openmc.CellFilter(bins=[fuel_cell.id, moderator_cell.id])]\n",
"tally.filters = [openmc.CellFilter([fuel_cell, moderator_cell])]\n",
"tally.filters.append(fine_energy_filter)\n",
"tally.scores = ['nu-fission', 'scatter']\n",
"tally.nuclides = [h1, u238]\n",
@ -576,35 +576,30 @@
" %%%%%%%%%%%\n",
"\n",
" | The OpenMC Monte Carlo Code\n",
" Copyright | 2011-2016 Massachusetts Institute of Technology\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 | da5563eddb5f2c2d6b2c9839d518de40962b78f2\n",
" Date/Time | 2016-10-31 12:54:36\n",
" OpenMP Threads | 4\n",
"\n",
" ===========================================================================\n",
" ========================> INITIALIZATION <=========================\n",
" ===========================================================================\n",
" Git SHA1 | bc4683be1c853fe6d0e31bccad416ef219e3efaf\n",
" Date/Time | 2017-04-13 17:26:05\n",
" MPI Processes | 1\n",
" OpenMP Threads | 1\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/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",
" 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",
" 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",
" ===========================================================================\n",
" ====================> K EIGENVALUE SIMULATION <====================\n",
" ===========================================================================\n",
"\n",
" Bat./Gen. k Average k \n",
" ========= ======== ==================== \n",
@ -617,48 +612,43 @@
" 7/1 0.99859 1.01409 +/- 0.01550\n",
" 8/1 1.03441 1.02086 +/- 0.01123\n",
" 9/1 1.06097 1.03089 +/- 0.01279\n",
" 10/1 1.06094 1.03690 +/- 0.01159\n",
" 11/1 1.04687 1.03856 +/- 0.00961\n",
" 12/1 1.02982 1.03731 +/- 0.00821\n",
" 13/1 1.03520 1.03705 +/- 0.00712\n",
" 14/1 0.99508 1.03239 +/- 0.00782\n",
" 15/1 1.03973 1.03312 +/- 0.00703\n",
" 16/1 1.03807 1.03357 +/- 0.00638\n",
" 17/1 1.03091 1.03335 +/- 0.00583\n",
" 18/1 1.01421 1.03188 +/- 0.00556\n",
" 19/1 0.99339 1.02913 +/- 0.00583\n",
" 20/1 1.04827 1.03040 +/- 0.00558\n",
" 10/1 1.06132 1.03698 +/- 0.01163\n",
" 11/1 1.04687 1.03863 +/- 0.00964\n",
" 12/1 1.02982 1.03737 +/- 0.00824\n",
" 13/1 1.03520 1.03710 +/- 0.00714\n",
" 14/1 0.99508 1.03243 +/- 0.00784\n",
" 15/1 1.03987 1.03317 +/- 0.00705\n",
" 16/1 1.02743 1.03265 +/- 0.00640\n",
" 17/1 1.02975 1.03241 +/- 0.00585\n",
" 18/1 0.99671 1.02966 +/- 0.00604\n",
" 19/1 1.02040 1.02900 +/- 0.00563\n",
" 20/1 1.02024 1.02842 +/- 0.00527\n",
" Creating state point statepoint.20.h5...\n",
"\n",
" ===========================================================================\n",
" ======================> SIMULATION FINISHED <======================\n",
" ===========================================================================\n",
"\n",
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 5.0418E-01 seconds\n",
" Reading cross sections = 3.6765E-01 seconds\n",
" Total time in simulation = 8.8388E+00 seconds\n",
" Time in transport only = 8.7431E+00 seconds\n",
" Time in inactive batches = 1.4676E+00 seconds\n",
" Time in active batches = 7.3713E+00 seconds\n",
" Time synchronizing fission bank = 2.2671E-03 seconds\n",
" Sampling source sites = 1.6677E-03 seconds\n",
" SEND/RECV source sites = 5.5964E-04 seconds\n",
" Time accumulating tallies = 9.0487E-05 seconds\n",
" Total time for finalization = 2.7160E-03 seconds\n",
" Total time elapsed = 9.3633E+00 seconds\n",
" Calculation Rate (inactive) = 8517.40 neutrons/second\n",
" Calculation Rate (active) = 5087.33 neutrons/second\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",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" k-effective (Collision) = 1.02791 +/- 0.00553\n",
" k-effective (Track-length) = 1.03040 +/- 0.00558\n",
" k-effective (Absorption) = 1.02011 +/- 0.00491\n",
" Combined k-effective = 1.02461 +/- 0.00398\n",
" Leakage Fraction = 0.01677 +/- 0.00109\n",
" k-effective (Collision) = 1.02889 +/- 0.00492\n",
" k-effective (Track-length) = 1.02842 +/- 0.00527\n",
" k-effective (Absorption) = 1.02637 +/- 0.00349\n",
" Combined k-effective = 1.02700 +/- 0.00291\n",
" Leakage Fraction = 0.01717 +/- 0.00107\n",
"\n"
]
},
@ -743,8 +733,8 @@
" <th>0</th>\n",
" <td>total</td>\n",
" <td>(nu-fission / (absorption + current))</td>\n",
" <td>1.02431</td>\n",
" <td>0.00704</td>\n",
" <td>1.023002</td>\n",
" <td>0.006647</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -752,7 +742,7 @@
],
"text/plain": [
" nuclide score mean std. dev.\n",
"0 total (nu-fission / (absorption + current)) 1.02e+00 7.04e-03"
"0 total (nu-fission / (absorption + current)) 1.02e+00 6.65e-03"
]
},
"execution_count": 24,
@ -814,8 +804,8 @@
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>(absorption + current)</td>\n",
" <td>0.695303</td>\n",
" <td>0.005091</td>\n",
" <td>0.694368</td>\n",
" <td>0.004606</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -823,10 +813,10 @@
],
"text/plain": [
" energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 0.00e+00 6.25e-01 total (absorption + current) 6.95e-01 \n",
"0 0.00e+00 6.25e-01 total (absorption + current) 6.94e-01 \n",
"\n",
" std. dev. \n",
"0 5.09e-03 "
"0 4.61e-03 "
]
},
"execution_count": 25,
@ -882,8 +872,8 @@
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>nu-fission</td>\n",
" <td>1.202639</td>\n",
" <td>0.010348</td>\n",
" <td>1.203099</td>\n",
" <td>0.009615</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -891,7 +881,7 @@
],
"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 1.03e-02"
"0 0.00e+00 6.25e-01 total nu-fission 1.20e+00 9.61e-03"
]
},
"execution_count": 26,
@ -947,8 +937,8 @@
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.749349</td>\n",
" <td>0.006731</td>\n",
" <td>0.749423</td>\n",
" <td>0.006089</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -959,7 +949,7 @@
"0 0.00e+00 6.25e-01 10000 total absorption 7.49e-01 \n",
"\n",
" std. dev. \n",
"0 6.73e-03 "
"0 6.09e-03 "
]
},
"execution_count": 27,
@ -1013,8 +1003,8 @@
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.663736</td>\n",
" <td>0.015707</td>\n",
" <td>1.663727</td>\n",
" <td>0.014403</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1025,7 +1015,7 @@
"0 0.00e+00 6.25e-01 10000 total \n",
"\n",
" score mean std. dev. \n",
"0 (nu-fission / absorption) 1.66e+00 1.57e-02 "
"0 (nu-fission / absorption) 1.66e+00 1.44e-02 "
]
},
"execution_count": 28,
@ -1076,8 +1066,8 @@
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>(absorption + current)</td>\n",
" <td>0.985102</td>\n",
" <td>0.005855</td>\n",
" <td>0.984668</td>\n",
" <td>0.005509</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1088,7 +1078,7 @@
"0 0.00e+00 6.25e-01 total (absorption + current) 9.85e-01 \n",
"\n",
" std. dev. \n",
"0 5.86e-03 "
"0 5.51e-03 "
]
},
"execution_count": 29,
@ -1138,8 +1128,8 @@
" <td>0.625</td>\n",
" <td>total</td>\n",
" <td>(absorption / (absorption + current))</td>\n",
" <td>0.997407</td>\n",
" <td>0.008492</td>\n",
" <td>0.997439</td>\n",
" <td>0.007548</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1150,7 +1140,7 @@
"0 0.00e+00 6.25e-01 total \n",
"\n",
" score mean std. dev. \n",
"0 (absorption / (absorption + current)) 9.97e-01 8.49e-03 "
"0 (absorption / (absorption + current)) 9.97e-01 7.55e-03 "
]
},
"execution_count": 30,
@ -1202,8 +1192,8 @@
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>((((((absorption + current) * nu-fission) * ab...</td>\n",
" <td>1.02431</td>\n",
" <td>0.02062</td>\n",
" <td>1.023002</td>\n",
" <td>0.018791</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1214,7 +1204,7 @@
"0 0.00e+00 6.25e-01 10000 total \n",
"\n",
" score mean std. dev. \n",
"0 ((((((absorption + current) * nu-fission) * ab... 1.02e+00 2.06e-02 "
"0 ((((((absorption + current) * nu-fission) * ab... 1.02e+00 1.88e-02 "
]
},
"execution_count": 31,
@ -1284,8 +1274,8 @@
" <td>6.250000e-01</td>\n",
" <td>(U238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>6.662479e-07</td>\n",
" <td>6.039323e-09</td>\n",
" <td>6.659486e-07</td>\n",
" <td>5.627975e-09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -1294,8 +1284,8 @@
" <td>6.250000e-01</td>\n",
" <td>(U238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>2.099897e-01</td>\n",
" <td>1.843251e-03</td>\n",
" <td>2.099901e-01</td>\n",
" <td>1.748379e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
@ -1304,8 +1294,8 @@
" <td>6.250000e-01</td>\n",
" <td>(U235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>3.568130e-01</td>\n",
" <td>3.255144e-03</td>\n",
" <td>3.566329e-01</td>\n",
" <td>3.030782e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
@ -1314,8 +1304,8 @@
" <td>6.250000e-01</td>\n",
" <td>(U235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>5.555326e-03</td>\n",
" <td>4.893022e-05</td>\n",
" <td>5.555466e-03</td>\n",
" <td>4.635318e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
@ -1324,8 +1314,8 @@
" <td>2.000000e+07</td>\n",
" <td>(U238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>7.215044e-03</td>\n",
" <td>4.968448e-05</td>\n",
" <td>7.251304e-03</td>\n",
" <td>5.161998e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
@ -1334,8 +1324,8 @@
" <td>2.000000e+07</td>\n",
" <td>(U238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>2.273966e-01</td>\n",
" <td>8.969811e-04</td>\n",
" <td>2.272661e-01</td>\n",
" <td>9.576939e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
@ -1344,8 +1334,8 @@
" <td>2.000000e+07</td>\n",
" <td>(U235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>7.969615e-03</td>\n",
" <td>5.374119e-05</td>\n",
" <td>7.920169e-03</td>\n",
" <td>5.751231e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
@ -1354,8 +1344,8 @@
" <td>2.000000e+07</td>\n",
" <td>(U235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>3.362798e-03</td>\n",
" <td>1.286767e-05</td>\n",
" <td>3.358280e-03</td>\n",
" <td>1.341281e-05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1373,14 +1363,14 @@
"7 10000 6.25e-01 2.00e+07 (U235 / total) \n",
"\n",
" score mean std. dev. \n",
"0 (nu-fission / flux) 6.66e-07 6.04e-09 \n",
"1 (scatter / flux) 2.10e-01 1.84e-03 \n",
"2 (nu-fission / flux) 3.57e-01 3.26e-03 \n",
"3 (scatter / flux) 5.56e-03 4.89e-05 \n",
"4 (nu-fission / flux) 7.22e-03 4.97e-05 \n",
"5 (scatter / flux) 2.27e-01 8.97e-04 \n",
"6 (nu-fission / flux) 7.97e-03 5.37e-05 \n",
"7 (scatter / flux) 3.36e-03 1.29e-05 "
"0 (nu-fission / flux) 6.66e-07 5.63e-09 \n",
"1 (scatter / flux) 2.10e-01 1.75e-03 \n",
"2 (nu-fission / flux) 3.57e-01 3.03e-03 \n",
"3 (scatter / flux) 5.56e-03 4.64e-05 \n",
"4 (nu-fission / flux) 7.25e-03 5.16e-05 \n",
"5 (scatter / flux) 2.27e-01 9.58e-04 \n",
"6 (nu-fission / flux) 7.92e-03 5.75e-05 \n",
"7 (scatter / flux) 3.36e-03 1.34e-05 "
]
},
"execution_count": 33,
@ -1411,11 +1401,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 6.66247898e-07]\n",
" [ 3.56812954e-01]]\n",
"[[[ 6.65948580e-07]\n",
" [ 3.56632881e-01]]\n",
"\n",
" [[ 7.21504433e-03]\n",
" [ 7.96961502e-03]]]\n"
" [[ 7.25130446e-03]\n",
" [ 7.92016892e-03]]]\n"
]
}
],
@ -1443,9 +1433,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.00555533]]\n",
"[[[ 0.00555547]]\n",
"\n",
" [[ 0.0033628 ]]]\n"
" [[ 0.00335828]]]\n"
]
}
],
@ -1467,8 +1457,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.22739657]\n",
" [ 0.0033628 ]]]\n"
"[[[ 0.22726611]\n",
" [ 0.00335828]]]\n"
]
}
],
@ -1520,7 +1510,7 @@
" <td>U238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000002</td>\n",
" <td>1.057199e-08</td>\n",
" <td>9.679304e-09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -1529,8 +1519,8 @@
" <td>6.250000e-01</td>\n",
" <td>U235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.856784</td>\n",
" <td>5.730044e-03</td>\n",
" <td>0.854805</td>\n",
" <td>5.239673e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
@ -1539,8 +1529,8 @@
" <td>2.000000e+07</td>\n",
" <td>U238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.082495</td>\n",
" <td>5.176027e-04</td>\n",
" <td>0.082978</td>\n",
" <td>5.346135e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
@ -1549,8 +1539,8 @@
" <td>2.000000e+07</td>\n",
" <td>U235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.091123</td>\n",
" <td>5.574052e-04</td>\n",
" <td>0.090632</td>\n",
" <td>5.981942e-04</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1559,15 +1549,15 @@
"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.57e-01 \n",
"2 10000 6.25e-01 2.00e+07 U238 nu-fission 8.25e-02 \n",
"3 10000 6.25e-01 2.00e+07 U235 nu-fission 9.11e-02 \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",
"\n",
" std. dev. \n",
"0 1.06e-08 \n",
"1 5.73e-03 \n",
"2 5.18e-04 \n",
"3 5.57e-04 "
"0 9.68e-09 \n",
"1 5.24e-03 \n",
"2 5.35e-04 \n",
"3 5.98e-04 "
]
},
"execution_count": 37,
@ -1613,8 +1603,8 @@
" <td>1.080060e-01</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>4.547947</td>\n",
" <td>0.028000</td>\n",
" <td>4.541188</td>\n",
" <td>0.025230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -1623,8 +1613,8 @@
" <td>1.166529e+00</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>2.003068</td>\n",
" <td>0.008587</td>\n",
" <td>2.001332</td>\n",
" <td>0.006754</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
@ -1633,8 +1623,8 @@
" <td>1.259921e+01</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>1.647225</td>\n",
" <td>0.011136</td>\n",
" <td>1.639292</td>\n",
" <td>0.011374</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
@ -1643,8 +1633,8 @@
" <td>1.360790e+02</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>1.831367</td>\n",
" <td>0.010196</td>\n",
" <td>1.821633</td>\n",
" <td>0.009590</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
@ -1653,8 +1643,8 @@
" <td>1.469734e+03</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>2.039613</td>\n",
" <td>0.008059</td>\n",
" <td>2.032395</td>\n",
" <td>0.009953</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
@ -1663,8 +1653,8 @@
" <td>1.587401e+04</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>2.137523</td>\n",
" <td>0.012885</td>\n",
" <td>2.120745</td>\n",
" <td>0.011090</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
@ -1673,8 +1663,8 @@
" <td>1.714488e+05</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>2.170725</td>\n",
" <td>0.012669</td>\n",
" <td>2.181709</td>\n",
" <td>0.013602</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
@ -1683,8 +1673,8 @@
" <td>1.851749e+06</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>2.002724</td>\n",
" <td>0.010768</td>\n",
" <td>2.013644</td>\n",
" <td>0.009219</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
@ -1693,8 +1683,8 @@
" <td>2.000000e+07</td>\n",
" <td>H1</td>\n",
" <td>scatter</td>\n",
" <td>0.371624</td>\n",
" <td>0.002959</td>\n",
" <td>0.372640</td>\n",
" <td>0.002903</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
@ -1702,26 +1692,26 @@
],
"text/plain": [
" cell energy low [eV] energy high [eV] nuclide score mean \\\n",
"0 10002 1.00e-02 1.08e-01 H1 scatter 4.55e+00 \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.65e+00 \n",
"3 10002 1.26e+01 1.36e+02 H1 scatter 1.83e+00 \n",
"4 10002 1.36e+02 1.47e+03 H1 scatter 2.04e+00 \n",
"5 10002 1.47e+03 1.59e+04 H1 scatter 2.14e+00 \n",
"6 10002 1.59e+04 1.71e+05 H1 scatter 2.17e+00 \n",
"7 10002 1.71e+05 1.85e+06 H1 scatter 2.00e+00 \n",
"8 10002 1.85e+06 2.00e+07 H1 scatter 3.72e-01 \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",
"\n",
" std. dev. \n",
"0 2.80e-02 \n",
"1 8.59e-03 \n",
"2 1.11e-02 \n",
"3 1.02e-02 \n",
"4 8.06e-03 \n",
"5 1.29e-02 \n",
"6 1.27e-02 \n",
"7 1.08e-02 \n",
"8 2.96e-03 "
"0 2.52e-02 \n",
"1 6.75e-03 \n",
"2 1.14e-02 \n",
"3 9.59e-03 \n",
"4 9.95e-03 \n",
"5 1.11e-02 \n",
"6 1.36e-02 \n",
"7 9.22e-03 \n",
"8 2.90e-03 "
]
},
"execution_count": 38,

View file

@ -95,7 +95,7 @@ settings_file.export_to_xml()
###############################################################################
# Instantiate some tally Filters
cell_filter = openmc.CellFilter(100)
cell_filter = openmc.CellFilter(cell2)
energy_filter = openmc.EnergyFilter([0., 20.e6])
energyout_filter = openmc.EnergyoutFilter([0., 20.e6])

View file

@ -153,7 +153,7 @@ plot_file.export_to_xml()
# Instantiate a distribcell Tally
tally = openmc.Tally(tally_id=1)
tally.filters = [openmc.DistribcellFilter(cell2.id)]
tally.filters = [openmc.DistribcellFilter(cell2)]
tally.scores = ['total']
# Instantiate a Tallies collection and export to XML

View file

@ -434,20 +434,49 @@ class Filter(object):
return df
class IntegralFilter(Filter):
"""Tally modifier that describes phase-space and other characteristics.
class WithIDFilter(Filter):
"""Abstract parent for filters of types with ids (Cell, Material, etc.)."""
@property
def num_bins(self):
return len(self.bins)
# Since num_bins property is declared, also need a num_bins.setter, but
# we don't want it to do anything since num_bins is completely determined
# by len(self.bins). We also don't want to raise an error because that
# makes importing from HDF5 more complicated.
@num_bins.setter
def num_bins(self, num_bins): pass
def _smart_set_bins(self, bins, bin_type):
# Format the bins as a 1D numpy array.
bins = np.atleast_1d(bins)
# Check the bin values.
cv.check_iterable_type('filter bins', bins, (Integral, bin_type))
for edge in bins:
if isinstance(edge, Integral):
cv.check_greater_than('filter bin', edge, 0, equality=True)
# Extract id values.
bins = np.atleast_1d([b if isinstance(b, Integral) else b.id
for b in bins])
self._bins = bins
class UniverseFilter(WithIDFilter):
"""Bins tally event locations based on the Universe they occured in.
Parameters
----------
bins : Integral or Iterable of Integral
The bins for the filter. This takes on different meaning for different
filters. See the docstrings for sublcasses of this filter or the online
documentation for more details.
bins : openmc.Universe, Integral, or iterable thereof
The Universes to tally. Either openmc.Universe objects or their
Integral ID numbers can be used.
Attributes
----------
bins : Integral or Iterable of Integral
The bins for the filter
bins : Iterable of Integral
openmc.Universe IDs.
num_bins : Integral
The number of filter bins
stride : Integral
@ -456,53 +485,26 @@ class IntegralFilter(Filter):
"""
@property
def num_bins(self):
return len(self.bins)
def bins(self):
return self._bins
@num_bins.setter
def num_bins(self, num_bins):
cv.check_type('filter num_bins', num_bins, Integral)
cv.check_greater_than('filter num_bins', num_bins, 0, equality=True)
self._num_bins = num_bins
def check_bins(self, bins):
cv.check_iterable_type('filter bins', bins, Integral)
for edge in bins:
cv.check_greater_than('filter bin', edge, 0, equality=True)
@bins.setter
def bins(self, bins):
self._smart_set_bins(bins, openmc.Universe)
class UniverseFilter(IntegralFilter):
"""Bins tally event locations based on the universe they occured in.
class MaterialFilter(WithIDFilter):
"""Bins tally event locations based on the Material they occured in.
Parameters
----------
bins : Integral or Iterable of Integral
openmc.Universe IDs.
bins : openmc.Material, Integral, or iterable thereof
The Materials to tally. Either openmc.Material objects or their
Integral ID numbers can be used.
Attributes
----------
bins : Integral or Iterable of Integral
openmc.Universe IDs.
num_bins : Integral
The number of filter bins
stride : Integral
The number of filter, nuclide and score bins within each of this
filter's bins.
"""
class MaterialFilter(IntegralFilter):
"""Bins tally events based on which material they occured in.
Parameters
----------
bins : Integral or Iterable of Integral
openmc.Material IDs.
Attributes
----------
bins : Integral or Iterable of Integral
bins : Iterable of Integral
openmc.Material IDs.
num_bins : Integral
The number of filter bins
@ -511,19 +513,27 @@ class MaterialFilter(IntegralFilter):
filter's bins.
"""
@property
def bins(self):
return self._bins
@bins.setter
def bins(self, bins):
self._smart_set_bins(bins, openmc.Material)
class CellFilter(IntegralFilter):
"""Bins tally event locations based on which cell they occured in.
class CellFilter(WithIDFilter):
"""Bins tally event locations based on the Cell they occured in.
Parameters
----------
bins : Integral or Iterable of Integral
openmc.Cell IDs.
bins : openmc.Cell, Integral, or iterable thereof
The Cells to tally. Either openmc.Cell objects or their
Integral ID numbers can be used.
Attributes
----------
bins : Integral or Iterable of Integral
bins : Iterable of Integral
openmc.Cell IDs.
num_bins : Integral
The number of filter bins
@ -532,19 +542,27 @@ class CellFilter(IntegralFilter):
filter's bins.
"""
@property
def bins(self):
return self._bins
@bins.setter
def bins(self, bins):
self._smart_set_bins(bins, openmc.Cell)
class CellbornFilter(IntegralFilter):
"""Bins tally events based on the cell that the particle was born in.
class CellbornFilter(WithIDFilter):
"""Bins tally events based on which Cell the neutron was born in.
Parameters
----------
bins : Integral or Iterable of Integral
openmc.Cell IDs.
bins : openmc.Cell, Integral, or iterable thereof
The birth Cells to tally. Either openmc.Cell objects or their
Integral ID numbers can be used.
Attributes
----------
bins : Integral or Iterable of Integral
bins : Iterable of Integral
openmc.Cell IDs.
num_bins : Integral
The number of filter bins
@ -553,9 +571,16 @@ class CellbornFilter(IntegralFilter):
filter's bins.
"""
@property
def bins(self):
return self._bins
@bins.setter
def bins(self, bins):
self._smart_set_bins(bins, openmc.Cell)
class SurfaceFilter(IntegralFilter):
class SurfaceFilter(Filter):
"""Bins particle currents on Mesh surfaces.
Parameters
@ -576,6 +601,28 @@ class SurfaceFilter(IntegralFilter):
filter's bins.
"""
@property
def bins(self):
return self._bins
@property
def num_bins(self):
return len(self.bins)
@bins.setter
def bins(self, bins):
# Format the bins as a 1D numpy array.
bins = np.atleast_1d(bins)
# Check the bin values.
cv.check_iterable_type('filter bins', bins, Integral)
for edge in bins:
cv.check_greater_than('filter bin', edge, 0, equality=True)
self._bins = bins
@num_bins.setter
def num_bins(self, num_bins): pass
def get_pandas_dataframe(self, data_size, **kwargs):
"""Builds a Pandas DataFrame for the Filter's bins.
@ -1085,14 +1132,14 @@ class DistribcellFilter(Filter):
Parameters
----------
bins : Integral or Iterable of Integral or Iterable of Real
The bins for the filter. This takes on different meaning for different
filters. See the OpenMC online documentation for more details.
cell : openmc.Cell or Integral
The distributed cell to tally. Either an openmc.Cell or an Integral
cell ID number can be used.
Attributes
----------
bins : Integral or Iterable of Integral or Iterable of Real
The bins for the filter
bins : Iterable of Integral
An iterable with one element---the ID of the distributed Cell.
num_bins : Integral
The number of filter bins
stride : Integral
@ -1104,9 +1151,9 @@ class DistribcellFilter(Filter):
"""
def __init__(self, bins):
def __init__(self, cell):
self._paths = None
super(DistribcellFilter, self).__init__(bins)
super(DistribcellFilter, self).__init__(cell)
@classmethod
def from_hdf5(cls, group, **kwargs):
@ -1120,24 +1167,36 @@ class DistribcellFilter(Filter):
return out
@property
def bins(self):
return self._bins
@property
def paths(self):
return self._paths
@paths.setter
def paths(self, paths):
cv.check_iterable_type('paths', paths, str)
self._paths = paths
@bins.setter
def bins(self, bins):
# Format the bins as a 1D numpy array.
bins = np.atleast_1d(bins)
def check_bins(self, bins):
# Make sure there is only 1 bin.
if not len(bins) == 1:
msg = 'Unable to add bins "{0}" to a DistribcellFilter since ' \
'only a single distribcell can be used per tally'.format(bins)
raise ValueError(msg)
cv.check_iterable_type('filter bins', bins, Integral)
for edge in bins:
cv.check_greater_than('filter bin', edge, 0, equality=True)
# Check the type and extract the id, if necessary.
cv.check_type('distribcell bin', bins[0], (Integral, openmc.Cell))
if isinstance(bins[0], openmc.Cell):
bins = np.atleast_1d(bins[0].id)
self._bins = bins
@paths.setter
def paths(self, paths):
cv.check_iterable_type('paths', paths, str)
self._paths = paths
def can_merge(self, other):
# Distribcell filters cannot have more than one bin
@ -1611,7 +1670,7 @@ class AzimuthalFilter(RealFilter):
return df
class DelayedGroupFilter(IntegralFilter):
class DelayedGroupFilter(Filter):
"""Bins fission events based on the produced neutron precursor groups.
Parameters
@ -1634,6 +1693,28 @@ class DelayedGroupFilter(IntegralFilter):
filter's bins.
"""
@property
def bins(self):
return self._bins
@property
def num_bins(self):
return len(self.bins)
@bins.setter
def bins(self, bins):
# Format the bins as a 1D numpy array.
bins = np.atleast_1d(bins)
# Check the bin values.
cv.check_iterable_type('filter bins', bins, Integral)
for edge in bins:
cv.check_greater_than('filter bin', edge, 0, equality=True)
self._bins = bins
@num_bins.setter
def num_bins(self, num_bins): pass
class EnergyFunctionFilter(Filter):

View file

@ -26,8 +26,7 @@ if __name__ == '__main__':
matching_eout_filter = openmc.EnergyoutFilter(energies)
mesh_filter = openmc.MeshFilter(mesh)
mat_ids = [mat.id for mat in model.materials]
mat_filter = openmc.MaterialFilter(mat_ids)
mat_filter = openmc.MaterialFilter(model.materials)
nuclides = [xs.name for xs in model.xs_data]

View file

@ -43,7 +43,10 @@ if __name__ == '__main__':
azimuthal_tally3.estimator = 'tracklength'
cellborn_tally = Tally()
cellborn_tally.filters = [CellbornFilter((10, 21, 22, 23))]
cellborn_tally.filters = [
CellbornFilter((model.geometry.get_all_cells()[10],
model.geometry.get_all_cells()[21],
22, 23))] # Test both Cell objects and ids
cellborn_tally.scores = ['total']
dg_tally = Tally()
@ -66,7 +69,10 @@ if __name__ == '__main__':
transfer_tally.scores = ['scatter', 'nu-fission']
material_tally = Tally()
material_tally.filters = [MaterialFilter((1, 2, 3, 4))]
material_tally.filters = [
MaterialFilter((model.geometry.get_materials_by_name('UOX fuel')[0],
model.geometry.get_materials_by_name('Zircaloy')[0],
3, 4))] # Test both Material objects and ids
material_tally.scores = ['total']
mu_bins = (-1.0, -0.5, 0.0, 0.5, 1.0)
@ -97,10 +103,15 @@ if __name__ == '__main__':
polar_tally3.estimator = 'tracklength'
universe_tally = Tally()
universe_tally.filters = [UniverseFilter((1, 2, 3, 4, 6, 8))]
universe_tally.filters = [
UniverseFilter((model.geometry.get_all_universes()[1],
model.geometry.get_all_universes()[2],
3, 4, 6, 8))] # Test both Universe objects and ids
universe_tally.scores = ['total']
cell_filter = CellFilter((10, 21, 22, 23, 60))
cell_filter = CellFilter((model.geometry.get_all_cells()[10],
model.geometry.get_all_cells()[21],
22, 23, 60)) # Test both Cell objects and ids
score_tallies = [Tally(), Tally(), Tally()]
for t in score_tallies:
t.filters = [cell_filter]