Update example inputs and Jupyter notebooks

This commit is contained in:
Paul Romano 2015-10-03 09:55:58 +07:00
parent 71dfde8d12
commit b9024f2d8e
11 changed files with 117 additions and 140 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -36,7 +36,6 @@
"import openmc\n",
"from openmc.statepoint import StatePoint\n",
"from openmc.summary import Summary\n",
"from openmc.region import Intersection\n",
"\n",
"%matplotlib inline"
]
@ -183,20 +182,19 @@
"# Create fuel Cell\n",
"fuel_cell = openmc.Cell(name='1.6% Fuel')\n",
"fuel_cell.fill = fuel\n",
"fuel_cell.region = fuel_outer_radius.negative\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 = Intersection(fuel_outer_radius.positive,\n",
" clad_outer_radius.negative)\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.positive\n",
"moderator_cell.region = +clad_outer_radius\n",
"pin_cell_universe.add_cell(moderator_cell)"
]
},
@ -220,9 +218,7 @@
"root_cell.fill = pin_cell_universe\n",
"\n",
"# Add boundary planes\n",
"root_cell.region = Intersection(min_x.positive, max_x.negative,\n",
" min_y.positive, max_y.negative,\n",
" min_z.positive, max_z.negative)\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",
@ -356,7 +352,7 @@
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQA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r/9qSff5L5uMT//V/NdU4YuBTPa/8P67l/6r44ds\n+hYuoP5jx9ciy6XTWlibBrmx8V/TdMfjkP+6pOsu/lvM9N90sf7r+f6m/65n+S8p/itN15v0UkW3\n/+48+PRfJX6S9Joo4g+G/1qYG9KroqP/WypcuvyXPf13wH89/hHef7MB6R3Cqn55U4rv4kfH3zaS\ngQuYP7HjVf89tXrbO+hfLdr+Ozv/SP1dgtQ/Ov8C+i/3+q/Zf2D/HWi6bjT6rym9I/v/03/b+LHS\n4cTg/utTsV7/net/Afzz4f0XGX84/2j9xZ4/sePR/of2X7D/o+vPo/sv6h9B/Bfxr9j1Hz2eN/hO\n8/wfff4A848+f/1A/530/I0+/8PvH9D3H9HnT+R49P0b+v4PfP/4E/wXfP8Mvf9G37/D/ovuP8Se\nP7Hj0f0vdP8tqP9O339cyv7p3P1fdP8Z3v9G999j13/seMax8x/o+ZN7+O+E8zdP/8XOf8Hnz9Dz\nb7HnT+x49PxlCp7/BM+fOv13wvnXBfivt2lMvD8TyH/Hnb+Gz3+j589jz5/Y8ej9h4D+W7qQmf57\nefqv239n3T+C7z+h969i13/seMax+3/o/cMcu/8Y2H9n3p+J6r98pv8m4fwXuH+M3n+OO3++AX9c\nlR+4PhbRAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEwLTAzVDA5OjUxOjU5KzA3OjAwJPCZIQAA\nACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMC0wM1QwOTo1MTo1OSswNzowMFWtIZ0AAAAASUVORK5C\nYII=\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
@ -567,8 +563,9 @@
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
" License: http://mit-crpg.github.io/openmc/license.html\n",
" Version: 0.7.0\n",
" Git SHA1: b167d70c877c516deca785801b9fa6f53fb0985b\n",
" Date/Time: 2015-09-21 10:25:26\n",
" Git SHA1: 71dfde8d12942170a9a8d91796ab40a6e9becaaf\n",
" Date/Time: 2015-10-03 09:53:29\n",
" OpenMP Threads: 4\n",
"\n",
" ===========================================================================\n",
" ========================> INITIALIZATION <=========================\n",
@ -623,20 +620,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 9.1800E-01 seconds\n",
" Reading cross sections = 6.5800E-01 seconds\n",
" Total time in simulation = 1.7037E+01 seconds\n",
" Time in transport only = 1.7024E+01 seconds\n",
" Time in inactive batches = 2.8600E+00 seconds\n",
" Time in active batches = 1.4177E+01 seconds\n",
" Time synchronizing fission bank = 4.0000E-03 seconds\n",
" Sampling source sites = 4.0000E-03 seconds\n",
" Total time for initialization = 3.7200E-01 seconds\n",
" Reading cross sections = 1.2400E-01 seconds\n",
" Total time in simulation = 4.7110E+00 seconds\n",
" Time in transport only = 4.6510E+00 seconds\n",
" Time in inactive batches = 6.1900E-01 seconds\n",
" Time in active batches = 4.0920E+00 seconds\n",
" Time synchronizing fission bank = 2.0000E-03 seconds\n",
" Sampling source sites = 2.0000E-03 seconds\n",
" SEND/RECV source sites = 0.0000E+00 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 1.0000E-03 seconds\n",
" Total time elapsed = 1.7971E+01 seconds\n",
" Calculation Rate (inactive) = 4370.63 neutrons/second\n",
" Calculation Rate (active) = 2645.13 neutrons/second\n",
" Total time for finalization = 2.0000E-03 seconds\n",
" Total time elapsed = 5.0950E+00 seconds\n",
" Calculation Rate (inactive) = 20193.9 neutrons/second\n",
" Calculation Rate (active) = 9164.22 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",

View file

@ -1,5 +1,4 @@
import openmc
from openmc.region import Intersection
###############################################################################
# Simulation Input File Parameters
@ -54,11 +53,11 @@ cell2 = openmc.Cell(cell_id=100, name='cell 2')
cell3 = openmc.Cell(cell_id=101, name='cell 3')
cell4 = openmc.Cell(cell_id=2, name='cell 4')
# Register Surfaces with Cells
cell1.region = surf2.negative
cell2.region = surf1.negative
cell3.region = surf1.positive
cell4.region = Intersection(surf2.positive, surf3.negative)
# Use surface half-spaces to define regions
cell1.region = -surf2
cell2.region = -surf1
cell3.region = +surf1
cell4.region = +surf2 & -surf3
# Register Materials with Cells
cell2.fill = fuel

View file

@ -1,5 +1,4 @@
import openmc
from openmc.region import Intersection
###############################################################################
@ -68,13 +67,12 @@ cell4 = openmc.Cell(cell_id=500, name='cell 4')
cell5 = openmc.Cell(cell_id=600, name='cell 5')
cell6 = openmc.Cell(cell_id=601, name='cell 6')
# Register Surfaces with Cells
cell1.region = Intersection(left.positive, right.negative,
bottom.positive, top.negative)
cell2.region = fuel_surf.negative
cell3.region = fuel_surf.positive
cell5.region = fuel_surf.negative
cell6.region = fuel_surf.positive
# Use surface half-spaces to define regions
cell1.region = +left & -right & +bottom & -top
cell2.region = -fuel_surf
cell3.region = +fuel_surf
cell5.region = -fuel_surf
cell6.region = +fuel_surf
# Register Materials with Cells
cell2.fill = fuel

View file

@ -1,5 +1,4 @@
import openmc
from openmc.region import Intersection
###############################################################################
@ -67,17 +66,15 @@ cell6 = openmc.Cell(cell_id=202, name='cell 6')
cell7 = openmc.Cell(cell_id=301, name='cell 7')
cell8 = openmc.Cell(cell_id=302, name='cell 8')
# Register Surfaces with Cells
cell1.region = Intersection(left.positive, right.negative,
bottom.positive, top.negative)
cell2.region = Intersection(left.positive, right.negative,
bottom.positive, top.negative)
cell3.region = fuel1.negative
cell4.region = fuel1.positive
cell5.region = fuel2.negative
cell6.region = fuel2.positive
cell7.region = fuel3.negative
cell8.region = fuel3.positive
# Use surface half-space to define regions
cell1.region = +left & -right & +bottom & -top
cell2.region = +left & -right & +bottom & -top
cell3.region = -fuel1
cell4.region = +fuel1
cell5.region = -fuel2
cell6.region = +fuel2
cell7.region = -fuel3
cell8.region = +fuel3
# Register Materials with Cells
cell3.fill = fuel

View file

@ -1,5 +1,4 @@
import openmc
from openmc.region import Intersection
###############################################################################
# Simulation Input File Parameters
@ -65,15 +64,14 @@ cell5 = openmc.Cell(cell_id=202, name='cell 5')
cell6 = openmc.Cell(cell_id=301, name='cell 6')
cell7 = openmc.Cell(cell_id=302, name='cell 7')
# Register Regions with Cells
cell1.region = Intersection(left.positive, right.negative,
bottom.positive, top.negative)
cell2.region = fuel1.negative
cell3.region = fuel1.positive
cell4.region = fuel2.negative
cell5.region = fuel2.positive
cell6.region = fuel3.negative
cell7.region = fuel3.positive
# Use surface half-spaces to define regions
cell1.region = +left & -right & +bottom & -top
cell2.region = -fuel1
cell3.region = +fuel1
cell4.region = -fuel2
cell5.region = +fuel2
cell6.region = -fuel3
cell7.region = +fuel3
# Register Materials with Cells
cell2.fill = fuel

View file

@ -1,5 +1,4 @@
import openmc
from openmc.region import Intersection
###############################################################################
# Simulation Input File Parameters
@ -132,12 +131,11 @@ gap = openmc.Cell(cell_id=2, name='cell 2')
clad = openmc.Cell(cell_id=3, name='cell 3')
water = openmc.Cell(cell_id=4, name='cell 4')
# Register Surfaces with Cells
fuel.region = fuel_or.negative
gap.region = Intersection(fuel_or.positive, clad_ir.negative)
clad.region = Intersection(clad_ir.positive, clad_or.negative)
water.region = Intersection(clad_or.positive, left.positive, right.negative,
bottom.positive, top.negative)
# Use surface half-spaces to define regions
fuel.region = -fuel_or
gap.region = +fuel_or & -clad_ir
clad.region = +clad_ir & -clad_or
water.region = +clad_or & +left & -right & +bottom & -top
# Register Materials with Cells
fuel.fill = uo2

View file

@ -1,5 +1,4 @@
import openmc
from openmc.region import Intersection
###############################################################################
# Simulation Input File Parameters
@ -52,10 +51,8 @@ surf6.boundary_type = 'reflective'
# Instantiate Cell
cell = openmc.Cell(cell_id=1, name='cell 1')
# Register Region with Cell
cell.region = Intersection(surf1.positive, surf2.negative,
surf3.positive, surf4.negative,
surf5.positive, surf6.negative)
# Use surface half-spaces to define region
cell.region = +surf1 & -surf2 & +surf3 & -surf4 & +surf5 & -surf6
# Register Material with Cell
cell.fill = fuel

View file

@ -52,9 +52,9 @@ class Region(object):
if i_start >= 0:
j = int(expression[i_start:i])
if j < 0:
tokens.append(surfaces[abs(j)].negative)
tokens.append(-surfaces[abs(j)])
else:
tokens.append(surfaces[abs(j)].positive)
tokens.append(+surfaces[abs(j)])
if expression[i] in '()|~':
# For everything other than intersection, add the operator
@ -89,9 +89,9 @@ class Region(object):
if i_start >= 0:
j = int(expression[i_start:])
if j < 0:
tokens.append(surfaces[abs(j)].negative)
tokens.append(-surfaces[abs(j)])
else:
tokens.append(surfaces[abs(j)].positive)
tokens.append(+surfaces[abs(j)])
# The functions below are used to apply an operator to operands on the
# output queue during the shunting yard algorithm.

View file

@ -194,7 +194,7 @@ class Cell(object):
# If no region has been assigned, simply use the half-space. Otherwise,
# take the intersection of the current region and the half-space
# specified
region = surface.positive if halfspace == 1 else surface.negative
region = +surface if halfspace == 1 else -surface
if self.region is None:
self.region = region
else: