mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-24 20:15:26 -04:00
1461 lines
65 KiB
Text
1461 lines
65 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"This Notebook illustrates the use of the openmc.mgxs.Library class specifically for application in OpenMC's multi-group mode. This example notebook follows the same process as was done in MGXS Part III, but instead uses OpenMC as the multi-group solver. During this process, this notebook will illustrate the following features:\n",
|
|
"\n",
|
|
" - Calculation of multi-group cross sections for a fuel assembly\n",
|
|
" - Automated creation and storage of MGXS with openmc.mgxs.Library\n",
|
|
" - Steady-state pin-by-pin fission rates comparison between continuous-energy and multi-group OpenMC.\n",
|
|
"\n",
|
|
"Note: This Notebook illustrates the use of Pandas DataFrames to containerize multi-group cross section data. We recommend using Pandas >v0.15.0 or later since OpenMC's Python API leverages the multi-indexing feature included in the most recent releases of Pandas.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Generate Input Files"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import math\n",
|
|
"import pickle\n",
|
|
"\n",
|
|
"from IPython.display import Image\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"import numpy as np\n",
|
|
"import os\n",
|
|
"\n",
|
|
"import openmc\n",
|
|
"import openmc.mgxs\n",
|
|
"\n",
|
|
"%matplotlib inline"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"\n",
|
|
"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 pins."
|
|
]
|
|
},
|
|
{
|
|
"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",
|
|
"# zircaloy\n",
|
|
"zircaloy = openmc.Material(name='Zircaloy')\n",
|
|
"zircaloy.set_density('g/cm3', 6.55)\n",
|
|
"zircaloy.add_nuclide(zr90, 7.2758e-3)\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"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With our three materials, we can now create a Materials object that can be exported to an actual XML file."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate a Materials object\n",
|
|
"materials_file = openmc.Materials((fuel, zircaloy, water))\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. This problem will be a square array of fuel pins and control rod guide tubes for which we can use OpenMC's lattice/universe feature. The basic universe will have three regions for the fuel, the clad, and the surrounding coolant. The first step is to create the bounding surfaces for fuel and clad, as well as the outer bounding surfaces of the problem."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"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",
|
|
"min_x = openmc.XPlane(x0=-10.71, boundary_type='reflective')\n",
|
|
"max_x = openmc.XPlane(x0=+10.71, boundary_type='reflective')\n",
|
|
"min_y = openmc.YPlane(y0=-10.71, boundary_type='reflective')\n",
|
|
"max_y = openmc.YPlane(y0=+10.71, boundary_type='reflective')\n",
|
|
"min_z = openmc.ZPlane(z0=-10., boundary_type='reflective')\n",
|
|
"max_z = openmc.ZPlane(z0=+10., boundary_type='reflective')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With the surfaces defined, we can now construct a fuel pin cell from 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",
|
|
"fuel_pin_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",
|
|
"fuel_pin_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",
|
|
"fuel_pin_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",
|
|
"fuel_pin_universe.add_cell(moderator_cell)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Likewise, we can construct a control rod guide tube with the same surfaces."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create a Universe to encapsulate a control rod guide tube\n",
|
|
"guide_tube_universe = openmc.Universe(name='Guide Tube')\n",
|
|
"\n",
|
|
"# Create guide tube Cell\n",
|
|
"guide_tube_cell = openmc.Cell(name='Guide Tube Water')\n",
|
|
"guide_tube_cell.fill = water\n",
|
|
"guide_tube_cell.region = -fuel_outer_radius\n",
|
|
"guide_tube_universe.add_cell(guide_tube_cell)\n",
|
|
"\n",
|
|
"# Create a clad Cell\n",
|
|
"clad_cell = openmc.Cell(name='Guide Clad')\n",
|
|
"clad_cell.fill = zircaloy\n",
|
|
"clad_cell.region = +fuel_outer_radius & -clad_outer_radius\n",
|
|
"guide_tube_universe.add_cell(clad_cell)\n",
|
|
"\n",
|
|
"# Create a moderator Cell\n",
|
|
"moderator_cell = openmc.Cell(name='Guide Tube Moderator')\n",
|
|
"moderator_cell.fill = water\n",
|
|
"moderator_cell.region = +clad_outer_radius\n",
|
|
"guide_tube_universe.add_cell(moderator_cell)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Using the pin cell universe, we can construct a 17x17 rectangular lattice with a 1.26 cm pitch."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create fuel assembly Lattice\n",
|
|
"assembly = openmc.RectLattice(name='1.6% Fuel Assembly')\n",
|
|
"assembly.pitch = (1.26, 1.26)\n",
|
|
"assembly.lower_left = [-1.26 * 17. / 2.0] * 2"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Next, we create a NumPy array of fuel pin and guide tube universes for the lattice."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create array indices for guide tube locations in lattice\n",
|
|
"template_x = np.array([5, 8, 11, 3, 13, 2, 5, 8, 11, 14, 2, 5, 8,\n",
|
|
" 11, 14, 2, 5, 8, 11, 14, 3, 13, 5, 8, 11])\n",
|
|
"template_y = np.array([2, 2, 2, 3, 3, 5, 5, 5, 5, 5, 8, 8, 8, 8,\n",
|
|
" 8, 11, 11, 11, 11, 11, 13, 13, 14, 14, 14])\n",
|
|
"\n",
|
|
"# Initialize an empty 17x17 array of the lattice universes\n",
|
|
"universes = np.empty((17, 17), dtype=openmc.Universe)\n",
|
|
"\n",
|
|
"# Fill the array with the fuel pin and guide tube universes\n",
|
|
"universes[:,:] = fuel_pin_universe\n",
|
|
"universes[template_x, template_y] = guide_tube_universe\n",
|
|
"\n",
|
|
"# Store the array of universes in the lattice\n",
|
|
"assembly.universes = universes"
|
|
]
|
|
},
|
|
{
|
|
"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": 10,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create root Cell\n",
|
|
"root_cell = openmc.Cell(name='root cell')\n",
|
|
"root_cell.fill = assembly\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(name='root universe', universe_id=0)\n",
|
|
"root_universe.add_cell(root_cell)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We now must create a geometry that is assigned a root universe and export it to XML."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create Geometry and set root Universe\n",
|
|
"geometry = openmc.Geometry()\n",
|
|
"geometry.root_universe = root_universe\n",
|
|
"# 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 10 inactive batches and 40 active batches each with 5000 particles."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# OpenMC simulation parameters\n",
|
|
"batches = 50\n",
|
|
"inactive = 10\n",
|
|
"particles = 5000\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': False}\n",
|
|
"\n",
|
|
"# Create an initial uniform spatial source distribution over fissionable zones\n",
|
|
"bounds = [-10.71, -10.71, -10, 10.71, 10.71, 10.]\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 Plots file that we can use to verify that our fuel assembly geometry was created successfully."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate a Plot\n",
|
|
"plot = openmc.Plot()\n",
|
|
"plot.filename = 'materials-xy'\n",
|
|
"plot.origin = [0, 0, 0]\n",
|
|
"plot.pixels = [250, 250]\n",
|
|
"plot.width = [-10.71*2, -10.71*2]\n",
|
|
"plot.color = 'mat'\n",
|
|
"\n",
|
|
"# Instantiate a Plots object, add Plot, 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": 14,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0"
|
|
]
|
|
},
|
|
"execution_count": 14,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Run openmc in plotting mode\n",
|
|
"openmc.plot_geometry(output=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 15,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX////pgJFyEhJNv8RV\nUZDeAAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AGCBMhJtCW4VoAAAWFSURBVGje7Zs7cttADIZ9CSvX\ncrP0iCxUqbBc8Ag6xR6BhV2EvYvwFD4CCx1ABT1jMdgndpegRQnOrCbjpPlGESISC4A/gd27e8H5\n83CX3b4+iKJrRHkS4vkghMPBonRYWGwtfgD2YN+dRDUOoh6lACw0Noi9w2fESuEoAR/uVuMolX03\n9oXGT7F3eFL2iEfhUX1f4cPdL/ishs+68ai+udE4xPhexbjX2FfjGNoPj/DPNX4Tsd+EODr8FvsV\ndf1Hd9P2VvCi4+s/aXvrf+upAD+1/9GV1mkOH5X9vV6THtfvACslcaUCbESL61drBPtdI8SrFMWr\nELsXCkuFDYW75gbiP7d9Cf7bAYI/aCwUShrBvh30+lWQkzVgZ/HD4OixNCgcQpJ3BxU/Ln91elKo\nM5VEE38QtJ+Yv6cQ9xjKNYayyl8TypP8DfJnQ2H/b/N3ye9P83cT33SQv/sQh9gV7zZ/0dNj5HQa\nC5vVzv9+/WFN2w8KVaZ2BwL1+pv4g0x1QRfjq0dB4Q3kT277oP6VNL6gKxNU9a8zK+WLbi/Wwpdi\nhbboKqyxFOulHMj6v4W/AXbmUeAxrv9J/CqEBXa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n9z23PkXc/7Gnf9x5483q38Xzn+582fu/Js9fy8kb/6fO39y23P3n3S8\n/S/c/Tfc/T83uX/pgv1XE/9duP+Lu/+Mvf8td/znti8kb/8ld/9nx9t/Sjw/Ltr/yt1/+337f6/b\nf0zoB3nJ/ucVc/81d/83e/957vzJbc89/8A8f8E9/5HE78XnT/4H/cs5f8Q9/8Q9f8U+/5U7f3Lb\nc88fdrzzjyvm+cuf/Uu887/c88fs88954/8vO4SjPC+2QRIAAAAldEVYdGRhdGU6Y3JlYXRlADIw\nMTYtMDYtMDhUMTk6MzM6MzgtMDQ6MDBqU5pBAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE2LTA2LTA4\nVDE5OjMzOjM4LTA0OjAwGw4i/QAAAABJRU5ErkJggg==\n",
|
|
"text/plain": [
|
|
"<IPython.core.display.Image object>"
|
|
]
|
|
},
|
|
"execution_count": 15,
|
|
"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 array of fuel and guide tube pin cells with fuel, cladding, and water!\n",
|
|
"\n",
|
|
"# Create an MGXS Library\n",
|
|
"\n",
|
|
"Now we are ready to generate multi-group cross sections! First, let's define a 2-group structure using the built-in EnergyGroups class."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 16,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate a 2-group EnergyGroups object\n",
|
|
"groups = openmc.mgxs.EnergyGroups()\n",
|
|
"groups.group_edges = np.array([0., 0.625e-6, 20.])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Next, we will instantiate an openmc.mgxs.Library for the energy groups with our the fuel assembly geometry."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 17,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Initialize an 2-group MGXS Library for OpenMOC\n",
|
|
"mgxs_lib = openmc.mgxs.Library(geometry)\n",
|
|
"mgxs_lib.energy_groups = groups"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now, we must specify to the Library which types of cross sections to compute. OpenMC's multi-group mode can accept isotropic flux-weighted cross sections or angle-dependent cross sections, as well as supporting anisotropic scattering represented by either Legendre polynomials, histogram, or tabular angular distributions. At this time the MGXS Library class only supports the generation of isotropic flux-weighted cross sections and P0 scattering, so that is what will be used for this example. Therefore, we will create the following multi-group cross sections needed to run an OpenMC simulation to verify the accuracy of our cross sections: \"total\", \"absorption\", \"nu-fission\", '\"fission\", \"nu-scatter matrix\", \"multiplicity matrix\", and \"chi\".\n",
|
|
"\"multiplicity matrix\" is needed to provide OpenMC's multi-group mode with additional information needed to accurately treat scattering multiplication (i.e., (n,xn) reactions)) explicitly."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 18,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Specify multi-group cross section types to compute\n",
|
|
"mgxs_lib.mgxs_types = ['total', 'absorption', 'nu-fission', 'fission',\n",
|
|
" 'nu-scatter matrix', 'multiplicity matrix', 'chi']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we must specify the type of domain over which we would like the `Library` to compute multi-group cross sections. The domain type corresponds to the type of tally filter to be used in the tallies created to compute multi-group cross sections. At the present time, the `Library` supports \"material,\" \"cell,\" and \"universe\" domain types. In this simple example, we wish to compute multi-group cross sections only for each material andtherefore will use a \"material\" domain type.\n",
|
|
"\n",
|
|
"**Note:** By default, the `Library` class will instantiate `MGXS` objects for each and every domain (material, cell or universe) in the geometry of interest. However, one may specify a subset of these domains to the `Library.domains` property."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 19,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Specify a \"cell\" domain type for the cross section tally filters\n",
|
|
"mgxs_lib.domain_type = \"material\"\n",
|
|
"\n",
|
|
"# Specify the cell domains over which to compute multi-group cross sections\n",
|
|
"mgxs_lib.domains = geometry.get_all_materials()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We will instruct the library to not compute cross sections on a nuclide-by-nuclide basis, and instead to focus on generating material-specific macroscopic cross sections.\n",
|
|
"\n",
|
|
"**NOTE:** The default value of the `by_nuclide` parameter is `False`, so the following step is not necessary but is included for illustrative purposes."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 20,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Do not compute cross sections on a nuclide-by-nuclide basis\n",
|
|
"mgxs_lib.by_nuclide = False"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we will set the scattering order that we wish to use. For this problem we will use P3 scattering. A warning is expected telling us that the default behavior (a P0 correction on the scattering data) is over-ridden by our choice of using a Legendre expansion to treat anisotropic scattering."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 21,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"/home/nelsonag/git/openmc/openmc/mgxs/library.py:320: RuntimeWarning: The P0 correction will be ignored since the scattering order 0 is greater than zero\n",
|
|
" warnings.warn(msg, RuntimeWarning)\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Set the Legendre order to 3 for P3 scattering\n",
|
|
"mgxs_lib.legendre_order = 3"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now that the `Library` has been setup, lets make sure it contains the types of cross sections which meet the needs of OpenMC's multi-group solver. Note that this step is done automatically when writing the Multi-Group Library file later in the process (as part of the `mgxs_lib.write_mg_library()`), but it is a good practice to also run this before spending all the time running OpenMC to generate the cross sections."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 22,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Check the library - if no errors are raised, then the library is satisfactory.\n",
|
|
"mgxs_lib.check_library_for_openmc_mgxs()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Lastly, we use the `Library` to construct the tallies needed to compute all of the requested multi-group cross sections in each domain and nuclide."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 23,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Construct all tallies needed for the multi-group cross section library\n",
|
|
"mgxs_lib.build_library()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The tallies can now be export to a \"tallies.xml\" input file for OpenMC.\n",
|
|
"\n",
|
|
"**NOTE:** At this point the `Library` has constructed nearly 100 distinct Tally objects. The overhead to tally in OpenMC scales as O(N) for N tallies, which can become a bottleneck for large tally datasets. To compensate for this, the Python API's `Tally`, `Filter` and `Tallies` classes allow for the smart merging of tallies when possible. The `Library` class supports this runtime optimization with the use of the optional `merge` parameter (`False` by default) for the `Library.add_to_tallies_file(...)` method, as shown below."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 24,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create a \"tallies.xml\" file for the MGXS Library\n",
|
|
"tallies_file = openmc.Tallies()\n",
|
|
"mgxs_lib.add_to_tallies_file(tallies_file, merge=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"In addition, we instantiate a fission rate mesh tally to compare with the multi-group result."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 25,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate a tally Mesh\n",
|
|
"mesh = openmc.Mesh()\n",
|
|
"mesh.type = 'regular'\n",
|
|
"mesh.dimension = [17, 17]\n",
|
|
"mesh.lower_left = [-10.71, -10.71]\n",
|
|
"mesh.upper_right = [+10.71, +10.71]\n",
|
|
"\n",
|
|
"# Instantiate tally Filter\n",
|
|
"mesh_filter = openmc.Filter()\n",
|
|
"mesh_filter.mesh = mesh\n",
|
|
"\n",
|
|
"# Instantiate the Tally\n",
|
|
"tally = openmc.Tally(name='mesh tally')\n",
|
|
"tally.filters = [mesh_filter]\n",
|
|
"tally.scores = ['fission']\n",
|
|
"\n",
|
|
"# Add tally to collection\n",
|
|
"tallies_file.append(tally, merge=True)\n",
|
|
"\n",
|
|
"# Export all tallies to a \"tallies.xml\" file\n",
|
|
"tallies_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"source": [
|
|
"Time to run the calculation and get our results!"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 26,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"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.io/en/latest/license.html\n",
|
|
" Version: 0.7.1\n",
|
|
" Git SHA1: 826d5a43d85eaec1b6c7b4ce22e1a8f5e9336a4f\n",
|
|
" Date/Time: 2016-06-08 19:33:38\n",
|
|
" OpenMP Threads: 4\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: 40090.71c\n",
|
|
" Loading ACE cross section table: 1001.71c\n",
|
|
" Loading ACE cross section table: 5010.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.05201 \n",
|
|
" 2/1 1.02017 \n",
|
|
" 3/1 1.02398 \n",
|
|
" 4/1 1.02677 \n",
|
|
" 5/1 1.01070 \n",
|
|
" 6/1 1.02964 \n",
|
|
" 7/1 1.02163 \n",
|
|
" 8/1 1.04524 \n",
|
|
" 9/1 1.00773 \n",
|
|
" 10/1 1.01536 \n",
|
|
" 11/1 1.02992 \n",
|
|
" 12/1 1.03248 1.03120 +/- 0.00128\n",
|
|
" 13/1 0.99044 1.01761 +/- 0.01361\n",
|
|
" 14/1 1.01484 1.01692 +/- 0.00965\n",
|
|
" 15/1 1.01491 1.01652 +/- 0.00748\n",
|
|
" 16/1 1.03809 1.02011 +/- 0.00709\n",
|
|
" 17/1 1.02536 1.02086 +/- 0.00604\n",
|
|
" 18/1 1.03663 1.02283 +/- 0.00559\n",
|
|
" 19/1 1.03902 1.02463 +/- 0.00525\n",
|
|
" 20/1 1.01557 1.02373 +/- 0.00478\n",
|
|
" 21/1 1.01286 1.02274 +/- 0.00443\n",
|
|
" 22/1 1.01392 1.02200 +/- 0.00411\n",
|
|
" 23/1 1.04439 1.02372 +/- 0.00416\n",
|
|
" 24/1 1.04034 1.02491 +/- 0.00403\n",
|
|
" 25/1 0.99433 1.02287 +/- 0.00427\n",
|
|
" 26/1 1.02720 1.02314 +/- 0.00400\n",
|
|
" 27/1 1.03545 1.02387 +/- 0.00383\n",
|
|
" 28/1 1.03853 1.02468 +/- 0.00370\n",
|
|
" 29/1 1.02735 1.02482 +/- 0.00350\n",
|
|
" 30/1 1.02429 1.02480 +/- 0.00332\n",
|
|
" 31/1 1.02901 1.02500 +/- 0.00317\n",
|
|
" 32/1 1.03296 1.02536 +/- 0.00304\n",
|
|
" 33/1 1.03605 1.02582 +/- 0.00294\n",
|
|
" 34/1 1.04247 1.02652 +/- 0.00290\n",
|
|
" 35/1 1.02088 1.02629 +/- 0.00279\n",
|
|
" 36/1 1.03017 1.02644 +/- 0.00269\n",
|
|
" 37/1 1.03216 1.02665 +/- 0.00259\n",
|
|
" 38/1 1.01459 1.02622 +/- 0.00254\n",
|
|
" 39/1 1.03706 1.02659 +/- 0.00248\n",
|
|
" 40/1 1.01383 1.02617 +/- 0.00243\n",
|
|
" 41/1 0.99043 1.02502 +/- 0.00262\n",
|
|
" 42/1 1.02891 1.02514 +/- 0.00254\n",
|
|
" 43/1 1.02100 1.02501 +/- 0.00246\n",
|
|
" 44/1 0.99546 1.02414 +/- 0.00254\n",
|
|
" 45/1 1.01562 1.02390 +/- 0.00248\n",
|
|
" 46/1 1.03025 1.02408 +/- 0.00242\n",
|
|
" 47/1 0.99409 1.02327 +/- 0.00249\n",
|
|
" 48/1 1.04355 1.02380 +/- 0.00248\n",
|
|
" 49/1 1.02763 1.02390 +/- 0.00242\n",
|
|
" 50/1 0.99426 1.02316 +/- 0.00247\n",
|
|
" Creating state point statepoint.50.h5...\n",
|
|
"\n",
|
|
" ===========================================================================\n",
|
|
" ======================> SIMULATION FINISHED <======================\n",
|
|
" ===========================================================================\n",
|
|
"\n",
|
|
"\n",
|
|
" =======================> TIMING STATISTICS <=======================\n",
|
|
"\n",
|
|
" Total time for initialization = 1.4220E+00 seconds\n",
|
|
" Reading cross sections = 1.1320E+00 seconds\n",
|
|
" Total time in simulation = 1.6571E+01 seconds\n",
|
|
" Time in transport only = 1.6501E+01 seconds\n",
|
|
" Time in inactive batches = 2.1010E+00 seconds\n",
|
|
" Time in active batches = 1.4470E+01 seconds\n",
|
|
" Time synchronizing fission bank = 5.0000E-03 seconds\n",
|
|
" Sampling source sites = 4.0000E-03 seconds\n",
|
|
" SEND/RECV source sites = 1.0000E-03 seconds\n",
|
|
" Time accumulating tallies = 0.0000E+00 seconds\n",
|
|
" Total time for finalization = 0.0000E+00 seconds\n",
|
|
" Total time elapsed = 1.8002E+01 seconds\n",
|
|
" Calculation Rate (inactive) = 23798.2 neutrons/second\n",
|
|
" Calculation Rate (active) = 13821.7 neutrons/second\n",
|
|
"\n",
|
|
" ============================> RESULTS <============================\n",
|
|
"\n",
|
|
" k-effective (Collision) = 1.02389 +/- 0.00235\n",
|
|
" k-effective (Track-length) = 1.02316 +/- 0.00247\n",
|
|
" k-effective (Absorption) = 1.02494 +/- 0.00180\n",
|
|
" Combined k-effective = 1.02429 +/- 0.00140\n",
|
|
" Leakage Fraction = 0.00000 +/- 0.00000\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0"
|
|
]
|
|
},
|
|
"execution_count": 26,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Run OpenMC\n",
|
|
"openmc.run()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"To make the files available and not be over-written when running the multi-group calculation, we will now rename the statepoint and summary files."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 27,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Move the StatePoint File\n",
|
|
"ce_spfile = './ce_statepoint.h5'\n",
|
|
"os.rename('statepoint.' + str(batches) + '.h5', ce_spfile)\n",
|
|
"# Move the Summary file\n",
|
|
"ce_sumfile = './ce_summary.h5'\n",
|
|
"os.rename('summary.h5', ce_sumfile)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Tally Data Processing\n",
|
|
"\n",
|
|
"Our simulation ran successfully and created statepoint and summary output files. Let's begin by loading the StatePoint file, but not automatically linking the summary file."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 28,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Load the statepoint file, but not the summary file, as it is a different filename than expected.\n",
|
|
"sp = openmc.StatePoint(ce_spfile, autolink=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"In addition to the statepoint file, our simulation also created a summary file which encapsulates information about the materials and geometry. This is necessary for the `openmc.mgxs` module to properly process the tally data. We first create a `Summary` object and link it with the statepoint. Normally this would not need to be performed, but since we have renamed our summary file to avoid conflicts with the Multi-Group calculation's summary file, we will load this in explicitly."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 29,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"su = openmc.Summary(ce_sumfile)\n",
|
|
"sp.link_with_summary(su)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The statepoint is now ready to be analyzed by the `Library`. We simply have to load the tallies from the statepoint into the `Library` and our `MGXS` objects will compute the cross sections for us under-the-hood."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 30,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Initialize MGXS Library with OpenMC statepoint data\n",
|
|
"mgxs_lib.load_from_statepoint(sp)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The next step will be to prepare the input for OpenMC to use our newly created multi-group data."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Multi-Group OpenMC Calculation"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We will now use the `Library` to produce a multi-group cross section data set for use by the OpenMC multi-group solver. \n",
|
|
"Note that since this simulation included so few histories, it is reasonable to expect some divisions by zero errors. This will show up as a runtime warning in the following step."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 31,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"/home/nelsonag/git/openmc/openmc/tallies.py:1990: RuntimeWarning: invalid value encountered in true_divide\n",
|
|
" self_rel_err = data['self']['std. dev.'] / data['self']['mean']\n",
|
|
"/home/nelsonag/git/openmc/openmc/tallies.py:1991: RuntimeWarning: invalid value encountered in true_divide\n",
|
|
" other_rel_err = data['other']['std. dev.'] / data['other']['mean']\n",
|
|
"/home/nelsonag/git/openmc/openmc/tallies.py:1992: RuntimeWarning: invalid value encountered in true_divide\n",
|
|
" new_tally._mean = data['self']['mean'] / data['other']['mean']\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Create a MGXS File which can then be written to disk\n",
|
|
"mgxs_file = mgxs_lib.create_mg_library(xs_type='macro', xsdata_names=['fuel', 'zircaloy', 'water'],\n",
|
|
" xs_ids='2m')\n",
|
|
"\n",
|
|
"# Write the file to disk using the default filename of `mgxs.xml`\n",
|
|
"mgxs_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"OpenMC's multi-group mode uses the same input files as does the continuous-energy mode (materials, geometry, settings, plots ,and tallies file). Differences would include the use of a flag to tell the code to use multi-group transport, a location of the multi-group library file, and any changes needed in the materials.xml and geometry.xml files to re-define materials as necessary (for example, if using a macroscopic cross section library instead of individual microscopic nuclide cross sections as is done in continuous-energy, or if multiple cross sections exist for the same material due to the material existing in varied spectral regions).\n",
|
|
"\n",
|
|
"Since this example is using material-wise macroscopic cross sections without considering that the neutron energy spectra and thus cross sections may be changing in space, we only need to modify the materials.xml and settings.xml files. If the material names and ids are not otherwise changed, then the geometry.xml file does not need to be modified from its continuous-energy form. The tallies.xml file will be left untouched as it currently contains the tally types that we will need to perform our comparison. \n",
|
|
"\n",
|
|
"First we will create the new materials.xml file. Continuous-energy cross section nuclidic data sets are named with the nuclide name followed by a cross section identifier. For example, the data for hydrogen is accessed in OpenMC by the name `H-1.71c`. The cross-section identifier (in this case, `71c`) can be used to distinguish between different variants of `H-1` data, such as for different evaluations or temperatures. OpenMC multi-group libraries use the same convention of a name followed by a xs identifier. We will use a cross section identifier here of `2m`. Similar to how continuous-energy cross section libraries are named, the `openmc.Macroscopic` quantities below can either have their `xs_id` included (i.e., `'fuel.2m'`). An alternative is to leave this extension off and simply change the `default_xs` parameter to `.2m`."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 32,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Instantiate our Macroscopic Data\n",
|
|
"fuel_macro = openmc.Macroscopic('fuel')\n",
|
|
"zircaloy_macro = openmc.Macroscopic('zircaloy')\n",
|
|
"water_macro = openmc.Macroscopic('water')\n",
|
|
"\n",
|
|
"# Now re-define our materials to use the Multi-Group macroscopic data\n",
|
|
"# instead of the continuous-energy data.\n",
|
|
"# 1.6 enriched fuel UO2\n",
|
|
"fuel = openmc.Material(name='UO2')\n",
|
|
"fuel.add_macroscopic(fuel_macro)\n",
|
|
"\n",
|
|
"# cladding\n",
|
|
"zircaloy = openmc.Material(name='Clad')\n",
|
|
"zircaloy.add_macroscopic(zircaloy_macro)\n",
|
|
"\n",
|
|
"# moderator\n",
|
|
"water = openmc.Material(name='Water')\n",
|
|
"water.add_macroscopic(water_macro)\n",
|
|
"\n",
|
|
"# Finally, instantiate our Materials object\n",
|
|
"materials_file = openmc.Materials((fuel, zircaloy, water))\n",
|
|
"materials_file.default_xs = '2m'\n",
|
|
"\n",
|
|
"# Export to \"materials.xml\"\n",
|
|
"materials_file.export_to_xml()\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"No geometry file neeeds to be written as the continuous-energy file is correctly defined for the multi-group case as well."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Next, we can make the changes we need to the settings file.\n",
|
|
"These changes are limited to telling OpenMC we will be running a multi-group calculation and pointing to the location of our multi-group cross section file."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 33,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Set the location of the cross sections file\n",
|
|
"settings_file.cross_sections = './mgxs.xml'\n",
|
|
"settings_file.energy_mode = 'multi-group'\n",
|
|
"\n",
|
|
"# Export to \"settings.xml\"\n",
|
|
"settings_file.export_to_xml()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Finally, since we want similar tally data in the end, we will leave our pre-existing `tallies.xml` file for this calculation.\n",
|
|
"\n",
|
|
"At this point, the problem is set up and we can run the multi-group calculation."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 34,
|
|
"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.io/en/latest/license.html\n",
|
|
" Version: 0.7.1\n",
|
|
" Git SHA1: 826d5a43d85eaec1b6c7b4ce22e1a8f5e9336a4f\n",
|
|
" Date/Time: 2016-06-08 19:33:56\n",
|
|
" OpenMP Threads: 4\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 Cross Section Data...\n",
|
|
" Loading fuel.2m Data...\n",
|
|
" Loading zircaloy.2m Data...\n",
|
|
" Loading water.2m Data...\n",
|
|
" Initializing source particles...\n",
|
|
"\n",
|
|
" ===========================================================================\n",
|
|
" ====================> K EIGENVALUE SIMULATION <====================\n",
|
|
" ===========================================================================\n",
|
|
"\n",
|
|
" Bat./Gen. k Average k \n",
|
|
" ========= ======== ==================== \n",
|
|
" 1/1 0.99367 \n",
|
|
" 2/1 1.03173 \n",
|
|
" 3/1 1.01999 \n",
|
|
" 4/1 1.01421 \n",
|
|
" 5/1 1.03980 \n",
|
|
" 6/1 1.04540 \n",
|
|
" 7/1 1.04199 \n",
|
|
" 8/1 1.02680 \n",
|
|
" 9/1 1.01267 \n",
|
|
" 10/1 1.03420 \n",
|
|
" 11/1 1.05773 \n",
|
|
" 12/1 1.03475 1.04624 +/- 0.01149\n",
|
|
" 13/1 1.03632 1.04293 +/- 0.00741\n",
|
|
" 14/1 0.99297 1.03044 +/- 0.01355\n",
|
|
" 15/1 1.02413 1.02918 +/- 0.01057\n",
|
|
" 16/1 1.02359 1.02825 +/- 0.00868\n",
|
|
" 17/1 0.99913 1.02409 +/- 0.00843\n",
|
|
" 18/1 1.01493 1.02294 +/- 0.00739\n",
|
|
" 19/1 1.03010 1.02374 +/- 0.00657\n",
|
|
" 20/1 1.04890 1.02626 +/- 0.00639\n",
|
|
" 21/1 1.01267 1.02502 +/- 0.00591\n",
|
|
" 22/1 1.02637 1.02513 +/- 0.00540\n",
|
|
" 23/1 1.01374 1.02426 +/- 0.00504\n",
|
|
" 24/1 1.06661 1.02728 +/- 0.00556\n",
|
|
" 25/1 1.03212 1.02760 +/- 0.00519\n",
|
|
" 26/1 1.05433 1.02927 +/- 0.00513\n",
|
|
" 27/1 0.99891 1.02749 +/- 0.00514\n",
|
|
" 28/1 1.00616 1.02630 +/- 0.00499\n",
|
|
" 29/1 1.04583 1.02733 +/- 0.00483\n",
|
|
" 30/1 1.01512 1.02672 +/- 0.00462\n",
|
|
" 31/1 0.98104 1.02455 +/- 0.00491\n",
|
|
" 32/1 1.04202 1.02534 +/- 0.00474\n",
|
|
" 33/1 1.00779 1.02458 +/- 0.00460\n",
|
|
" 34/1 1.02450 1.02457 +/- 0.00440\n",
|
|
" 35/1 0.98882 1.02314 +/- 0.00446\n",
|
|
" 36/1 1.01541 1.02285 +/- 0.00429\n",
|
|
" 37/1 1.02050 1.02276 +/- 0.00413\n",
|
|
" 38/1 1.03573 1.02322 +/- 0.00401\n",
|
|
" 39/1 1.03649 1.02368 +/- 0.00389\n",
|
|
" 40/1 1.01434 1.02337 +/- 0.00378\n",
|
|
" 41/1 1.02345 1.02337 +/- 0.00365\n",
|
|
" 42/1 1.01900 1.02323 +/- 0.00354\n",
|
|
" 43/1 1.01450 1.02297 +/- 0.00344\n",
|
|
" 44/1 1.03127 1.02321 +/- 0.00335\n",
|
|
" 45/1 1.01598 1.02301 +/- 0.00326\n",
|
|
" 46/1 1.00851 1.02260 +/- 0.00319\n",
|
|
" 47/1 1.03406 1.02291 +/- 0.00312\n",
|
|
" 48/1 1.02373 1.02294 +/- 0.00303\n",
|
|
" 49/1 1.04066 1.02339 +/- 0.00299\n",
|
|
" 50/1 1.02011 1.02331 +/- 0.00292\n",
|
|
" Creating state point statepoint.50.h5...\n",
|
|
"\n",
|
|
" ===========================================================================\n",
|
|
" ======================> SIMULATION FINISHED <======================\n",
|
|
" ===========================================================================\n",
|
|
"\n",
|
|
"\n",
|
|
" =======================> TIMING STATISTICS <=======================\n",
|
|
"\n",
|
|
" Total time for initialization = 3.1000E-02 seconds\n",
|
|
" Reading cross sections = 5.0000E-03 seconds\n",
|
|
" Total time in simulation = 1.1867E+01 seconds\n",
|
|
" Time in transport only = 1.1830E+01 seconds\n",
|
|
" Time in inactive batches = 1.2670E+00 seconds\n",
|
|
" Time in active batches = 1.0600E+01 seconds\n",
|
|
" Time synchronizing fission bank = 7.0000E-03 seconds\n",
|
|
" Sampling source sites = 7.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 = 0.0000E+00 seconds\n",
|
|
" Total time elapsed = 1.1907E+01 seconds\n",
|
|
" Calculation Rate (inactive) = 39463.3 neutrons/second\n",
|
|
" Calculation Rate (active) = 18867.9 neutrons/second\n",
|
|
"\n",
|
|
" ============================> RESULTS <============================\n",
|
|
"\n",
|
|
" k-effective (Collision) = 1.02638 +/- 0.00260\n",
|
|
" k-effective (Track-length) = 1.02331 +/- 0.00292\n",
|
|
" k-effective (Absorption) = 1.02579 +/- 0.00132\n",
|
|
" Combined k-effective = 1.02558 +/- 0.00136\n",
|
|
" Leakage Fraction = 0.00000 +/- 0.00000\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0"
|
|
]
|
|
},
|
|
"execution_count": 34,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Run the Multi-Group OpenMC Simulation\n",
|
|
"openmc.run()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Results Comparison\n",
|
|
"Now we can compare the multi-group and continuous-energy results.\n",
|
|
"\n",
|
|
"We will begin by loading the multi-group statepoint file we just finished writing and extracting the calculated keff.\n",
|
|
"Since we did not rename the summary file, we do not need to load it separately this time."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 35,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Load the last statepoint file and keff value\n",
|
|
"mgsp = openmc.StatePoint('statepoint.' + str(batches) + '.h5')\n",
|
|
"mg_keff = mgsp.k_combined"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Next, we can load the continuous-energy eigenvalue for comparison."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 36,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"ce_keff = sp.k_combined"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Lets compare the two eigenvalues, including their bias"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 37,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Continuous-Energy keff = 1.024295\n",
|
|
"Multi-Group keff = 1.025577\n",
|
|
"bias [pcm]: -128.2\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"bias = 1.0E5 * (ce_keff[0] - mg_keff[0])\n",
|
|
"\n",
|
|
"print('Continuous-Energy keff = {0:1.6f}'.format(ce_keff[0]))\n",
|
|
"print('Multi-Group keff = {0:1.6f}'.format(mg_keff[0]))\n",
|
|
"print('bias [pcm]: {0:1.1f}'.format(bias))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"This shows a small but nontrivial pcm bias between the two methods. Some degree of mismatch is expected simply to the very few histories being used in these example problems. An additional mismatch is always inherent in the practical application of multi-group theory due to the high degree of approximations inherent in that method."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Flux and Pin Power Visualizations"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Next we will visualize the mesh tally results obtained from both the Continuous-Energy and Multi-Group OpenMC calculations.\n",
|
|
"\n",
|
|
"First, we extract volume-integrated fission rates from the Multi-Group calculation's mesh fission rate tally for each pin cell in the fuel assembly."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 38,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Get the OpenMC fission rate mesh tally data\n",
|
|
"mg_mesh_tally = mgsp.get_tally(name='mesh tally')\n",
|
|
"mg_fission_rates = mg_mesh_tally.get_values(scores=['fission'])\n",
|
|
"\n",
|
|
"# Reshape array to 2D for plotting\n",
|
|
"mg_fission_rates.shape = (17,17)\n",
|
|
"\n",
|
|
"# Normalize to the average pin power\n",
|
|
"mg_fission_rates /= np.mean(mg_fission_rates)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we can do the same for the Continuous-Energy results."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 39,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Get the OpenMC fission rate mesh tally data\n",
|
|
"ce_mesh_tally = sp.get_tally(name='mesh tally')\n",
|
|
"ce_fission_rates = ce_mesh_tally.get_values(scores=['fission'])\n",
|
|
"\n",
|
|
"# Reshape array to 2D for plotting\n",
|
|
"ce_fission_rates.shape = (17,17)\n",
|
|
"\n",
|
|
"# Normalize to the average pin power\n",
|
|
"ce_fission_rates /= np.mean(ce_fission_rates)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we can easily use Matplotlib to visualize the two fission rates side-by-side."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 40,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"<matplotlib.text.Text at 0x7fbaddf68550>"
|
|
]
|
|
},
|
|
"execution_count": 40,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAADDCAYAAACS2+oqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXm8H9P5x99PZEGIrEIaCRFrVAgiVLm1RPlRikSC2tqg\nraJaSqlcS2tpG0vRKqEootTaKlFcrRJbSEutFZGIBEkk9kTu8/tj5ibf3Nzv95m7fPO9d/J5v173\ndb8z5zPnPHPmmWfOnJkzx9wdIYQQbZ92lTZACCFEy6CALoQQOUEBXQghcoICuhBC5AQFdCGEyAkK\n6EIIkRNaXUA3sxfMbOdK27EyY2b3mdm3mrH9b83sjJa0aWXEzGrNbECJ9NyeK/LBJuLu4R9wCPA0\n8CHwNvBX4CtZtg3yvQ44p7n5VPIv3YfPgQXp34fAc5W2K4PdY4GFBTYvAH5cabsaYfNc4DFgWCO2\nfwQ4egXY+SbwGdC93vrngVqgX8Z8FgMDCvysUecK0AE4C3g5PcbT03N3j0ofywaOp3ywBf7CFrqZ\nnQyMA84D1gb6AVcC34i2XYm40N27pH9ruvvWLV2Ama3S0nkCEwps7uLuvypDGS3NBHfvAvQEaoDb\nKmtOgzgwFRhdt8LMtgBWTdOyYs2048/AvsBhQDdgA+BSYO8GCyuPj0XIB1uS4GrSheTKeUAJTUfg\nEpKW+wzgYqBDmrYLSavgZGB2qjkyTRtDcqX7jORqd3e6fiqwa8HV8Fbg+lTzH2BIQdm1pC2Y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3L94Ejq2YgY2kDfq2/LpMrCjf1tB/IYTICa2hy0UIIUQLoIAuhBA5QQFdCCFy\nggK6EELkBAV0IYTICQroQgiRExTQhRAiJyigCyFETvh/2lCfM9vFM3EAAAAASUVORK5CYII=\n",
|
|
"text/plain": [
|
|
"<matplotlib.figure.Figure at 0x7fbaddfdb320>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Force zeros to be NaNs so their values are not included when matplotlib calculates\n",
|
|
"# the color scale\n",
|
|
"ce_fission_rates[ce_fission_rates == 0.] = np.nan\n",
|
|
"mg_fission_rates[mg_fission_rates == 0.] = np.nan\n",
|
|
"\n",
|
|
"# Plot the CE fission rates in the left subplot\n",
|
|
"fig = plt.subplot(121)\n",
|
|
"plt.imshow(ce_fission_rates, interpolation='none', cmap='jet')\n",
|
|
"plt.title('Continuous-Energy Fission Rates')\n",
|
|
"\n",
|
|
"# Plot the MG fission rates in the right subplot\n",
|
|
"fig2 = plt.subplot(122)\n",
|
|
"plt.imshow(mg_fission_rates, interpolation='none', cmap='jet')\n",
|
|
"plt.title('Multi-Group Fission Rates')\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"source": [
|
|
"We also see very good agreement between the fission rate distributions, though these should converge closer together with an increasing number of particle histories in both the continuous-energy run to generate the multi-group cross sections, and in the multi-group calculation itself."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"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
|
|
}
|