Updated sample input scripts for Python API to conform to new API specs

This commit is contained in:
Will Boyd 2014-11-03 20:05:34 -05:00
parent 2767d3f53f
commit 3bb1f8faf7
8 changed files with 291 additions and 330 deletions

View file

@ -22,20 +22,20 @@ u235 = openmc.Nuclide('U-235')
# Instantiate some Materials and register the appropriate Nuclides
moderator = openmc.Material(material_id=41, name='moderator')
moderator.setDensity('g/cc', 1.0)
moderator.addNuclide(h1, 2.)
moderator.addNuclide(o16, 1.)
moderator.addSAlphaBeta('HH2O', '71t')
moderator.set_density('g/cc', 1.0)
moderator.add_nuclide(h1, 2.)
moderator.add_nuclide(o16, 1.)
moderator.add_s_alpha_beta('HH2O', '71t')
fuel = openmc.Material(material_id=40, 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 all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.setDefaultXS('71c')
materials_file.addMaterials([moderator, fuel])
materials_file.exportToXML()
materials_file.set_default_xs('71c')
materials_file.add_materials([moderator, fuel])
materials_file.export_to_xml()
###############################################################################
@ -46,7 +46,7 @@ materials_file.exportToXML()
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.setBoundaryType('vacuum')
surf3.set_boundary_type('vacuum')
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='cell 1')
@ -55,34 +55,34 @@ cell3 = openmc.Cell(cell_id=101, name='cell 3')
cell4 = openmc.Cell(cell_id=2, name='cell 4')
# Register Surfaces with Cells
cell1.addSurface(surface=surf2, halfspace=-1)
cell2.addSurface(surface=surf1, halfspace=-1)
cell3.addSurface(surface=surf1, halfspace=+1)
cell4.addSurface(surface=surf2, halfspace=+1)
cell4.addSurface(surface=surf3, halfspace=-1)
cell1.add_surface(surface=surf2, halfspace=-1)
cell2.add_surface(surface=surf1, halfspace=-1)
cell3.add_surface(surface=surf1, halfspace=+1)
cell4.add_surface(surface=surf2, halfspace=+1)
cell4.add_surface(surface=surf3, halfspace=-1)
# Register Materials with Cells
cell2.setFill(fuel)
cell3.setFill(moderator)
cell4.setFill(moderator)
cell2.set_fill(fuel)
cell3.set_fill(moderator)
cell4.set_fill(moderator)
# Instantiate Universes
universe1 = openmc.Universe(universe_id=37)
root = openmc.Universe(universe_id=0, name='root universe')
cell1.setFill(universe1)
cell1.set_fill(universe1)
# Register Cells with Universes
universe1.addCells([cell2, cell3])
root.addCells([cell1, cell4])
universe1.add_cells([cell2, cell3])
root.add_cells([cell1, cell4])
# 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()
###############################################################################
@ -91,11 +91,11 @@ 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', [-4, -4, -4, 4, 4, 4])
settings_file.exportToXML()
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.set_source_space('box', [-4, -4, -4, 4, 4, 4])
settings_file.export_to_xml()
###############################################################################
@ -109,33 +109,33 @@ energyout_filter = openmc.Filter(type='energyout', bins=[0., 20.])
# Instantiate the first Tally
first_tally = openmc.Tally(tally_id=1, label='first tally')
first_tally.addFilter(cell_filter)
first_tally.add_filter(cell_filter)
scores = ['total', 'scatter', 'nu-scatter', \
'absorption', 'fission', 'nu-fission']
for score in scores:
first_tally.addScore(score)
first_tally.add_score(score)
# Instantiate the second Tally
second_tally = openmc.Tally(tally_id=2, label='second tally')
second_tally.addFilter(cell_filter)
second_tally.addFilter(energy_filter)
second_tally.add_filter(cell_filter)
second_tally.add_filter(energy_filter)
scores = ['total', 'scatter', 'nu-scatter', \
'absorption', 'fission', 'nu-fission']
for score in scores:
second_tally.addScore(score)
second_tally.add_score(score)
# Instantiate the third Tally
third_tally = openmc.Tally(tally_id=3, label='third tally')
third_tally.addFilter(cell_filter)
third_tally.addFilter(energy_filter)
third_tally.addFilter(energyout_filter)
third_tally.add_filter(cell_filter)
third_tally.add_filter(energy_filter)
third_tally.add_filter(energyout_filter)
scores = ['scatter', 'nu-scatter', 'nu-fission']
for score in scores:
third_tally.addScore(score)
third_tally.add_score(score)
# Instantiate a TalliesFile, register all Tallies, and export to XML
tallies_file = openmc.TalliesFile()
tallies_file.addTally(first_tally)
tallies_file.addTally(second_tally)
tallies_file.addTally(third_tally)
tallies_file.exportToXML()
tallies_file.add_tally(first_tally)
tallies_file.add_tally(second_tally)
tallies_file.add_tally(third_tally)
tallies_file.export_to_xml()

View file

@ -22,20 +22,20 @@ u235 = openmc.Nuclide('U-235')
# Instantiate some Materials and register the appropriate Nuclides
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.)
moderator = openmc.Material(material_id=2, name='moderator')
moderator.setDensity('g/cc', 1.0)
moderator.addNuclide(h1, 2.)
moderator.addNuclide(o16, 1.)
moderator.addSAlphaBeta('HH2O', '71t')
moderator.set_density('g/cc', 1.0)
moderator.add_nuclide(h1, 2.)
moderator.add_nuclide(o16, 1.)
moderator.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.setDefaultXS('71c')
materials_file.addMaterials([moderator, fuel])
materials_file.exportToXML()
materials_file.set_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.setBoundaryType('vacuum')
right.setBoundaryType('vacuum')
top.setBoundaryType('vacuum')
bottom.setBoundaryType('vacuum')
left.set_boundary_type('vacuum')
right.set_boundary_type('vacuum')
top.set_boundary_type('vacuum')
bottom.set_boundary_type('vacuum')
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
@ -67,28 +67,28 @@ cell7 = openmc.Cell(cell_id=301, name='cell 7')
cell8 = openmc.Cell(cell_id=302, name='cell 8')
# Register Surfaces with Cells
cell1.addSurface(left, halfspace=+1)
cell1.addSurface(right, halfspace=-1)
cell1.addSurface(bottom, halfspace=+1)
cell1.addSurface(top, halfspace=-1)
cell2.addSurface(left, halfspace=+1)
cell2.addSurface(right, halfspace=-1)
cell2.addSurface(bottom, halfspace=+1)
cell2.addSurface(top, halfspace=-1)
cell3.addSurface(fuel1, halfspace=-1)
cell4.addSurface(fuel1, halfspace=+1)
cell5.addSurface(fuel2, halfspace=-1)
cell6.addSurface(fuel2, halfspace=+1)
cell7.addSurface(fuel3, halfspace=-1)
cell8.addSurface(fuel3, halfspace=+1)
cell1.add_surface(left, halfspace=+1)
cell1.add_surface(right, halfspace=-1)
cell1.add_surface(bottom, halfspace=+1)
cell1.add_surface(top, halfspace=-1)
cell2.add_surface(left, halfspace=+1)
cell2.add_surface(right, halfspace=-1)
cell2.add_surface(bottom, halfspace=+1)
cell2.add_surface(top, halfspace=-1)
cell3.add_surface(fuel1, halfspace=-1)
cell4.add_surface(fuel1, halfspace=+1)
cell5.add_surface(fuel2, halfspace=-1)
cell6.add_surface(fuel2, halfspace=+1)
cell7.add_surface(fuel3, halfspace=-1)
cell8.add_surface(fuel3, halfspace=+1)
# Register Materials with Cells
cell3.setFill(fuel)
cell4.setFill(moderator)
cell5.setFill(fuel)
cell6.setFill(moderator)
cell7.setFill(fuel)
cell8.setFill(moderator)
cell3.set_fill(fuel)
cell4.set_fill(moderator)
cell5.set_fill(fuel)
cell6.set_fill(moderator)
cell7.set_fill(fuel)
cell8.set_fill(moderator)
# Instantiate Universe
univ1 = openmc.Universe(universe_id=1)
@ -98,39 +98,39 @@ univ4 = openmc.Universe(universe_id=5)
root = openmc.Universe(universe_id=0, name='root universe')
# Register Cells with Universe
univ1.addCells([cell3, cell4])
univ2.addCells([cell5, cell6])
univ3.addCells([cell7, cell8])
root.addCell(cell1)
univ4.addCell(cell2)
univ1.add_cells([cell3, cell4])
univ2.add_cells([cell5, cell6])
univ3.add_cells([cell7, cell8])
root.add_cell(cell1)
univ4.add_cell(cell2)
# Instantiate nested Lattices
lattice1 = openmc.Lattice(lattice_id=4, name='4x4 assembly')
lattice1.setDimension([2, 2])
lattice1.setLowerLeft([-1., -1.])
lattice1.setWidth([1., 1.])
lattice1.setUniverses([[univ1, univ2],
lattice1.set_dimension([2, 2])
lattice1.set_lower_left([-1., -1.])
lattice1.set_width([1., 1.])
lattice1.set_universes([[univ1, univ2],
[univ2, univ3]])
lattice2 = openmc.Lattice(lattice_id=6, name='4x4 core')
lattice2.setDimension([2, 2])
lattice2.setLowerLeft([-2., -2.])
lattice2.setWidth([2., 2.])
lattice2.setUniverses([[univ4, univ4],
lattice2.set_dimension([2, 2])
lattice2.set_lower_left([-2., -2.])
lattice2.set_width([2., 2.])
lattice2.set_universes([[univ4, univ4],
[univ4, univ4]])
# Fill Cell with the Lattice
cell1.setFill(lattice2)
cell2.setFill(lattice1)
cell1.set_fill(lattice2)
cell2.set_fill(lattice1)
# 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()
###############################################################################
@ -139,11 +139,11 @@ 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()
###############################################################################
@ -151,15 +151,15 @@ settings_file.exportToXML()
###############################################################################
plot = openmc.Plot(plot_id=1)
plot.setOrigin([0, 0, 0])
plot.setWidth([4, 4])
plot.setPixels([400, 400])
plot.setColor('mat')
plot.set_origin([0, 0, 0])
plot.set_width([4, 4])
plot.set_pixels([400, 400])
plot.set_color('mat')
# Instantiate a PlotsFile, add Plot, and export to XML
plot_file = openmc.PlotsFile()
plot_file.addPlot(plot)
plot_file.exportToXML()
plot_file.add_plot(plot)
plot_file.export_to_xml()
###############################################################################
@ -168,22 +168,22 @@ plot_file.exportToXML()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.setType('rectangular')
mesh.setDimension([4, 4])
mesh.setLowerLeft([-2, -2])
mesh.setWidth([1, 1])
mesh.set_type('rectangular')
mesh.set_dimension([4, 4])
mesh.set_lower_left([-2, -2])
mesh.set_width([1, 1])
# Instantiate tally Filter
mesh_filter = openmc.Filter()
mesh_filter.setMesh(mesh)
mesh_filter.set_mesh(mesh)
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)
tally.addFilter(mesh_filter)
tally.addScore('total')
tally.add_filter(mesh_filter)
tally.add_score('total')
# Instantiate a TalliesFile, register Tally/Mesh, and export to XML
tallies_file = openmc.TalliesFile()
tallies_file.addMesh(mesh)
tallies_file.addTally(tally)
tallies_file.exportToXML()
tallies_file.add_mesh(mesh)
tallies_file.add_tally(tally)
tallies_file.export_to_xml()

View file

@ -22,20 +22,20 @@ u235 = openmc.Nuclide('U-235')
# Instantiate some Materials and register the appropriate Nuclides
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.)
moderator = openmc.Material(material_id=2, name='moderator')
moderator.setDensity('g/cc', 1.0)
moderator.addNuclide(h1, 2.)
moderator.addNuclide(o16, 1.)
moderator.addSAlphaBeta('HH2O', '71t')
moderator.set_density('g/cc', 1.0)
moderator.add_nuclide(h1, 2.)
moderator.add_nuclide(o16, 1.)
moderator.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.setDefaultXS('71c')
materials_file.addMaterials([moderator, fuel])
materials_file.exportToXML()
materials_file.set_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.setBoundaryType('vacuum')
right.setBoundaryType('vacuum')
top.setBoundaryType('vacuum')
bottom.setBoundaryType('vacuum')
left.set_boundary_type('vacuum')
right.set_boundary_type('vacuum')
top.set_boundary_type('vacuum')
bottom.set_boundary_type('vacuum')
# Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name='Cell 1')
@ -66,24 +66,24 @@ cell6 = openmc.Cell(cell_id=301, name='cell 6')
cell7 = openmc.Cell(cell_id=302, name='cell 7')
# Register Surfaces with Cells
cell1.addSurface(left, halfspace=+1)
cell1.addSurface(right, halfspace=-1)
cell1.addSurface(bottom, halfspace=+1)
cell1.addSurface(top, halfspace=-1)
cell2.addSurface(fuel1, halfspace=-1)
cell3.addSurface(fuel1, halfspace=+1)
cell4.addSurface(fuel2, halfspace=-1)
cell5.addSurface(fuel2, halfspace=+1)
cell6.addSurface(fuel3, halfspace=-1)
cell7.addSurface(fuel3, halfspace=+1)
cell1.add_surface(left, halfspace=+1)
cell1.add_surface(right, halfspace=-1)
cell1.add_surface(bottom, halfspace=+1)
cell1.add_surface(top, halfspace=-1)
cell2.add_surface(fuel1, halfspace=-1)
cell3.add_surface(fuel1, halfspace=+1)
cell4.add_surface(fuel2, halfspace=-1)
cell5.add_surface(fuel2, halfspace=+1)
cell6.add_surface(fuel3, halfspace=-1)
cell7.add_surface(fuel3, halfspace=+1)
# Register Materials with Cells
cell2.setFill(fuel)
cell3.setFill(moderator)
cell4.setFill(fuel)
cell5.setFill(moderator)
cell6.setFill(fuel)
cell7.setFill(moderator)
cell2.set_fill(fuel)
cell3.set_fill(moderator)
cell4.set_fill(fuel)
cell5.set_fill(moderator)
cell6.set_fill(fuel)
cell7.set_fill(moderator)
# Instantiate Universe
univ1 = openmc.Universe(universe_id=1)
@ -92,32 +92,32 @@ univ3 = openmc.Universe(universe_id=3)
root = openmc.Universe(universe_id=0, name='root universe')
# Register Cells with Universe
univ1.addCells([cell2, cell3])
univ2.addCells([cell4, cell5])
univ3.addCells([cell6, cell7])
root.addCell(cell1)
univ1.add_cells([cell2, cell3])
univ2.add_cells([cell4, cell5])
univ3.add_cells([cell6, cell7])
root.add_cell(cell1)
# Instantiate a Lattice
lattice = openmc.Lattice(lattice_id=5)
lattice.setDimension([4, 4])
lattice.setLowerLeft([-2., -2.])
lattice.setWidth([1., 1.])
lattice.setUniverses([[univ1, univ2, univ1, univ2],
lattice.set_dimension([4, 4])
lattice.set_lower_left([-2., -2.])
lattice.set_width([1., 1.])
lattice.set_universes([[univ1, univ2, univ1, univ2],
[univ2, univ3, univ2, univ3],
[univ1, univ2, univ1, univ2],
[univ2, univ3, univ2, univ3]])
# Fill Cell with the Lattice
cell1.setFill(lattice)
cell1.set_fill(lattice)
# 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()
###############################################################################
@ -126,11 +126,11 @@ 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()
###############################################################################
@ -138,15 +138,15 @@ settings_file.exportToXML()
###############################################################################
plot = openmc.Plot(plot_id=1)
plot.setOrigin([0, 0, 0])
plot.setWidth([4, 4])
plot.setPixels([400, 400])
plot.setColor('mat')
plot.set_origin([0, 0, 0])
plot.set_width([4, 4])
plot.set_pixels([400, 400])
plot.set_color('mat')
# Instantiate a PlotsFile, add Plot, and export to XML
plot_file = openmc.PlotsFile()
plot_file.addPlot(plot)
plot_file.exportToXML()
plot_file.add_plot(plot)
plot_file.export_to_xml()
###############################################################################
@ -155,22 +155,22 @@ plot_file.exportToXML()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.setType('rectangular')
mesh.setDimension([4, 4])
mesh.setLowerLeft([-2, -2])
mesh.setWidth([1, 1])
mesh.set_type('rectangular')
mesh.set_dimension([4, 4])
mesh.set_lower_left([-2, -2])
mesh.set_width([1, 1])
# Instantiate tally Filter
mesh_filter = openmc.Filter()
mesh_filter.setMesh(mesh)
mesh_filter.set_mesh(mesh)
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)
tally.addFilter(mesh_filter)
tally.addScore('total')
tally.add_filter(mesh_filter)
tally.add_score('total')
# Instantiate a TalliesFile, register Tally/Mesh, and export to XML
tallies_file = openmc.TalliesFile()
tallies_file.addMesh(mesh)
tallies_file.addTally(tally)
tallies_file.exportToXML()
tallies_file.add_mesh(mesh)
tallies_file.add_tally(tally)
tallies_file.export_to_xml()

View file

@ -52,60 +52,60 @@ u238 = openmc.Nuclide('U-238')
# Instantiate some Materials and register the appropriate Nuclides
uo2 = openmc.Material(material_id=1, name='UO2 fuel at 2.4% wt enrichment')
uo2.setDensity('g/cm3', 10.29769)
uo2.addNuclide(u234, 4.4843e-6)
uo2.addNuclide(u235, 5.5815e-4)
uo2.addNuclide(u238, 2.2408e-2)
uo2.addNuclide(o16, 4.5829e-2)
uo2.addNuclide(o17, 1.1164e-4)
uo2.set_density('g/cm3', 10.29769)
uo2.add_nuclide(u234, 4.4843e-6)
uo2.add_nuclide(u235, 5.5815e-4)
uo2.add_nuclide(u238, 2.2408e-2)
uo2.add_nuclide(o16, 4.5829e-2)
uo2.add_nuclide(o17, 1.1164e-4)
helium = openmc.Material(material_id=2, name='Helium for gap')
helium.setDensity('g/cm3', 0.001598)
helium.addNuclide(he4, 2.4044e-4)
helium.set_density('g/cm3', 0.001598)
helium.add_nuclide(he4, 2.4044e-4)
zircaloy = openmc.Material(material_id=3, name='Zircaloy 4')
zircaloy.setDensity('g/cm3', 6.55)
zircaloy.addNuclide(o16, 3.0743e-4)
zircaloy.addNuclide(o17, 7.4887e-7)
zircaloy.addNuclide(cr50, 3.2962e-6)
zircaloy.addNuclide(cr52, 6.3564e-5)
zircaloy.addNuclide(cr53, 7.2076e-6)
zircaloy.addNuclide(cr54, 1.7941e-6)
zircaloy.addNuclide(fe54, 8.6699e-6)
zircaloy.addNuclide(fe56, 1.3610e-4)
zircaloy.addNuclide(fe57, 3.1431e-6)
zircaloy.addNuclide(fe58, 4.1829e-7)
zircaloy.addNuclide(zr90, 2.1827e-2)
zircaloy.addNuclide(zr91, 4.7600e-3)
zircaloy.addNuclide(zr92, 7.2758e-3)
zircaloy.addNuclide(zr94, 7.3734e-3)
zircaloy.addNuclide(zr96, 1.1879e-3)
zircaloy.addNuclide(sn112, 4.6735e-6)
zircaloy.addNuclide(sn114, 3.1799e-6)
zircaloy.addNuclide(sn115, 1.6381e-6)
zircaloy.addNuclide(sn116, 7.0055e-5)
zircaloy.addNuclide(sn117, 3.7003e-5)
zircaloy.addNuclide(sn118, 1.1669e-4)
zircaloy.addNuclide(sn119, 4.1387e-5)
zircaloy.addNuclide(sn120, 1.5697e-4)
zircaloy.addNuclide(sn122, 2.2308e-5)
zircaloy.addNuclide(sn124, 2.7897e-5)
zircaloy.set_density('g/cm3', 6.55)
zircaloy.add_nuclide(o16, 3.0743e-4)
zircaloy.add_nuclide(o17, 7.4887e-7)
zircaloy.add_nuclide(cr50, 3.2962e-6)
zircaloy.add_nuclide(cr52, 6.3564e-5)
zircaloy.add_nuclide(cr53, 7.2076e-6)
zircaloy.add_nuclide(cr54, 1.7941e-6)
zircaloy.add_nuclide(fe54, 8.6699e-6)
zircaloy.add_nuclide(fe56, 1.3610e-4)
zircaloy.add_nuclide(fe57, 3.1431e-6)
zircaloy.add_nuclide(fe58, 4.1829e-7)
zircaloy.add_nuclide(zr90, 2.1827e-2)
zircaloy.add_nuclide(zr91, 4.7600e-3)
zircaloy.add_nuclide(zr92, 7.2758e-3)
zircaloy.add_nuclide(zr94, 7.3734e-3)
zircaloy.add_nuclide(zr96, 1.1879e-3)
zircaloy.add_nuclide(sn112, 4.6735e-6)
zircaloy.add_nuclide(sn114, 3.1799e-6)
zircaloy.add_nuclide(sn115, 1.6381e-6)
zircaloy.add_nuclide(sn116, 7.0055e-5)
zircaloy.add_nuclide(sn117, 3.7003e-5)
zircaloy.add_nuclide(sn118, 1.1669e-4)
zircaloy.add_nuclide(sn119, 4.1387e-5)
zircaloy.add_nuclide(sn120, 1.5697e-4)
zircaloy.add_nuclide(sn122, 2.2308e-5)
zircaloy.add_nuclide(sn124, 2.7897e-5)
borated_water = openmc.Material(material_id=4, name='Borated water at 975 ppm')
borated_water.setDensity('g/cm3', 0.740582)
borated_water.addNuclide(b10, 8.0042e-6)
borated_water.addNuclide(b11, 3.2218e-5)
borated_water.addNuclide(h1, 4.9457e-2)
borated_water.addNuclide(h2, 7.4196e-6)
borated_water.addNuclide(o16, 2.4672e-2)
borated_water.addNuclide(o17, 6.0099e-5)
borated_water.addSAlphaBeta('HH2O', '71t')
borated_water.set_density('g/cm3', 0.740582)
borated_water.add_nuclide(b10, 8.0042e-6)
borated_water.add_nuclide(b11, 3.2218e-5)
borated_water.add_nuclide(h1, 4.9457e-2)
borated_water.add_nuclide(h2, 7.4196e-6)
borated_water.add_nuclide(o16, 2.4672e-2)
borated_water.add_nuclide(o17, 6.0099e-5)
borated_water.add_s_alpha_beta('HH2O', '71t')
# Instantiate a MaterialsFile, register all Materials, and export to XML
materials_file = openmc.MaterialsFile()
materials_file.setDefaultXS('71c')
materials_file.addMaterials([uo2, helium, zircaloy, borated_water])
materials_file.exportToXML()
materials_file.set_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.setBoundaryType('reflective')
right.setBoundaryType('reflective')
top.setBoundaryType('reflective')
bottom.setBoundaryType('reflective')
left.set_boundary_type('reflective')
right.set_boundary_type('reflective')
top.set_boundary_type('reflective')
bottom.set_boundary_type('reflective')
# Instantiate Cells
fuel = openmc.Cell(cell_id=1, name='cell 1')
@ -133,37 +133,37 @@ clad = openmc.Cell(cell_id=3, name='cell 3')
water = openmc.Cell(cell_id=4, name='cell 4')
# Register Surfaces with Cells
fuel.addSurface(fuel_or, halfspace=-1)
gap.addSurface(fuel_or, halfspace=+1)
gap.addSurface(clad_ir, halfspace=-1)
clad.addSurface(clad_ir, halfspace=+1)
clad.addSurface(clad_or, halfspace=-1)
water.addSurface(clad_or, halfspace=+1)
water.addSurface(left, halfspace=+1)
water.addSurface(right, halfspace=-1)
water.addSurface(bottom, halfspace=+1)
water.addSurface(top, halfspace=-1)
fuel.add_surface(fuel_or, halfspace=-1)
gap.add_surface(fuel_or, halfspace=+1)
gap.add_surface(clad_ir, halfspace=-1)
clad.add_surface(clad_ir, halfspace=+1)
clad.add_surface(clad_or, halfspace=-1)
water.add_surface(clad_or, halfspace=+1)
water.add_surface(left, halfspace=+1)
water.add_surface(right, halfspace=-1)
water.add_surface(bottom, halfspace=+1)
water.add_surface(top, halfspace=-1)
# Register Materials with Cells
fuel.setFill(uo2)
gap.setFill(helium)
clad.setFill(zircaloy)
water.setFill(borated_water)
fuel.set_fill(uo2)
gap.set_fill(helium)
clad.set_fill(zircaloy)
water.set_fill(borated_water)
# Instantiate Universe
root = openmc.Universe(universe_id=0, name='root universe')
# Register Cells with Universe
root.addCells([fuel, gap, clad, water])
root.add_cells([fuel, gap, clad, water])
# 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()
###############################################################################
@ -172,15 +172,15 @@ 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', [-0.62992, -0.62992, -1, \
settings_file.set_batches(batches)
settings_file.set_inactive(inactive)
settings_file.set_particles(particles)
settings_file.set_source_space('box', [-0.62992, -0.62992, -1, \
0.62992, 0.62992, 1])
settings_file.setEntropyLowerLeft([-0.39218, -0.39218, -1.e50])
settings_file.setEntropyUpperRight([0.39218, 0.39218, 1.e50])
settings_file.setEntropyDimension([10, 10, 1])
settings_file.exportToXML()
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.export_to_xml()
###############################################################################
@ -189,26 +189,26 @@ settings_file.exportToXML()
# Instantiate a tally mesh
mesh = openmc.Mesh(mesh_id=1)
mesh.setType('rectangular')
mesh.setDimension([100, 100, 1])
mesh.setLowerLeft([-0.62992, -0.62992, -1.e50])
mesh.setUpperRight([0.62992, 0.62992, 1.e50])
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])
# Instantiate some tally Filters
energy_filter = openmc.Filter(type='energy', bins=[0., 4.e-6, 20.])
mesh_filter = openmc.Filter()
mesh_filter.setMesh(mesh)
mesh_filter.set_mesh(mesh)
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)
tally.addFilter(energy_filter)
tally.addFilter(mesh_filter)
tally.addScore('flux')
tally.addScore('fission')
tally.addScore('nu-fission')
tally.add_filter(energy_filter)
tally.add_filter(mesh_filter)
tally.add_score('flux')
tally.add_score('fission')
tally.add_score('nu-fission')
# Instantiate a TalliesFile, register all Tallies, and export to XML
tallies_file = openmc.TalliesFile()
tallies_file.addMesh(mesh)
tallies_file.addTally(tally)
tallies_file.exportToXML()
tallies_file.add_mesh(mesh)
tallies_file.add_tally(tally)
tallies_file.export_to_xml()

View file

@ -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()

View file

@ -1,17 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<!--cell 1-->
<cell id="1" material="1" surfaces="1 -2 3 -4 5 -6" universe="0" />
<!--surf 1-->
<surface boundary="vacuum" coeffs="-1" id="1" type="x-plane" />
<!--surf 2-->
<surface boundary="vacuum" coeffs="1" id="2" type="x-plane" />
<!--surf 3-->
<surface boundary="reflective" coeffs="-1" id="3" type="y-plane" />
<!--surf 4-->
<surface boundary="reflective" coeffs="1" id="4" type="y-plane" />
<!--surf 5-->
<surface boundary="reflective" coeffs="-1" id="5" type="z-plane" />
<!--surf 6-->
<surface boundary="reflective" coeffs="1" id="6" type="z-plane" />
</geometry>

View file

@ -1,9 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<materials>
<default_xs>71c</default_xs>
<!--fuel-->
<material id="1">
<density units="g/cc" value="4.5" />
<nuclide ao="1.0" name="U-235" />
</material>
</materials>

View file

@ -1,13 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<settings>
<eigenvalue>
<particles>10000</particles>
<batches>500</batches>
<inactive>10</inactive>
</eigenvalue>
<source>
<space type="box">
<parameters>-1 -1 -1 1 1 1</parameters>
</space>
</source>
</settings>