mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-25 04:25:29 -04:00
Update examples
This commit is contained in:
parent
57371d217a
commit
7419cd26b3
15 changed files with 639 additions and 554 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
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
|
|
@ -338,7 +338,7 @@
|
|||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AJAwQmKDRX/78AAALKSURBVGje7dpLcqQwDAbgHHE2\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+8iMFuPWe9E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SGz7T0SBEWw4vLXzbQ\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/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDktMjFUMTY6NDI6\nMDctMDQ6MDC5xU4UAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTA5LTIxVDE2OjQyOjA3LTA0OjAw\nyJj2qAAAAABJRU5ErkJggg==\n",
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Image object>"
|
||||
]
|
||||
|
|
@ -386,18 +386,18 @@
|
|||
"# Create Tallies to compute microscopic multi-group cross-sections\n",
|
||||
"\n",
|
||||
"# Instantiate energy filter for multi-group cross-section Tallies\n",
|
||||
"energy_filter = openmc.Filter(type='energy', bins=[0., 0.625e-6, 20.])\n",
|
||||
"energy_filter = openmc.EnergyFilter([0., 0.625e-6, 20.])\n",
|
||||
"\n",
|
||||
"# Instantiate flux Tally in moderator and fuel\n",
|
||||
"tally = openmc.Tally(name='flux')\n",
|
||||
"tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter([fuel_cell.id, moderator_cell.id])]\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.Filter(type='cell', bins=[fuel_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter([fuel_cell.id])]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [u238, u235]\n",
|
||||
|
|
@ -405,7 +405,7 @@
|
|||
"\n",
|
||||
"# Instantiate reaction rate Tally in moderator\n",
|
||||
"tally = openmc.Tally(name='moderator rxn rates')\n",
|
||||
"tally.filters = [openmc.Filter(type='cell', bins=[moderator_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter([moderator_cell.id])]\n",
|
||||
"tally.filters.append(energy_filter)\n",
|
||||
"tally.scores = ['absorption', 'total']\n",
|
||||
"tally.nuclides = [o16, h1]\n",
|
||||
|
|
@ -417,7 +417,7 @@
|
|||
"mesh.dimension = [1, 1, 1]\n",
|
||||
"mesh.lower_left = [-0.63, -0.63, -100.]\n",
|
||||
"mesh.width = [1.26, 1.26, 200.]\n",
|
||||
"mesh_filter = openmc.Filter(type='mesh', bins=[mesh.id])\n",
|
||||
"mesh_filter = openmc.MeshFilter(mesh.id)\n",
|
||||
"mesh_filter.mesh = mesh\n",
|
||||
"\n",
|
||||
"# Instantiate thermal, fast, and total leakage tallies\n",
|
||||
|
|
@ -427,12 +427,12 @@
|
|||
"tallies_file.append(leak)\n",
|
||||
"\n",
|
||||
"thermal_leak = openmc.Tally(name='thermal leakage')\n",
|
||||
"thermal_leak.filters = [mesh_filter, openmc.Filter(type='energy', bins=[0., 0.625e-6])]\n",
|
||||
"thermal_leak.filters = [mesh_filter, openmc.EnergyFilter([0., 0.625e-6])]\n",
|
||||
"thermal_leak.scores = ['current']\n",
|
||||
"tallies_file.append(thermal_leak)\n",
|
||||
"\n",
|
||||
"fast_leak = openmc.Tally(name='fast leakage')\n",
|
||||
"fast_leak.filters = [mesh_filter, openmc.Filter(type='energy', bins=[0.625e-6, 20.])]\n",
|
||||
"fast_leak.filters = [mesh_filter, openmc.EnergyFilter([0.625e-6, 20.])]\n",
|
||||
"fast_leak.scores = ['current']\n",
|
||||
"tallies_file.append(fast_leak)"
|
||||
]
|
||||
|
|
@ -464,7 +464,7 @@
|
|||
"# Resonance Escape Probability tallies\n",
|
||||
"therm_abs_rate = openmc.Tally(name='therm. abs. rate')\n",
|
||||
"therm_abs_rate.scores = ['absorption']\n",
|
||||
"therm_abs_rate.filters = [openmc.Filter(type='energy', bins=[0., 0.625e-6])]\n",
|
||||
"therm_abs_rate.filters = [openmc.EnergyFilter([0., 0.625e-6])]\n",
|
||||
"tallies_file.append(therm_abs_rate)"
|
||||
]
|
||||
},
|
||||
|
|
@ -479,8 +479,8 @@
|
|||
"# Thermal Flux Utilization tallies\n",
|
||||
"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.Filter(type='energy', bins=[0., 0.625e-6]),\n",
|
||||
" openmc.Filter(type='cell', bins=[fuel_cell.id])]\n",
|
||||
"fuel_therm_abs_rate.filters = [openmc.EnergyFilter([0., 0.625e-6]),\n",
|
||||
" openmc.CellFilter([fuel_cell.id])]\n",
|
||||
"tallies_file.append(fuel_therm_abs_rate)"
|
||||
]
|
||||
},
|
||||
|
|
@ -495,7 +495,7 @@
|
|||
"# Fast Fission Factor tallies\n",
|
||||
"therm_fiss_rate = openmc.Tally(name='therm. fiss. rate')\n",
|
||||
"therm_fiss_rate.scores = ['nu-fission']\n",
|
||||
"therm_fiss_rate.filters = [openmc.Filter(type='energy', bins=[0., 0.625e-6])]\n",
|
||||
"therm_fiss_rate.filters = [openmc.EnergyFilter([0., 0.625e-6])]\n",
|
||||
"tallies_file.append(therm_fiss_rate)"
|
||||
]
|
||||
},
|
||||
|
|
@ -508,11 +508,11 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"# Instantiate energy filter to illustrate Tally slicing\n",
|
||||
"fine_energy_filter = openmc.Filter(type='energy', bins=np.logspace(np.log10(1e-8), np.log10(20), 10))\n",
|
||||
"fine_energy_filter = openmc.EnergyFilter(np.logspace(np.log10(1e-8), np.log10(20), 10))\n",
|
||||
"\n",
|
||||
"# Instantiate flux Tally in moderator and fuel\n",
|
||||
"tally = openmc.Tally(name='need-to-slice')\n",
|
||||
"tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id])]\n",
|
||||
"tally.filters = [openmc.CellFilter(bins=[fuel_cell.id, moderator_cell.id])]\n",
|
||||
"tally.filters.append(fine_energy_filter)\n",
|
||||
"tally.scores = ['nu-fission', 'scatter']\n",
|
||||
"tally.nuclides = [h1, u238]\n",
|
||||
|
|
@ -550,7 +550,6 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"rm: cannot remove 'statepoint.*': No such file or directory\n",
|
||||
"\n",
|
||||
" %%%%%%%%%%%%%%%\n",
|
||||
" %%%%%%%%%%%%%%%%%%%%%%%%\n",
|
||||
|
|
@ -580,9 +579,9 @@
|
|||
" Copyright | 2011-2016 Massachusetts Institute of Technology\n",
|
||||
" License | http://openmc.readthedocs.io/en/latest/license.html\n",
|
||||
" Version | 0.8.0\n",
|
||||
" Git SHA1 | 623b705a399f16c8e5063732bc6e6a357611542d\n",
|
||||
" Date/Time | 2016-09-03 04:38:41\n",
|
||||
" OpenMP Threads | 4\n",
|
||||
" Git SHA1 | 57371d217a270b4013af4e33ca20b0053654b190\n",
|
||||
" Date/Time | 2016-09-21 16:42:14\n",
|
||||
" MPI Processes | 1\n",
|
||||
"\n",
|
||||
" ===========================================================================\n",
|
||||
" ========================> INITIALIZATION <=========================\n",
|
||||
|
|
@ -592,12 +591,12 @@
|
|||
" Reading geometry XML file...\n",
|
||||
" Reading cross sections XML file...\n",
|
||||
" Reading materials XML file...\n",
|
||||
" Reading U235 from /opt/xsdata/nndc_new/U235.h5\n",
|
||||
" Reading U238 from /opt/xsdata/nndc_new/U238.h5\n",
|
||||
" Reading O16 from /opt/xsdata/nndc_new/O16.h5\n",
|
||||
" Reading H1 from /opt/xsdata/nndc_new/H1.h5\n",
|
||||
" Reading B10 from /opt/xsdata/nndc_new/B10.h5\n",
|
||||
" Reading Zr90 from /opt/xsdata/nndc_new/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: 20.0000 MeV for U235\n",
|
||||
" Reading tallies XML file...\n",
|
||||
" Building neighboring cells lists for each surface...\n",
|
||||
|
|
@ -638,20 +637,20 @@
|
|||
"\n",
|
||||
" =======================> TIMING STATISTICS <=======================\n",
|
||||
"\n",
|
||||
" Total time for initialization = 3.8900E-01 seconds\n",
|
||||
" Reading cross sections = 2.7000E-01 seconds\n",
|
||||
" Total time in simulation = 4.6960E+00 seconds\n",
|
||||
" Time in transport only = 4.6760E+00 seconds\n",
|
||||
" Time in inactive batches = 6.6400E-01 seconds\n",
|
||||
" Time in active batches = 4.0320E+00 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 = 5.0960E+00 seconds\n",
|
||||
" Calculation Rate (inactive) = 18825.3 neutrons/second\n",
|
||||
" Calculation Rate (active) = 9300.60 neutrons/second\n",
|
||||
" Total time for initialization = 2.8800E-01 seconds\n",
|
||||
" Reading cross sections = 1.6900E-01 seconds\n",
|
||||
" Total time in simulation = 1.5410E+01 seconds\n",
|
||||
" Time in transport only = 1.5395E+01 seconds\n",
|
||||
" Time in inactive batches = 2.3750E+00 seconds\n",
|
||||
" Time in active batches = 1.3035E+01 seconds\n",
|
||||
" Time synchronizing fission bank = 4.0000E-03 seconds\n",
|
||||
" Sampling source sites = 2.0000E-03 seconds\n",
|
||||
" SEND/RECV source sites = 2.0000E-03 seconds\n",
|
||||
" Time accumulating tallies = 1.0000E-03 seconds\n",
|
||||
" Total time for finalization = 3.0000E-03 seconds\n",
|
||||
" Total time elapsed = 1.5718E+01 seconds\n",
|
||||
" Calculation Rate (inactive) = 5263.16 neutrons/second\n",
|
||||
" Calculation Rate (active) = 2876.87 neutrons/second\n",
|
||||
"\n",
|
||||
" ============================> RESULTS <============================\n",
|
||||
"\n",
|
||||
|
|
@ -768,8 +767,8 @@
|
|||
"\n",
|
||||
"# Get the leakage tally\n",
|
||||
"leak = sp.get_tally(name='leakage')\n",
|
||||
"leak = leak.summation(filter_type='surface', remove_filter=True)\n",
|
||||
"leak = leak.summation(filter_type='mesh', remove_filter=True)\n",
|
||||
"leak = leak.summation(filter_type=openmc.SurfaceFilter, remove_filter=True)\n",
|
||||
"leak = leak.summation(filter_type=openmc.MeshFilter, remove_filter=True)\n",
|
||||
"\n",
|
||||
"# Compute k-infinity using tally arithmetic\n",
|
||||
"keff = fiss_rate / (abs_rate + leak)\n",
|
||||
|
|
@ -839,8 +838,8 @@
|
|||
"# Compute resonance escape probability using tally arithmetic\n",
|
||||
"therm_abs_rate = sp.get_tally(name='therm. abs. rate')\n",
|
||||
"thermal_leak = sp.get_tally(name='thermal leakage')\n",
|
||||
"thermal_leak = thermal_leak.summation(filter_type='surface', remove_filter=True)\n",
|
||||
"thermal_leak = thermal_leak.summation(filter_type='mesh', remove_filter=True)\n",
|
||||
"thermal_leak = thermal_leak.summation(filter_type=openmc.SurfaceFilter, remove_filter=True)\n",
|
||||
"thermal_leak = thermal_leak.summation(filter_type=openmc.MeshFilter, remove_filter=True)\n",
|
||||
"res_esc = (therm_abs_rate + thermal_leak) / (abs_rate + thermal_leak)\n",
|
||||
"res_esc.get_pandas_dataframe()"
|
||||
]
|
||||
|
|
@ -1248,7 +1247,7 @@
|
|||
"source": [
|
||||
"# Compute microscopic multi-group cross-sections\n",
|
||||
"flux = sp.get_tally(name='flux')\n",
|
||||
"flux = flux.get_slice(filters=['cell'], filter_bins=[(fuel_cell.id,)])\n",
|
||||
"flux = flux.get_slice(filters=[openmc.CellFilter], filter_bins=[(fuel_cell.id,)])\n",
|
||||
"fuel_rxn_rates = sp.get_tally(name='fuel rxn rates')\n",
|
||||
"mod_rxn_rates = sp.get_tally(name='moderator rxn rates')"
|
||||
]
|
||||
|
|
@ -1475,7 +1474,7 @@
|
|||
],
|
||||
"source": [
|
||||
"# Show how to use Tally.get_values(...) with a CrossFilter and CrossScore\n",
|
||||
"fast_scatter_xs = fuel_xs.get_values(filters=['energy'], \n",
|
||||
"fast_scatter_xs = fuel_xs.get_values(filters=[openmc.EnergyFilter], \n",
|
||||
" filter_bins=[((0.625e-6, 20.),)], \n",
|
||||
" scores=['(scatter / flux)'])\n",
|
||||
"print(fast_scatter_xs)"
|
||||
|
|
@ -1734,9 +1733,18 @@
|
|||
"# \"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",
|
||||
"slice_test = need_to_slice.get_slice(scores=['scatter'], nuclides=['H1'],\n",
|
||||
" filters=['cell'], filter_bins=[(moderator_cell.id,)])\n",
|
||||
" filters=[openmc.CellFilter], filter_bins=[(moderator_cell.id,)])\n",
|
||||
"slice_test.get_pandas_dataframe()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue