mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-22 06:55:35 -04:00
1587 lines
51 KiB
Text
1587 lines
51 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"This notebook shows the how tallies can be combined (added, subtracted, multiplied, etc.) using the Python API in order to create derived tallies. Since no covariance information is obtained, it is assumed that tallies are completely independent of one another when propagating uncertainties. The target problem is a simple pin cell."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import glob\n",
|
|
"from IPython.display import Image\n",
|
|
"import numpy as np\n",
|
|
"\n",
|
|
"import openmc"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Generate Input Files"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"First we need to define materials that will be used in the problem. Before defining a material, we must create nuclides that are used in the material."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate some Nuclides\n",
|
|
"h1 = openmc.Nuclide('H-1')\n",
|
|
"b10 = openmc.Nuclide('B-10')\n",
|
|
"o16 = openmc.Nuclide('O-16')\n",
|
|
"u235 = openmc.Nuclide('U-235')\n",
|
|
"u238 = openmc.Nuclide('U-238')\n",
|
|
"zr90 = openmc.Nuclide('Zr-90')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With the nuclides we defined, we will now create three materials for the fuel, water, and cladding of the fuel pin."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 1.6 enriched fuel\n",
|
|
"fuel = openmc.Material(name='1.6% Fuel')\n",
|
|
"fuel.set_density('g/cm3', 10.31341)\n",
|
|
"fuel.add_nuclide(u235, 3.7503e-4)\n",
|
|
"fuel.add_nuclide(u238, 2.2625e-2)\n",
|
|
"fuel.add_nuclide(o16, 4.6007e-2)\n",
|
|
"\n",
|
|
"# borated water\n",
|
|
"water = openmc.Material(name='Borated Water')\n",
|
|
"water.set_density('g/cm3', 0.740582)\n",
|
|
"water.add_nuclide(h1, 4.9457e-2)\n",
|
|
"water.add_nuclide(o16, 2.4732e-2)\n",
|
|
"water.add_nuclide(b10, 8.0042e-6)\n",
|
|
"\n",
|
|
"# zircaloy\n",
|
|
"zircaloy = openmc.Material(name='Zircaloy')\n",
|
|
"zircaloy.set_density('g/cm3', 6.55)\n",
|
|
"zircaloy.add_nuclide(zr90, 7.2758e-3)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With our three materials, we can now create a materials file object that can be exported to an actual XML file."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate a Materials collection\n",
|
|
"materials_file = openmc.Materials((fuel, water, zircaloy))\n",
|
|
"materials_file.default_xs = '71c'\n",
|
|
"\n",
|
|
"# Export to \"materials.xml\"\n",
|
|
"materials_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now let's move on to the geometry. Our problem will have three regions for the fuel, the clad, and the surrounding coolant. The first step is to create the bounding surfaces -- in this case two cylinders and six reflective planes."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create cylinders for the fuel and clad\n",
|
|
"fuel_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.39218)\n",
|
|
"clad_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.45720)\n",
|
|
"\n",
|
|
"# Create boundary planes to surround the geometry\n",
|
|
"# Use both reflective and vacuum boundaries to make life interesting\n",
|
|
"min_x = openmc.XPlane(x0=-0.63, boundary_type='reflective')\n",
|
|
"max_x = openmc.XPlane(x0=+0.63, boundary_type='reflective')\n",
|
|
"min_y = openmc.YPlane(y0=-0.63, boundary_type='reflective')\n",
|
|
"max_y = openmc.YPlane(y0=+0.63, boundary_type='reflective')\n",
|
|
"min_z = openmc.ZPlane(z0=-0.63, boundary_type='reflective')\n",
|
|
"max_z = openmc.ZPlane(z0=+0.63, boundary_type='reflective')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With the surfaces defined, we can now create cells that are defined by intersections of half-spaces created by the surfaces."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create a Universe to encapsulate a fuel pin\n",
|
|
"pin_cell_universe = openmc.Universe(name='1.6% Fuel Pin')\n",
|
|
"\n",
|
|
"# Create fuel Cell\n",
|
|
"fuel_cell = openmc.Cell(name='1.6% Fuel')\n",
|
|
"fuel_cell.fill = fuel\n",
|
|
"fuel_cell.region = -fuel_outer_radius\n",
|
|
"pin_cell_universe.add_cell(fuel_cell)\n",
|
|
"\n",
|
|
"# Create a clad Cell\n",
|
|
"clad_cell = openmc.Cell(name='1.6% Clad')\n",
|
|
"clad_cell.fill = zircaloy\n",
|
|
"clad_cell.region = +fuel_outer_radius & -clad_outer_radius\n",
|
|
"pin_cell_universe.add_cell(clad_cell)\n",
|
|
"\n",
|
|
"# Create a moderator Cell\n",
|
|
"moderator_cell = openmc.Cell(name='1.6% Moderator')\n",
|
|
"moderator_cell.fill = water\n",
|
|
"moderator_cell.region = +clad_outer_radius\n",
|
|
"pin_cell_universe.add_cell(moderator_cell)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"OpenMC requires that there is a \"root\" universe. Let us create a root cell that is filled by the pin cell universe and then assign it to the root universe."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create root Cell\n",
|
|
"root_cell = openmc.Cell(name='root cell')\n",
|
|
"root_cell.fill = pin_cell_universe\n",
|
|
"\n",
|
|
"# Add boundary planes\n",
|
|
"root_cell.region = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z\n",
|
|
"\n",
|
|
"# Create root Universe\n",
|
|
"root_universe = openmc.Universe(universe_id=0, name='root universe')\n",
|
|
"root_universe.add_cell(root_cell)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We now must create a geometry that is assigned a root universe, put the geometry into a geometry file, and export it to XML."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create Geometry and set root Universe\n",
|
|
"geometry = openmc.Geometry()\n",
|
|
"geometry.root_universe = root_universe"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Export to \"geometry.xml\"\n",
|
|
"geometry.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With the geometry and materials finished, we now just need to define simulation parameters. In this case, we will use 5 inactive batches and 15 active batches each with 2500 particles."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# OpenMC simulation parameters\n",
|
|
"batches = 20\n",
|
|
"inactive = 5\n",
|
|
"particles = 2500\n",
|
|
"\n",
|
|
"# Instantiate a Settings object\n",
|
|
"settings_file = openmc.Settings()\n",
|
|
"settings_file.batches = batches\n",
|
|
"settings_file.inactive = inactive\n",
|
|
"settings_file.particles = particles\n",
|
|
"settings_file.output = {'tallies': True}\n",
|
|
"\n",
|
|
"# Create an initial uniform spatial source distribution over fissionable zones\n",
|
|
"bounds = [-0.63, -0.63, -0.63, 0.63, 0.63, 0.63]\n",
|
|
"uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)\n",
|
|
"settings_file.source = openmc.source.Source(space=uniform_dist)\n",
|
|
"\n",
|
|
"# Export to \"settings.xml\"\n",
|
|
"settings_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Let us also create a plot file that we can use to verify that our pin cell geometry was created successfully."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate a Plot\n",
|
|
"plot = openmc.Plot(plot_id=1)\n",
|
|
"plot.filename = 'materials-xy'\n",
|
|
"plot.origin = [0, 0, 0]\n",
|
|
"plot.width = [1.26, 1.26]\n",
|
|
"plot.pixels = [250, 250]\n",
|
|
"plot.color = 'mat'\n",
|
|
"\n",
|
|
"# Instantiate a Plots collection and export to \"plots.xml\"\n",
|
|
"plot_file = openmc.Plots([plot])\n",
|
|
"plot_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With the plots.xml file, we can now generate and view the plot. OpenMC outputs plots in .ppm format, which can be converted into a compressed format like .png with the convert utility."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0"
|
|
]
|
|
},
|
|
"execution_count": 12,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Run openmc in plotting mode\n",
|
|
"openmc.plot_geometry(output=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///9yEhLpgJFNv8Tq\nQYT7AAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AFBRQzLY81/IkAAALKSURBVGje7dpLcqQwDAbgHHE2\nYeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmNP+HDhw8fPnz48Kf6VH9G\n+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYbyodx3ze+XLE76cXFiD4zPji99z0/AJ4n1lfvJ6f\nnl0A6x+578efMSg1wPr172/jPO5yFXM+Ef78gdblM+WPHyguP//t1/g6pA0wfln+ho/fwgYYn19C\n/xwDvwHGc9OvC+hs37DTrwuwfWanXxdQTC9Mvyygs3wjTL8uwPJpn/tNDbSGz7T0SBEWw4vLXzbQ\n6b6RoveIoO6TvPxlA63qs7z8ZQPF9F+SH22vbX8OQKf5Rtv+EgDNJ3X58wZaxWd1+fMGiuFvir8b\nvjp8J/tGy/6jAmRvhW8fwL3vVT+o3grfPoB7r/IpALI3tz8FoJN84/NV873hB8UnM3xzANtf8nb4\ndwmg3grfFEDJO8JPE0i9Ff4pAYL3pI8mkHor/HMCeO9JH00g9SafEsh7T/ppARBvp48UwJnelT5S\nACd7O31TAlnvKx9SQCd7B58KgPO+8iMFuPWe9E8F8BveWX7bAjzX9y4//Jve+fhsH6Ctv7n8PTzj\nvY/v9gEOHz58+PBX+6v/f/wPvnd54f3j6venE/yl769Xv7+j3x/o98/V32/o9+fl389Xnx+g5x/o\n+Qt6/oOeP6HnX+j5G3z+h54/ouefV5/foufP6Pk3ev4On/+j9w/o/Qd6/4Le/6D3T/D9V67Y/ZsV\nQBq+s+8f0ftP+P41axXguP9NWgDuu/Cdfv+N3r/D9/9TAID+A7T/Ae2/gPs/0P4TtP8F7r9J3AIO\n9P+g/Udw/9Oygbf7r9D+L7j/DO1/Q/vv4P4/tP8Q7n9E+y/h/k+0/xTuf4X7b+H+X7T/+BPuf3aM\n8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTYtMDUtMDVUMTQ6NTE6\nNDUtMDY6MDCqOITjAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTA1LTA1VDE0OjUxOjQ1LTA2OjAw\n22U8XwAAAABJRU5ErkJggg==\n",
|
|
"text/plain": [
|
|
"<IPython.core.display.Image object>"
|
|
]
|
|
},
|
|
"execution_count": 13,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Convert OpenMC's funky ppm to png\n",
|
|
"!convert materials-xy.ppm materials-xy.png\n",
|
|
"\n",
|
|
"# Display the materials plot inline\n",
|
|
"Image(filename='materials-xy.png')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"As we can see from the plot, we have a nice pin cell with fuel, cladding, and water! Before we run our simulation, we need to tell the code what we want to tally. The following code shows how to create a variety of tallies."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 14,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate an empty Tallies object\n",
|
|
"tallies_file = openmc.Tallies()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 15,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 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",
|
|
"\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.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.append(energy_filter)\n",
|
|
"tally.scores = ['nu-fission', 'scatter']\n",
|
|
"tally.nuclides = [u238, u235]\n",
|
|
"tallies_file.append(tally)\n",
|
|
"\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.append(energy_filter)\n",
|
|
"tally.scores = ['absorption', 'total']\n",
|
|
"tally.nuclides = [o16, h1]\n",
|
|
"tallies_file.append(tally)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 16,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# K-Eigenvalue (infinity) tallies\n",
|
|
"fiss_rate = openmc.Tally(name='fiss. rate')\n",
|
|
"abs_rate = openmc.Tally(name='abs. rate')\n",
|
|
"fiss_rate.scores = ['nu-fission']\n",
|
|
"abs_rate.scores = ['absorption']\n",
|
|
"tallies_file += (fiss_rate, abs_rate)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 17,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 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",
|
|
"tallies_file.append(therm_abs_rate)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 18,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 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",
|
|
"tallies_file.append(fuel_therm_abs_rate)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 19,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 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",
|
|
"tallies_file.append(therm_fiss_rate)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 20,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate energy filter to illustrate Tally slicing\n",
|
|
"energy_filter = openmc.Filter(type='energy', bins=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.append(energy_filter)\n",
|
|
"tally.scores = ['nu-fission', 'scatter']\n",
|
|
"tally.nuclides = [h1, u238]\n",
|
|
"tallies_file.append(tally)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 21,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Export to \"tallies.xml\"\n",
|
|
"tallies_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we a have a complete set of inputs, so we can go ahead and run our simulation."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 22,
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"scrolled": true
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
" .d88888b. 888b d888 .d8888b.\n",
|
|
" d88P\" \"Y88b 8888b d8888 d88P Y88b\n",
|
|
" 888 888 88888b.d88888 888 888\n",
|
|
" 888 888 88888b. .d88b. 88888b. 888Y88888P888 888 \n",
|
|
" 888 888 888 \"88b d8P Y8b 888 \"88b 888 Y888P 888 888 \n",
|
|
" 888 888 888 888 88888888 888 888 888 Y8P 888 888 888\n",
|
|
" Y88b. .d88P 888 d88P Y8b. 888 888 888 \" 888 Y88b d88P\n",
|
|
" \"Y88888P\" 88888P\" \"Y8888 888 888 888 888 \"Y8888P\"\n",
|
|
"__________________888______________________________________________________\n",
|
|
" 888\n",
|
|
" 888\n",
|
|
"\n",
|
|
" Copyright: 2011-2016 Massachusetts Institute of Technology\n",
|
|
" License: http://openmc.readthedocs.org/en/latest/license.html\n",
|
|
" Version: 0.7.1\n",
|
|
" Git SHA1: df280b60eb1c6d7b7f842e05ede734a4883a0fc8\n",
|
|
" Date/Time: 2016-05-05 14:51:45\n",
|
|
"\n",
|
|
" ===========================================================================\n",
|
|
" ========================> INITIALIZATION <=========================\n",
|
|
" ===========================================================================\n",
|
|
"\n",
|
|
" Reading settings XML file...\n",
|
|
" Reading cross sections XML file...\n",
|
|
" Reading geometry XML file...\n",
|
|
" Reading materials XML file...\n",
|
|
" Reading tallies XML file...\n",
|
|
" Building neighboring cells lists for each surface...\n",
|
|
" Loading ACE cross section table: 92235.71c\n",
|
|
" Loading ACE cross section table: 92238.71c\n",
|
|
" Loading ACE cross section table: 8016.71c\n",
|
|
" Loading ACE cross section table: 1001.71c\n",
|
|
" Loading ACE cross section table: 5010.71c\n",
|
|
" Loading ACE cross section table: 40090.71c\n",
|
|
" Maximum neutron transport energy: 20.0000 MeV for 92235.71c\n",
|
|
" Initializing source particles...\n",
|
|
"\n",
|
|
" ===========================================================================\n",
|
|
" ====================> K EIGENVALUE SIMULATION <====================\n",
|
|
" ===========================================================================\n",
|
|
"\n",
|
|
" Bat./Gen. k Average k \n",
|
|
" ========= ======== ==================== \n",
|
|
" 1/1 1.03471 \n",
|
|
" 2/1 1.03257 \n",
|
|
" 3/1 1.00600 \n",
|
|
" 4/1 1.04547 \n",
|
|
" 5/1 1.02287 \n",
|
|
" 6/1 1.05752 \n",
|
|
" 7/1 1.04283 1.05017 +/- 0.00734\n",
|
|
" 8/1 1.05189 1.05074 +/- 0.00428\n",
|
|
" 9/1 1.01645 1.04217 +/- 0.00909\n",
|
|
" 10/1 1.04978 1.04369 +/- 0.00721\n",
|
|
" 11/1 1.03459 1.04218 +/- 0.00608\n",
|
|
" 12/1 1.04019 1.04189 +/- 0.00514\n",
|
|
" 13/1 1.05985 1.04414 +/- 0.00499\n",
|
|
" 14/1 1.02111 1.04158 +/- 0.00509\n",
|
|
" 15/1 1.04774 1.04219 +/- 0.00459\n",
|
|
" 16/1 1.00733 1.03902 +/- 0.00523\n",
|
|
" 17/1 1.02224 1.03763 +/- 0.00497\n",
|
|
" 18/1 1.03263 1.03724 +/- 0.00459\n",
|
|
" 19/1 1.01611 1.03573 +/- 0.00451\n",
|
|
" 20/1 1.04692 1.03648 +/- 0.00426\n",
|
|
" Creating state point statepoint.20.h5...\n",
|
|
"\n",
|
|
" ===========================================================================\n",
|
|
" ======================> SIMULATION FINISHED <======================\n",
|
|
" ===========================================================================\n",
|
|
"\n",
|
|
"\n",
|
|
" =======================> TIMING STATISTICS <=======================\n",
|
|
"\n",
|
|
" Total time for initialization = 7.2500E-01 seconds\n",
|
|
" Reading cross sections = 4.4400E-01 seconds\n",
|
|
" Total time in simulation = 1.5547E+01 seconds\n",
|
|
" Time in transport only = 1.5527E+01 seconds\n",
|
|
" Time in inactive batches = 2.2880E+00 seconds\n",
|
|
" Time in active batches = 1.3259E+01 seconds\n",
|
|
" Time synchronizing fission bank = 1.0000E-03 seconds\n",
|
|
" Sampling source sites = 0.0000E+00 seconds\n",
|
|
" SEND/RECV source sites = 0.0000E+00 seconds\n",
|
|
" Time accumulating tallies = 1.0000E-03 seconds\n",
|
|
" Total time for finalization = 2.0000E-03 seconds\n",
|
|
" Total time elapsed = 1.6291E+01 seconds\n",
|
|
" Calculation Rate (inactive) = 5463.29 neutrons/second\n",
|
|
" Calculation Rate (active) = 2828.27 neutrons/second\n",
|
|
"\n",
|
|
" ============================> RESULTS <============================\n",
|
|
"\n",
|
|
" k-effective (Collision) = 1.03296 +/- 0.00669\n",
|
|
" k-effective (Track-length) = 1.03648 +/- 0.00426\n",
|
|
" k-effective (Absorption) = 1.03431 +/- 0.00702\n",
|
|
" Combined k-effective = 1.03621 +/- 0.00456\n",
|
|
" Leakage Fraction = 0.00000 +/- 0.00000\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0"
|
|
]
|
|
},
|
|
"execution_count": 22,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Remove old HDF5 (summary, statepoint) files\n",
|
|
"!rm statepoint.*\n",
|
|
"\n",
|
|
"# Run OpenMC!\n",
|
|
"openmc.run()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Tally Data Processing"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Our simulation ran successfully and created a statepoint file with all the tally data in it. We begin our analysis here loading the statepoint file and 'reading' the results. By default, the tally results are not read into memory because they might be large, even large enough to exceed the available memory on a computer."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 23,
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Load the statepoint file\n",
|
|
"sp = openmc.StatePoint('statepoint.20.h5')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We have a tally of the total fission rate and the total absorption rate, so we can calculate k-infinity as:\n",
|
|
"$$k_\\infty = \\frac{\\langle \\nu \\Sigma_f \\phi \\rangle}{\\langle \\Sigma_a \\phi \\rangle}$$\n",
|
|
"In this notation, $\\langle \\cdot \\rangle^a_b$ represents an OpenMC that is integrated over region $a$ and energy range $b$. If $a$ or $b$ is not reported, it means the value represents an integral over all space or all energy, respectively."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 24,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\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.038387</td>\n",
|
|
" <td>0.006141</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" nuclide score mean std. dev.\n",
|
|
"0 total (nu-fission / absorption) 1.04e+00 6.14e-03"
|
|
]
|
|
},
|
|
"execution_count": 24,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Compute k-infinity using tally arithmetic\n",
|
|
"fiss_rate = sp.get_tally(name='fiss. rate')\n",
|
|
"abs_rate = sp.get_tally(name='abs. rate')\n",
|
|
"keff = fiss_rate / abs_rate\n",
|
|
"keff.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Notice that even though the neutron production rate and absorption rate are separate tallies, we still get a first-order estimate of the uncertainty on the quotient of them automatically!\n",
|
|
"\n",
|
|
"Often in textbooks you'll see k-infinity represented using the four-factor formula $$k_\\infty = p \\epsilon f \\eta.$$ Let's analyze each of these factors, starting with the resonance escape probability which is defined as $$p=\\frac{\\langle\\Sigma_a\\phi\\rangle_T}{\\langle\\Sigma_a\\phi\\rangle}$$ where the subscript $T$ means thermal energies."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 25,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.0</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>total</td>\n",
|
|
" <td>absorption</td>\n",
|
|
" <td>0.693337</td>\n",
|
|
" <td>0.004109</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" energy low [MeV] energy high [MeV] nuclide score mean std. dev.\n",
|
|
"0 0.00e+00 6.25e-07 total absorption 6.93e-01 4.11e-03"
|
|
]
|
|
},
|
|
"execution_count": 25,
|
|
"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",
|
|
"res_esc = therm_abs_rate / abs_rate\n",
|
|
"res_esc.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The fast fission factor can be calculated as\n",
|
|
"$$\\epsilon=\\frac{\\langle\\nu\\Sigma_f\\phi\\rangle}{\\langle\\nu\\Sigma_f\\phi\\rangle_T}$$"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 26,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.0</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>total</td>\n",
|
|
" <td>nu-fission</td>\n",
|
|
" <td>1.203042</td>\n",
|
|
" <td>0.0076</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" energy low [MeV] energy high [MeV] nuclide score mean std. dev.\n",
|
|
"0 0.00e+00 6.25e-07 total nu-fission 1.20e+00 7.60e-03"
|
|
]
|
|
},
|
|
"execution_count": 26,
|
|
"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",
|
|
"fast_fiss = fiss_rate / therm_fiss_rate\n",
|
|
"fast_fiss.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The thermal flux utilization is calculated as\n",
|
|
"$$f=\\frac{\\langle\\Sigma_a\\phi\\rangle^F_T}{\\langle\\Sigma_a\\phi\\rangle_T}$$\n",
|
|
"where the superscript $F$ denotes fuel."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 27,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.0</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>total</td>\n",
|
|
" <td>absorption</td>\n",
|
|
" <td>0.748413</td>\n",
|
|
" <td>0.004723</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" energy low [MeV] energy high [MeV] cell nuclide score mean \\\n",
|
|
"0 0.00e+00 6.25e-07 10000 total absorption 7.48e-01 \n",
|
|
"\n",
|
|
" std. dev. \n",
|
|
"0 4.72e-03 "
|
|
]
|
|
},
|
|
"execution_count": 27,
|
|
"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",
|
|
"therm_util = fuel_therm_abs_rate / therm_abs_rate\n",
|
|
"therm_util.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The final factor is the number of fission neutrons produced per absorption in fuel, calculated as $$\\eta = \\frac{\\langle \\nu\\Sigma_f\\phi \\rangle_T}{\\langle \\Sigma_a \\phi \\rangle^F_T}$$"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 28,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.0</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>total</td>\n",
|
|
" <td>(nu-fission / absorption)</td>\n",
|
|
" <td>1.663385</td>\n",
|
|
" <td>0.011253</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" energy low [MeV] energy high [MeV] cell nuclide \\\n",
|
|
"0 0.00e+00 6.25e-07 10000 total \n",
|
|
"\n",
|
|
" score mean std. dev. \n",
|
|
"0 (nu-fission / absorption) 1.66e+00 1.13e-02 "
|
|
]
|
|
},
|
|
"execution_count": 28,
|
|
"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",
|
|
"eta.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we can calculate $k_\\infty$ using the product of the factors form the four-factor formula."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 29,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.0</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>total</td>\n",
|
|
" <td>(((absorption * nu-fission) * absorption) * (n...</td>\n",
|
|
" <td>1.038387</td>\n",
|
|
" <td>0.01316</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" energy low [MeV] energy high [MeV] cell nuclide \\\n",
|
|
"0 0.00e+00 6.25e-07 10000 total \n",
|
|
"\n",
|
|
" score mean std. dev. \n",
|
|
"0 (((absorption * nu-fission) * absorption) * (n... 1.04e+00 1.32e-02 "
|
|
]
|
|
},
|
|
"execution_count": 29,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"keff = res_esc * fast_fiss * therm_util * eta\n",
|
|
"keff.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We see that the value we've obtained here has exactly the same mean as before. However, because of the way it was calculated, the standard deviation appears to be larger.\n",
|
|
"\n",
|
|
"Let's move on to a more complicated example now. Before we set up tallies to get reaction rates in the fuel and moderator in two energy groups for two different nuclides. We can use tally arithmetic to divide each of these reaction rates by the flux to get microscopic multi-group cross sections."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 30,
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"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",
|
|
"fuel_rxn_rates = sp.get_tally(name='fuel rxn rates')\n",
|
|
"mod_rxn_rates = sp.get_tally(name='moderator rxn rates')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 31,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>cell</th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.000000e+00</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>(U-238 / total)</td>\n",
|
|
" <td>(nu-fission / flux)</td>\n",
|
|
" <td>6.636968e-07</td>\n",
|
|
" <td>4.132875e-09</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>0.000000e+00</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>(U-238 / total)</td>\n",
|
|
" <td>(scatter / flux)</td>\n",
|
|
" <td>2.099856e-01</td>\n",
|
|
" <td>1.232455e-03</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>0.000000e+00</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>(U-235 / total)</td>\n",
|
|
" <td>(nu-fission / flux)</td>\n",
|
|
" <td>3.552458e-01</td>\n",
|
|
" <td>2.252681e-03</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>0.000000e+00</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>(U-235 / total)</td>\n",
|
|
" <td>(scatter / flux)</td>\n",
|
|
" <td>5.554345e-03</td>\n",
|
|
" <td>3.265385e-05</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>(U-238 / total)</td>\n",
|
|
" <td>(nu-fission / flux)</td>\n",
|
|
" <td>7.126668e-03</td>\n",
|
|
" <td>5.296883e-05</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>(U-238 / total)</td>\n",
|
|
" <td>(scatter / flux)</td>\n",
|
|
" <td>2.277460e-01</td>\n",
|
|
" <td>1.003558e-03</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>(U-235 / total)</td>\n",
|
|
" <td>(nu-fission / flux)</td>\n",
|
|
" <td>8.010911e-03</td>\n",
|
|
" <td>6.802256e-05</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>(U-235 / total)</td>\n",
|
|
" <td>(scatter / flux)</td>\n",
|
|
" <td>3.367794e-03</td>\n",
|
|
" <td>1.443644e-05</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" cell energy low [MeV] energy high [MeV] nuclide \\\n",
|
|
"0 10000 0.00e+00 6.25e-07 (U-238 / total) \n",
|
|
"1 10000 0.00e+00 6.25e-07 (U-238 / total) \n",
|
|
"2 10000 0.00e+00 6.25e-07 (U-235 / total) \n",
|
|
"3 10000 0.00e+00 6.25e-07 (U-235 / total) \n",
|
|
"4 10000 6.25e-07 2.00e+01 (U-238 / total) \n",
|
|
"5 10000 6.25e-07 2.00e+01 (U-238 / total) \n",
|
|
"6 10000 6.25e-07 2.00e+01 (U-235 / total) \n",
|
|
"7 10000 6.25e-07 2.00e+01 (U-235 / total) \n",
|
|
"\n",
|
|
" score mean std. dev. \n",
|
|
"0 (nu-fission / flux) 6.64e-07 4.13e-09 \n",
|
|
"1 (scatter / flux) 2.10e-01 1.23e-03 \n",
|
|
"2 (nu-fission / flux) 3.55e-01 2.25e-03 \n",
|
|
"3 (scatter / flux) 5.55e-03 3.27e-05 \n",
|
|
"4 (nu-fission / flux) 7.13e-03 5.30e-05 \n",
|
|
"5 (scatter / flux) 2.28e-01 1.00e-03 \n",
|
|
"6 (nu-fission / flux) 8.01e-03 6.80e-05 \n",
|
|
"7 (scatter / flux) 3.37e-03 1.44e-05 "
|
|
]
|
|
},
|
|
"execution_count": 31,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"fuel_xs = fuel_rxn_rates / flux\n",
|
|
"fuel_xs.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We see that when the two tallies with multiple bins were divided, the derived tally contains the outer product of the combinations. If the filters/scores are the same, no outer product is needed. The `get_values(...)` method allows us to obtain a subset of tally scores. In the following example, we obtain just the neutron production microscopic cross sections."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 32,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[[[ 6.63696783e-07]\n",
|
|
" [ 3.55245846e-01]]\n",
|
|
"\n",
|
|
" [[ 7.12666800e-03]\n",
|
|
" [ 8.01091088e-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",
|
|
"print(nu_fiss_xs)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The same idea can be used not only for scores but also for filters and nuclides."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 33,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[[[ 0.00555435]]\n",
|
|
"\n",
|
|
" [[ 0.00336779]]]\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",
|
|
" scores=['(scatter / flux)'])\n",
|
|
"print(u235_scatter_xs)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 34,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[[[ 0.22774598]\n",
|
|
" [ 0.00336779]]]\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",
|
|
" filter_bins=[((0.625e-6, 20.),)], \n",
|
|
" scores=['(scatter / flux)'])\n",
|
|
"print(fast_scatter_xs)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"A more advanced method is to use `get_slice(...)` to create a new derived tally that is a subset of an existing tally. This has the benefit that we can use `get_pandas_dataframe()` to see the tallies in a more human-readable format."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 35,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>cell</th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.000000e+00</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>U-238</td>\n",
|
|
" <td>nu-fission</td>\n",
|
|
" <td>0.000002</td>\n",
|
|
" <td>7.473789e-09</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>0.000000e+00</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>U-235</td>\n",
|
|
" <td>nu-fission</td>\n",
|
|
" <td>0.861547</td>\n",
|
|
" <td>4.131310e-03</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>U-238</td>\n",
|
|
" <td>nu-fission</td>\n",
|
|
" <td>0.082356</td>\n",
|
|
" <td>5.560461e-04</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>10000</td>\n",
|
|
" <td>6.250000e-07</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>U-235</td>\n",
|
|
" <td>nu-fission</td>\n",
|
|
" <td>0.092574</td>\n",
|
|
" <td>7.315442e-04</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" cell energy low [MeV] energy high [MeV] nuclide score mean \\\n",
|
|
"0 10000 0.00e+00 6.25e-07 U-238 nu-fission 1.61e-06 \n",
|
|
"1 10000 0.00e+00 6.25e-07 U-235 nu-fission 8.62e-01 \n",
|
|
"2 10000 6.25e-07 2.00e+01 U-238 nu-fission 8.24e-02 \n",
|
|
"3 10000 6.25e-07 2.00e+01 U-235 nu-fission 9.26e-02 \n",
|
|
"\n",
|
|
" std. dev. \n",
|
|
"0 7.47e-09 \n",
|
|
"1 4.13e-03 \n",
|
|
"2 5.56e-04 \n",
|
|
"3 7.32e-04 "
|
|
]
|
|
},
|
|
"execution_count": 35,
|
|
"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",
|
|
"nu_fission_rates.get_pandas_dataframe()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 36,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>cell</th>\n",
|
|
" <th>energy low [MeV]</th>\n",
|
|
" <th>energy high [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.000000e-08</td>\n",
|
|
" <td>1.080060e-07</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>4.599225</td>\n",
|
|
" <td>0.015973</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.080060e-07</td>\n",
|
|
" <td>1.166529e-06</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>2.037260</td>\n",
|
|
" <td>0.011236</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.166529e-06</td>\n",
|
|
" <td>1.259921e-05</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>1.662552</td>\n",
|
|
" <td>0.010280</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.259921e-05</td>\n",
|
|
" <td>1.360790e-04</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>1.872201</td>\n",
|
|
" <td>0.012136</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.360790e-04</td>\n",
|
|
" <td>1.469734e-03</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>2.080459</td>\n",
|
|
" <td>0.013155</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.469734e-03</td>\n",
|
|
" <td>1.587401e-02</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>2.154996</td>\n",
|
|
" <td>0.011975</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.587401e-02</td>\n",
|
|
" <td>1.714488e-01</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>2.218740</td>\n",
|
|
" <td>0.008528</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.714488e-01</td>\n",
|
|
" <td>1.851749e+00</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>2.010517</td>\n",
|
|
" <td>0.009187</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>10002</td>\n",
|
|
" <td>1.851749e+00</td>\n",
|
|
" <td>2.000000e+01</td>\n",
|
|
" <td>H-1</td>\n",
|
|
" <td>scatter</td>\n",
|
|
" <td>0.372022</td>\n",
|
|
" <td>0.003196</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" cell energy low [MeV] energy high [MeV] nuclide score mean \\\n",
|
|
"0 10002 1.00e-08 1.08e-07 H-1 scatter 4.60e+00 \n",
|
|
"1 10002 1.08e-07 1.17e-06 H-1 scatter 2.04e+00 \n",
|
|
"2 10002 1.17e-06 1.26e-05 H-1 scatter 1.66e+00 \n",
|
|
"3 10002 1.26e-05 1.36e-04 H-1 scatter 1.87e+00 \n",
|
|
"4 10002 1.36e-04 1.47e-03 H-1 scatter 2.08e+00 \n",
|
|
"5 10002 1.47e-03 1.59e-02 H-1 scatter 2.15e+00 \n",
|
|
"6 10002 1.59e-02 1.71e-01 H-1 scatter 2.22e+00 \n",
|
|
"7 10002 1.71e-01 1.85e+00 H-1 scatter 2.01e+00 \n",
|
|
"8 10002 1.85e+00 2.00e+01 H-1 scatter 3.72e-01 \n",
|
|
"\n",
|
|
" std. dev. \n",
|
|
"0 1.60e-02 \n",
|
|
"1 1.12e-02 \n",
|
|
"2 1.03e-02 \n",
|
|
"3 1.21e-02 \n",
|
|
"4 1.32e-02 \n",
|
|
"5 1.20e-02 \n",
|
|
"6 8.53e-03 \n",
|
|
"7 9.19e-03 \n",
|
|
"8 3.20e-03 "
|
|
]
|
|
},
|
|
"execution_count": 36,
|
|
"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",
|
|
"slice_test = need_to_slice.get_slice(scores=['scatter'], nuclides=['H-1'],\n",
|
|
" filters=['cell'], filter_bins=[(moderator_cell.id,)])\n",
|
|
"slice_test.get_pandas_dataframe()"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.5.1"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0
|
|
}
|