mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Updated sample input scripts for Python API to conform to new API specs
This commit is contained in:
parent
2767d3f53f
commit
3bb1f8faf7
8 changed files with 291 additions and 330 deletions
|
|
@ -20,14 +20,14 @@ u235 = openmc.Nuclide('U-235')
|
|||
|
||||
# Instantiate a Material and register the Nuclide
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.setDensity('g/cc', 4.5)
|
||||
fuel.addNuclide(u235, 1.)
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide(u235, 1.)
|
||||
|
||||
# Instantiate a MaterialsFile, register Material, and export to XML
|
||||
materials_file = openmc.MaterialsFile()
|
||||
materials_file.setDefaultXS('71c')
|
||||
materials_file.addMaterial(fuel)
|
||||
materials_file.exportToXML()
|
||||
materials_file.set_default_xs('71c')
|
||||
materials_file.add_material(fuel)
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -42,41 +42,41 @@ 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.setBoundaryType('vacuum')
|
||||
surf2.setBoundaryType('vacuum')
|
||||
surf3.setBoundaryType('reflective')
|
||||
surf4.setBoundaryType('reflective')
|
||||
surf5.setBoundaryType('reflective')
|
||||
surf6.setBoundaryType('reflective')
|
||||
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')
|
||||
|
||||
# Instantiate Cell
|
||||
cell = openmc.Cell(cell_id=1, name='cell 1')
|
||||
|
||||
# Register Surfaces with Cell
|
||||
cell.addSurface(surface=surf1, halfspace=+1)
|
||||
cell.addSurface(surface=surf2, halfspace=-1)
|
||||
cell.addSurface(surface=surf3, halfspace=+1)
|
||||
cell.addSurface(surface=surf4, halfspace=-1)
|
||||
cell.addSurface(surface=surf5, halfspace=+1)
|
||||
cell.addSurface(surface=surf6, halfspace=-1)
|
||||
cell.add_surface(surface=surf1, halfspace=+1)
|
||||
cell.add_surface(surface=surf2, halfspace=-1)
|
||||
cell.add_surface(surface=surf3, halfspace=+1)
|
||||
cell.add_surface(surface=surf4, halfspace=-1)
|
||||
cell.add_surface(surface=surf5, halfspace=+1)
|
||||
cell.add_surface(surface=surf6, halfspace=-1)
|
||||
|
||||
# Register Material with Cell
|
||||
cell.setFill(fuel)
|
||||
cell.set_fill(fuel)
|
||||
|
||||
# Instantiate Universes
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cell with Universe
|
||||
root.addCell(cell)
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
geometry = openmc.Geometry()
|
||||
geometry.setRootUniverse(root)
|
||||
geometry.set_root_universe(root)
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.setGeometry(geometry)
|
||||
geometry_file.exportToXML()
|
||||
geometry_file.set_geometry(geometry)
|
||||
geometry_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -85,8 +85,8 @@ geometry_file.exportToXML()
|
|||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
settings_file.setBatches(batches)
|
||||
settings_file.setInactive(inactive)
|
||||
settings_file.setParticles(particles)
|
||||
settings_file.setSourceSpace('box', [-1, -1, -1, 1, 1, 1])
|
||||
settings_file.exportToXML()
|
||||
settings_file.set_batches(batches)
|
||||
settings_file.set_inactive(inactive)
|
||||
settings_file.set_particles(particles)
|
||||
settings_file.set_source_space('box', [-1, -1, -1, 1, 1, 1])
|
||||
settings_file.export_to_xml()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue