Skip to content

Instantly share code, notes, and snippets.

@paulromano
Created May 10, 2016 16:16
Show Gist options
  • Save paulromano/41c4ed58e99e0f7138e98184b8cd2655 to your computer and use it in GitHub Desktop.
Save paulromano/41c4ed58e99e0f7138e98184b8cd2655 to your computer and use it in GitHub Desktop.
Hexagonal lattice example
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this example, we will create a hexagonal lattice and show how the orientation can be changed via the cell rotation property. Let's first just set up some materials and universes that we will use to fill the lattice."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import openmc"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"fuel = openmc.Material(name='fuel')\n",
"fuel.add_nuclide('U-235', 1.0)\n",
"fuel.set_density('g/cm3', 10.0)\n",
"\n",
"fuel2 = openmc.Material(name='fuel2')\n",
"fuel2.add_nuclide('U-238', 1.0)\n",
"fuel2.set_density('g/cm3', 10.0)\n",
"\n",
"water = openmc.Material(name='water')\n",
"water.add_nuclide('H-1', 2.0)\n",
"water.add_nuclide('O-16', 1.0)\n",
"water.set_density('g/cm3', 1.0)\n",
"\n",
"mats = openmc.Materials((fuel, fuel2, water))\n",
"mats.default_xs = '71c'\n",
"mats.export_to_xml()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"r_pin = openmc.ZCylinder(R=0.25)\n",
"fuel_cell = openmc.Cell(fill=fuel, region=-r_pin)\n",
"water_cell = openmc.Cell(fill=water, region=+r_pin)\n",
"pin_universe = openmc.Universe(10, cells=(fuel_cell, water_cell))\n",
"\n",
"r_big_pin = openmc.ZCylinder(R=0.5)\n",
"fuel2_cell = openmc.Cell(fill=fuel2, region=-r_big_pin)\n",
"water2_cell = openmc.Cell(fill=water, region=+r_big_pin)\n",
"big_pin_universe = openmc.Universe(20, cells=(fuel2_cell, water2_cell))\n",
"\n",
"all_water_cell = openmc.Cell(fill=water)\n",
"outer_universe = openmc.Universe(30, cells=(all_water_cell,))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lat = openmc.HexLattice()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We need to set the `center` of the lattice, the `pitch`, an `outer` universe (which is applied to all lattice elements outside of those that are defined), and a list of `universes`. Let's start with the easy ones first. Note that for a 2D lattice, we only need to specify a single number for the pitch."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lat.center = (0., 0.)\n",
"lat.pitch = [1.25]\n",
"lat.outer = outer_universe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we need to set the `universes` property on our lattice. It needs to be set to a list of lists of Universes, where each list of Universes corresponds to a ring of the lattice. The rings are ordered from outermost to innermost, and within each ring the indexing starts at the \"top\". To help visualize the proper indices, we can use the `show_indices()` helper method."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" (0, 0)\n",
" (0,11) (0, 1)\n",
"(0,10) (1, 0) (0, 2)\n",
" (1, 5) (1, 1)\n",
"(0, 9) (2, 0) (0, 3)\n",
" (1, 4) (1, 2)\n",
"(0, 8) (1, 3) (0, 4)\n",
" (0, 7) (0, 5)\n",
" (0, 6)\n"
]
}
],
"source": [
"print(lat.show_indices(num_rings=3))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's set up a lattice where the first element in each ring is the bin pin universe and all other elements are regular pin universes. From the diagram above, we see that the outer ring has 12 elements, the middle ring has 6, and the innermost degenerate ring has a single element."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HexLattice\n",
"\tID =\t10000\n",
"\tName =\t\n",
"\t# Rings =\t3\n",
"\t# Axial =\tNone\n",
"\tCenter =\t(0.0, 0.0)\n",
"\tPitch =\t[1.25]\n",
"\tOuter =\t30\n",
"\tUniverses \n",
" 20\n",
" 10 10\n",
"10 20 10\n",
" 10 10\n",
"10 20 10\n",
" 10 10\n",
"10 10 10\n",
" 10 10\n",
" 10\n"
]
}
],
"source": [
"outer_ring = [big_pin_universe] + [pin_universe]*11\n",
"middle_ring = [big_pin_universe] + [pin_universe]*5\n",
"inner_ring = [big_pin_universe]\n",
"lat.universes = [outer_ring, middle_ring, inner_ring]\n",
"print(lat)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's put our lattice inside a circular cell."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"outer_radius = 4.0\n",
"outer_surface = openmc.ZCylinder(R=outer_radius, boundary_type='vacuum')\n",
"main_cell = openmc.Cell(fill=lat, region=-outer_surface)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"geom = openmc.Geometry()\n",
"geom.root_universe = openmc.Universe(0, cells=(main_cell,))\n",
"geom.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's create a plot to see what our geometry looks like."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAgMAAAAEE2bmAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX///8AAP///wB6egDI\nrFjHAAAAAWJLR0QAiAUdSAAAAAd0SU1FB+AFChAMOgtS6/gAAAYESURBVHja7ZzLkdswDIbXB5Wg\nflSCDmI48YX37SGjKlJCDnE/LsXHjLL22LJEvCFo42TC29r0t8BPgi9ReHv7zNKme9lMatKzDEFG\nbTct1aWLQ/l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=\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Create a plots file\n",
"p = openmc.Plot()\n",
"p.origin = (0, 0, 0)\n",
"p.width = (2*outer_radius, 2*outer_radius)\n",
"p.pixels = (300, 300)\n",
"p.color = 'mat'\n",
"p.col_spec = {\n",
" water.id: (0, 0, 255),\n",
" fuel.id: (122, 122, 0),\n",
" fuel2.id: (255, 255, 0)\n",
"}\n",
"openmc.Plots([p]).export_to_xml()\n",
"\n",
"# Run OpenMC in plotting mode\n",
"openmc.plot_geometry(output=False)\n",
"\n",
"# Convert the plot and show it\n",
"!convert plot.ppm plot.png\n",
"from IPython.display import Image\n",
"Image('plot.png')"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"settings = openmc.Settings()\n",
"settings.batches = 25\n",
"settings.inactive = 5\n",
"settings.particles = 10000\n",
"settings.source = openmc.Source(space=openmc.stats.Point((0., 0., 0.)))\n",
"settings.export_to_xml()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"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: 2ca61564e2c7fb5b514661f1ce00e0630725606a\n",
" Date/Time: 2016-05-10 11:12:58\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",
" 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: 1001.71c\n",
" Loading ACE cross section table: 8016.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 0.18728 \n",
" 2/1 0.17153 \n",
" 3/1 0.18959 \n",
" 4/1 0.18357 \n",
" 5/1 0.19297 \n",
" 6/1 0.18063 \n",
" 7/1 0.17893 0.17978 +/- 0.00085\n",
" 8/1 0.18027 0.17994 +/- 0.00052\n",
" 9/1 0.17490 0.17868 +/- 0.00131\n",
" 10/1 0.17523 0.17799 +/- 0.00123\n",
" 11/1 0.18040 0.17839 +/- 0.00108\n",
" 12/1 0.18059 0.17871 +/- 0.00097\n",
" 13/1 0.18233 0.17916 +/- 0.00095\n",
" 14/1 0.18468 0.17977 +/- 0.00104\n",
" 15/1 0.18086 0.17988 +/- 0.00094\n",
" 16/1 0.18469 0.18032 +/- 0.00095\n",
" 17/1 0.17738 0.18007 +/- 0.00090\n",
" 18/1 0.17644 0.17979 +/- 0.00088\n",
" 19/1 0.19642 0.18098 +/- 0.00144\n",
" 20/1 0.17855 0.18082 +/- 0.00135\n",
" 21/1 0.18137 0.18085 +/- 0.00126\n",
" 22/1 0.17425 0.18047 +/- 0.00125\n",
" 23/1 0.18989 0.18099 +/- 0.00129\n",
" 24/1 0.18363 0.18113 +/- 0.00123\n",
" 25/1 0.17331 0.18074 +/- 0.00123\n",
" Creating state point statepoint.25.h5...\n",
"\n",
" ===========================================================================\n",
" ======================> SIMULATION FINISHED <======================\n",
" ===========================================================================\n",
"\n",
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 3.8600E-01 seconds\n",
" Reading cross sections = 8.5000E-02 seconds\n",
" Total time in simulation = 7.1150E+00 seconds\n",
" Time in transport only = 7.0840E+00 seconds\n",
" Time in inactive batches = 1.1130E+00 seconds\n",
" Time in active batches = 6.0020E+00 seconds\n",
" Time synchronizing fission bank = 1.9000E-02 seconds\n",
" Sampling source sites = 1.2000E-02 seconds\n",
" SEND/RECV source sites = 7.0000E-03 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 0.0000E+00 seconds\n",
" Total time elapsed = 7.5510E+00 seconds\n",
" Calculation Rate (inactive) = 44923.6 neutrons/second\n",
" Calculation Rate (active) = 33322.2 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" k-effective (Collision) = 0.18087 +/- 0.00082\n",
" k-effective (Track-length) = 0.18074 +/- 0.00123\n",
" k-effective (Absorption) = 0.18076 +/- 0.00132\n",
" Combined k-effective = 0.18090 +/- 0.00085\n",
" Leakage Fraction = 0.90150 +/- 0.00074\n",
"\n"
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"openmc.run()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rotating the lattice\n",
"\n",
"Now let's say we want our hexagonal lattice orientated such that flat sides are parallel to the y-axis instead of the x-axis. This can be achieved by rotating the cell that contains the lattice by 30 degrees. Ideally, we'd specify a rotation on `main_cell`. However, we can only rotate a cell that is filled by a universe (not a lattice). Therefore, we'll create a dummy cell/universe that is filled with the lattice and change our main cell to be filled with that universe in order to rotate it. "
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": "iV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Gs\nu2JaD8ayTo1uVtQ0S+MkV9fHst6QZR0k0/pMlnWjTOtZWdbZsqz/ZVqXzLJemmkdN8v6cpZ170zr\n8VnWCTStX2hZV9G03qNpHUrL+pimdTst64ma1jnNjGVdxrKsC2tar9a0jq5pfV9oGtvzLx9H2rsG\n5CP7AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE2LTA1LTEwVDExOjEzOjA2LTA1OjAwWdM5kwAAACV0\nRVh0ZGF0ZTptb2RpZnkAMjAxNi0wNS0xMFQxMToxMzowNi0wNTowMCiOgS8AAAAASUVORK5CYII=\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Create a dummy cell/universe that will be used for rotation purposes\n",
"rotated_cell = openmc.Cell(fill=lat)\n",
"rotated_universe = openmc.Universe(cells=(rotated_cell,))\n",
"\n",
"# Rotate the main cell and re-export the geometry\n",
"main_cell.fill = rotated_universe\n",
"main_cell.rotation = (0., 0., 30.)\n",
"geom.export_to_xml()\n",
"\n",
"# Run OpenMC in plotting mode\n",
"openmc.plot_geometry(output=False)\n",
"\n",
"# Convert the plot and show it\n",
"!convert plot.ppm plot.png\n",
"from IPython.display import Image\n",
"Image('plot.png')"
]
},
{
"cell_type": "code",
"execution_count": 14,
"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: 2ca61564e2c7fb5b514661f1ce00e0630725606a\n",
" Date/Time: 2016-05-10 11:13:06\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",
" 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: 1001.71c\n",
" Loading ACE cross section table: 8016.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 0.18693 \n",
" 2/1 0.18171 \n",
" 3/1 0.17964 \n",
" 4/1 0.18998 \n",
" 5/1 0.17371 \n",
" 6/1 0.18062 \n",
" 7/1 0.18086 0.18074 +/- 0.00012\n",
" 8/1 0.17510 0.17886 +/- 0.00188\n",
" 9/1 0.18267 0.17981 +/- 0.00164\n",
" 10/1 0.17841 0.17953 +/- 0.00130\n",
" 11/1 0.17759 0.17921 +/- 0.00111\n",
" 12/1 0.17085 0.17801 +/- 0.00152\n",
" 13/1 0.18918 0.17941 +/- 0.00192\n",
" 14/1 0.18507 0.18004 +/- 0.00180\n",
" 15/1 0.19006 0.18104 +/- 0.00190\n",
" 16/1 0.17588 0.18057 +/- 0.00178\n",
" 17/1 0.18423 0.18088 +/- 0.00165\n",
" 18/1 0.18385 0.18111 +/- 0.00154\n",
" 19/1 0.17826 0.18090 +/- 0.00144\n",
" 20/1 0.18599 0.18124 +/- 0.00138\n",
" 21/1 0.17793 0.18103 +/- 0.00131\n",
" 22/1 0.17939 0.18094 +/- 0.00123\n",
" 23/1 0.17574 0.18065 +/- 0.00120\n",
" 24/1 0.18201 0.18072 +/- 0.00114\n",
" 25/1 0.18410 0.18089 +/- 0.00109\n",
" Creating state point statepoint.25.h5...\n",
"\n",
" ===========================================================================\n",
" ======================> SIMULATION FINISHED <======================\n",
" ===========================================================================\n",
"\n",
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 5.2800E-01 seconds\n",
" Reading cross sections = 1.4500E-01 seconds\n",
" Total time in simulation = 7.1730E+00 seconds\n",
" Time in transport only = 7.1540E+00 seconds\n",
" Time in inactive batches = 1.4380E+00 seconds\n",
" Time in active batches = 5.7350E+00 seconds\n",
" Time synchronizing fission bank = 1.1000E-02 seconds\n",
" Sampling source sites = 9.0000E-03 seconds\n",
" SEND/RECV source sites = 2.0000E-03 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 0.0000E+00 seconds\n",
" Total time elapsed = 7.7940E+00 seconds\n",
" Calculation Rate (inactive) = 34770.5 neutrons/second\n",
" Calculation Rate (active) = 34873.6 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" k-effective (Collision) = 0.17964 +/- 0.00118\n",
" k-effective (Track-length) = 0.18089 +/- 0.00109\n",
" k-effective (Absorption) = 0.18003 +/- 0.00118\n",
" Combined k-effective = 0.18040 +/- 0.00103\n",
" Leakage Fraction = 0.90216 +/- 0.00055\n",
"\n"
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"openmc.run()"
]
}
],
"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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment