mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Geometric intrinsics now use property setter/getter decorators
This commit is contained in:
parent
9cada4df0e
commit
5dac75297d
14 changed files with 1014 additions and 466 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue