Geometric intrinsics now use property setter/getter decorators

This commit is contained in:
Will Boyd 2015-04-22 00:50:03 -05:00
parent 9cada4df0e
commit 5dac75297d
14 changed files with 1014 additions and 466 deletions

View file

@ -33,7 +33,7 @@ fuel.add_nuclide(u235, 1.)
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.set_default_xs('71c')
materials_file.default_xs = '71c'
materials_file.add_materials([moderator, fuel])
materials_file.export_to_xml()
@ -46,7 +46,7 @@ materials_file.export_to_xml()
surf1 = openmc.ZCylinder(surface_id=1, x0=0, y0=0, R=7, name='surf 1')
surf2 = openmc.ZCylinder(surface_id=2, x0=0, y0=0, R=9, name='surf 2')
surf3 = openmc.ZCylinder(surface_id=3, x0=0, y0=0, R=11, name='surf 3')
surf3.set_boundary_type('vacuum')
surf3.boundary_type = 'vacuum'
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='cell 1')
@ -62,14 +62,14 @@ cell4.add_surface(surface=surf2, halfspace=+1)
cell4.add_surface(surface=surf3, halfspace=-1)
# Register Materials with Cells
cell2.set_fill(fuel)
cell3.set_fill(moderator)
cell4.set_fill(moderator)
cell2.fill = fuel
cell3.fill = moderator
cell4.fill = moderator
# Instantiate Universes
universe1 = openmc.Universe(universe_id=37)
root = openmc.Universe(universe_id=0, name='root universe')
cell1.set_fill(universe1)
cell1.fill = universe1
# Register Cells with Universes
universe1.add_cells([cell2, cell3])
@ -77,11 +77,11 @@ root.add_cells([cell1, cell4])
# Instantiate a Geometry and register the root Universe
geometry = openmc.Geometry()
geometry.set_root_universe(root)
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.set_geometry(geometry)
geometry_file.geometry = geometry
geometry_file.export_to_xml()
@ -91,9 +91,9 @@ geometry_file.export_to_xml()
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.set_source_space('box', [-4, -4, -4, 4, 4, 4])
settings_file.export_to_xml()

View file

@ -38,7 +38,7 @@ iron.add_nuclide(fe56, 1.)
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.set_default_xs('71c')
materials_file.default_xs = '71c'
materials_file.add_materials([moderator, fuel, iron])
materials_file.export_to_xml()
@ -54,10 +54,10 @@ bottom = openmc.YPlane(surface_id=3, y0=-4, name='bottom')
top = openmc.YPlane(surface_id=4, y0=4, name='top')
fuel_surf = openmc.ZCylinder(surface_id=5, x0=0, y0=0, R=0.4)
left.set_boundary_type('vacuum')
right.set_boundary_type('vacuum')
top.set_boundary_type('vacuum')
bottom.set_boundary_type('vacuum')
left.boundary_type = 'vacuum'
right.boundary_type = 'vacuum'
top.boundary_type = 'vacuum'
bottom.boundary_type = 'vacuum'
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
@ -78,11 +78,11 @@ cell5.add_surface(fuel_surf, halfspace=-1)
cell6.add_surface(fuel_surf, halfspace=+1)
# Register Materials with Cells
cell2.set_fill(fuel)
cell3.set_fill(moderator)
cell4.set_fill(moderator)
cell5.set_fill(iron)
cell6.set_fill(moderator)
cell2.fill = fuel
cell3.fill = moderator
cell4.fill = moderator
cell5.fill = iron
cell6.fill = moderator
# Instantiate Universe
univ1 = openmc.Universe(universe_id=1)
@ -98,24 +98,24 @@ root.add_cell(cell1)
# Instantiate a Lattice
lattice = openmc.HexLattice(lattice_id=5)
lattice.set_center([0., 0., 0.])
lattice.set_pitch([1., 2.])
lattice.set_universes([
[ [univ2] + [univ3]*11, [univ2] + [univ3]*5, [univ3] ],
[ [univ2] + [univ1]*11, [univ2] + [univ1]*5, [univ1] ],
[ [univ2] + [univ3]*11, [univ2] + [univ3]*5, [univ3] ]])
lattice.set_outer(univ2)
lattice.center = [0., 0., 0.]
lattice.pitch = [1., 2.]
lattice.universes = \
[ [ [univ2] + [univ3]*11, [univ2] + [univ3]*5, [univ3] ],
[ [univ2] + [univ1]*11, [univ2] + [univ1]*5, [univ1] ],
[ [univ2] + [univ3]*11, [univ2] + [univ3]*5, [univ3] ] ]
lattice.outer = univ2
# Fill Cell with the Lattice
cell1.set_fill(lattice)
cell1.fill = lattice
# Instantiate a Geometry and register the root Universe
geometry = openmc.Geometry()
geometry.set_root_universe(root)
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.set_geometry(geometry)
geometry_file.geometry = geometry
geometry_file.export_to_xml()
@ -125,9 +125,9 @@ geometry_file.export_to_xml()
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
settings_file.export_to_xml()
@ -137,19 +137,19 @@ settings_file.export_to_xml()
###############################################################################
plot_xy = openmc.Plot(plot_id=1)
plot_xy.set_filename('plot_xy')
plot_xy.set_origin([0, 0, 0])
plot_xy.set_width([6, 6])
plot_xy.set_pixels([400, 400])
plot_xy.set_color('mat')
plot_xy.filename = 'plot_xy'
plot_xy.origin = [0, 0, 0]
plot_xy.width = [6, 6]
plot_xy.pixels = [400, 400]
plot_xy.color = 'mat'
plot_yz = openmc.Plot(plot_id=2)
plot_yz.set_filename('plot_yz')
plot_yz.set_basis('yz')
plot_yz.set_origin([0, 0, 0])
plot_yz.set_width([8, 8])
plot_yz.set_pixels([400, 400])
plot_yz.set_color('mat')
plot_yz.filename = 'plot_yz'
plot_yz.basis = 'yz'
plot_yz.origin = [0, 0, 0]
plot_yz.width = [8, 8]
plot_yz.pixels = [400, 400]
plot_yz.color = 'mat'
# Instantiate a PlotsFile, add Plot, and export to XML
plot_file = openmc.PlotsFile()

View file

@ -33,7 +33,7 @@ moderator.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.set_default_xs('71c')
materials_file.default_xs = '71c'
materials_file.add_materials([moderator, fuel])
materials_file.export_to_xml()
@ -51,10 +51,10 @@ fuel1 = openmc.ZCylinder(surface_id=5, x0=0, y0=0, R=0.4)
fuel2 = openmc.ZCylinder(surface_id=6, x0=0, y0=0, R=0.3)
fuel3 = openmc.ZCylinder(surface_id=7, x0=0, y0=0, R=0.2)
left.set_boundary_type('vacuum')
right.set_boundary_type('vacuum')
top.set_boundary_type('vacuum')
bottom.set_boundary_type('vacuum')
left.boundary_type = 'vacuum'
right.boundary_type = 'vacuum'
top.boundary_type = 'vacuum'
bottom.boundary_type = 'vacuum'
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
@ -83,12 +83,12 @@ cell7.add_surface(fuel3, halfspace=-1)
cell8.add_surface(fuel3, halfspace=+1)
# Register Materials with Cells
cell3.set_fill(fuel)
cell4.set_fill(moderator)
cell5.set_fill(fuel)
cell6.set_fill(moderator)
cell7.set_fill(fuel)
cell8.set_fill(moderator)
cell3.fill = fuel
cell4.fill = moderator
cell5.fill = fuel
cell6.fill = moderator
cell7.fill = fuel
cell8.fill = moderator
# Instantiate Universe
univ1 = openmc.Universe(universe_id=1)
@ -106,30 +106,30 @@ univ4.add_cell(cell2)
# Instantiate nested Lattices
lattice1 = openmc.RectLattice(lattice_id=4, name='4x4 assembly')
lattice1.set_dimension([2, 2])
lattice1.set_lower_left([-1., -1.])
lattice1.set_pitch([1., 1.])
lattice1.set_universes([[univ1, univ2],
[univ2, univ3]])
lattice1.dimension = [2, 2]
lattice1.lower_left = [-1., -1.]
lattice1.pitch = [1., 1.]
lattice1.universes = [[univ1, univ2],
[univ2, univ3]]
lattice2 = openmc.RectLattice(lattice_id=6, name='4x4 core')
lattice2.set_dimension([2, 2])
lattice2.set_lower_left([-2., -2.])
lattice2.set_pitch([2., 2.])
lattice2.set_universes([[univ4, univ4],
[univ4, univ4]])
lattice2.dimension = [2, 2]
lattice2.lower_left = [-2., -2.]
lattice2.pitch = [2., 2.]
lattice2.universes = [[univ4, univ4],
[univ4, univ4]]
# Fill Cell with the Lattice
cell1.set_fill(lattice2)
cell2.set_fill(lattice1)
cell1.fill = lattice2
cell2.fill = lattice1
# Instantiate a Geometry and register the root Universe
geometry = openmc.Geometry()
geometry.set_root_universe(root)
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.set_geometry(geometry)
geometry_file.geometry = geometry
geometry_file.export_to_xml()
@ -139,9 +139,9 @@ geometry_file.export_to_xml()
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
settings_file.export_to_xml()
@ -151,10 +151,10 @@ settings_file.export_to_xml()
###############################################################################
plot = openmc.Plot(plot_id=1)
plot.set_origin([0, 0, 0])
plot.set_width([4, 4])
plot.set_pixels([400, 400])
plot.set_color('mat')
plot.origin = [0, 0, 0]
plot.width = [4, 4]
plot.pixels = [400, 400]
plot.color = 'mat'
# Instantiate a PlotsFile, add Plot, and export to XML
plot_file = openmc.PlotsFile()
@ -168,14 +168,14 @@ plot_file.export_to_xml()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.set_type('rectangular')
mesh.set_dimension([4, 4])
mesh.set_lower_left([-2, -2])
mesh.set_width([1, 1])
mesh.type = 'rectangular'
mesh.dimension = [4, 4]
mesh.lower_left = [-2, -2]
mesh.width = [1, 1]
# Instantiate tally Filter
mesh_filter = openmc.Filter()
mesh_filter.set_mesh(mesh)
mesh_filter.mesh = mesh
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)

View file

@ -33,7 +33,7 @@ moderator.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.set_default_xs('71c')
materials_file.default_xs = '71c'
materials_file.add_materials([moderator, fuel])
materials_file.export_to_xml()
@ -51,10 +51,10 @@ fuel1 = openmc.ZCylinder(surface_id=5, x0=0, y0=0, R=0.4)
fuel2 = openmc.ZCylinder(surface_id=6, x0=0, y0=0, R=0.3)
fuel3 = openmc.ZCylinder(surface_id=7, x0=0, y0=0, R=0.2)
left.set_boundary_type('vacuum')
right.set_boundary_type('vacuum')
top.set_boundary_type('vacuum')
bottom.set_boundary_type('vacuum')
left.boundary_type = 'vacuum'
right.boundary_type = 'vacuum'
top.boundary_type = 'vacuum'
bottom.boundary_type = 'vacuum'
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
@ -78,12 +78,12 @@ cell6.add_surface(fuel3, halfspace=-1)
cell7.add_surface(fuel3, halfspace=+1)
# Register Materials with Cells
cell2.set_fill(fuel)
cell3.set_fill(moderator)
cell4.set_fill(fuel)
cell5.set_fill(moderator)
cell6.set_fill(fuel)
cell7.set_fill(moderator)
cell2.fill = fuel
cell3.fill = moderator
cell4.fill = fuel
cell5.fill = moderator
cell6.fill = fuel
cell7.fill = moderator
# Instantiate Universe
univ1 = openmc.Universe(universe_id=1)
@ -99,24 +99,24 @@ root.add_cell(cell1)
# Instantiate a Lattice
lattice = openmc.RectLattice(lattice_id=5)
lattice.set_dimension([4, 4])
lattice.set_lower_left([-2., -2.])
lattice.set_pitch([1., 1.])
lattice.set_universes([[univ1, univ2, univ1, univ2],
[univ2, univ3, univ2, univ3],
[univ1, univ2, univ1, univ2],
[univ2, univ3, univ2, univ3]])
lattice.dimension = [4, 4]
lattice.lower_left = [-2., -2.]
lattice.pitch = [1., 1.]
lattice.universes = [[univ1, univ2, univ1, univ2],
[univ2, univ3, univ2, univ3],
[univ1, univ2, univ1, univ2],
[univ2, univ3, univ2, univ3]]
# Fill Cell with the Lattice
cell1.set_fill(lattice)
cell1.fill = lattice
# Instantiate a Geometry and register the root Universe
geometry = openmc.Geometry()
geometry.set_root_universe(root)
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.set_geometry(geometry)
geometry_file.geometry = geometry
geometry_file.export_to_xml()
@ -126,9 +126,9 @@ geometry_file.export_to_xml()
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
settings_file.export_to_xml()
@ -138,10 +138,10 @@ settings_file.export_to_xml()
###############################################################################
plot = openmc.Plot(plot_id=1)
plot.set_origin([0, 0, 0])
plot.set_width([4, 4])
plot.set_pixels([400, 400])
plot.set_color('mat')
plot.origin = [0, 0, 0]
plot.width = [4, 4]
plot.pixels = [400, 400]
plot.color = 'mat'
# Instantiate a PlotsFile, add Plot, and export to XML
plot_file = openmc.PlotsFile()
@ -155,14 +155,14 @@ plot_file.export_to_xml()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.set_type('rectangular')
mesh.set_dimension([4, 4])
mesh.set_lower_left([-2, -2])
mesh.set_width([1, 1])
mesh.type = 'rectangular'
mesh.dimension = [4, 4]
mesh.lower_left = [-2, -2]
mesh.width = [1, 1]
# Instantiate tally Filter
mesh_filter = openmc.Filter()
mesh_filter.set_mesh(mesh)
mesh_filter.mesh = mesh
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)

View file

@ -103,7 +103,7 @@ borated_water.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.set_default_xs('71c')
materials_file.default_xs = '71c'
materials_file.add_materials([uo2, helium, zircaloy, borated_water])
materials_file.export_to_xml()
@ -121,10 +121,10 @@ right = openmc.XPlane(surface_id=5, x0=0.62992, name='right')
bottom = openmc.YPlane(surface_id=6, y0=-0.62992, name='bottom')
top = openmc.YPlane(surface_id=7, y0=0.62992, name='top')
left.set_boundary_type('reflective')
right.set_boundary_type('reflective')
top.set_boundary_type('reflective')
bottom.set_boundary_type('reflective')
left.boundary_type = 'reflective'
right.boundary_type = 'reflective'
top.boundary_type = 'reflective'
bottom.boundary_type = 'reflective'
# Instantiate Cells
fuel = openmc.Cell(cell_id=1, name='cell 1')
@ -145,10 +145,10 @@ water.add_surface(bottom, halfspace=+1)
water.add_surface(top, halfspace=-1)
# Register Materials with Cells
fuel.set_fill(uo2)
gap.set_fill(helium)
clad.set_fill(zircaloy)
water.set_fill(borated_water)
fuel.fill = uo2
gap.fill = helium
clad.fill = zircaloy
water.fill = borated_water
# Instantiate Universe
root = openmc.Universe(universe_id=0, name='root universe')
@ -158,11 +158,11 @@ root.add_cells([fuel, gap, clad, water])
# Instantiate a Geometry and register the root Universe
geometry = openmc.Geometry()
geometry.set_root_universe(root)
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.set_geometry(geometry)
geometry_file.geometry = geometry
geometry_file.export_to_xml()
@ -172,14 +172,14 @@ geometry_file.export_to_xml()
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.set_source_space('box', [-0.62992, -0.62992, -1, \
0.62992, 0.62992, 1])
settings_file.set_entropy_lower_left([-0.39218, -0.39218, -1.e50])
settings_file.set_entropy_upper_right([0.39218, 0.39218, 1.e50])
settings_file.set_entropy_dimension([10, 10, 1])
settings_file.entropy_lower_left = [-0.39218, -0.39218, -1.e50]
settings_file.entropy_upper_right = [0.39218, 0.39218, 1.e50]
settings_file.entropy_dimension = [10, 10, 1]
settings_file.export_to_xml()
@ -189,15 +189,15 @@ settings_file.export_to_xml()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.set_type('rectangular')
mesh.set_dimension([100, 100, 1])
mesh.set_lower_left([-0.62992, -0.62992, -1.e50])
mesh.set_upper_right([0.62992, 0.62992, 1.e50])
mesh.type = 'rectangular'
mesh.dimension = [100, 100, 1]
mesh.lower_left = [-0.62992, -0.62992, -1.e50]
mesh.upper_right = [0.62992, 0.62992, 1.e50]
# Instantiate some tally Filters
energy_filter = openmc.Filter(type='energy', bins=[0., 4.e-6, 20.])
mesh_filter = openmc.Filter()
mesh_filter.set_mesh(mesh)
mesh_filter.mesh = mesh
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)

View file

@ -25,7 +25,7 @@ fuel.add_nuclide(u235, 1.)
# Instantiate a MaterialsFile, register Material, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.set_default_xs('71c')
materials_file.default_xs = '71c'
materials_file.add_material(fuel)
materials_file.export_to_xml()
@ -42,12 +42,12 @@ surf4 = openmc.YPlane(surface_id=4, y0=+1, name='surf 4')
surf5 = openmc.ZPlane(surface_id=5, z0=-1, name='surf 5')
surf6 = openmc.ZPlane(surface_id=6, z0=+1, name='surf 6')
surf1.set_boundary_type('vacuum')
surf2.set_boundary_type('vacuum')
surf3.set_boundary_type('reflective')
surf4.set_boundary_type('reflective')
surf5.set_boundary_type('reflective')
surf6.set_boundary_type('reflective')
surf1.boundary_type = 'vacuum'
surf2.boundary_type = 'vacuum'
surf3.boundary_type = 'reflective'
surf4.boundary_type = 'reflective'
surf5.boundary_type = 'reflective'
surf6.boundary_type = 'reflective'
# Instantiate Cell
cell = openmc.Cell(cell_id=1, name='cell 1')
@ -61,7 +61,7 @@ cell.add_surface(surface=surf5, halfspace=+1)
cell.add_surface(surface=surf6, halfspace=-1)
# Register Material with Cell
cell.set_fill(fuel)
cell.fill = fuel
# Instantiate Universes
root = openmc.Universe(universe_id=0, name='root universe')
@ -71,11 +71,11 @@ root.add_cell(cell)
# Instantiate a Geometry and register the root Universe
geometry = openmc.Geometry()
geometry.set_root_universe(root)
geometry.root_universe = root
# Instantiate a GeometryFile, register Geometry, and export to XML
geometry_file = openmc.GeometryFile()
geometry_file.set_geometry(geometry)
geometry_file.geometry = geometry
geometry_file.export_to_xml()
@ -85,8 +85,8 @@ geometry_file.export_to_xml()
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
settings_file = openmc.SettingsFile()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
settings_file.export_to_xml()