mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Rename main Python API classes to get rid of File.
This commit is contained in:
parent
cccca4062a
commit
50a80693b5
37 changed files with 203 additions and 284 deletions
|
|
@ -12,7 +12,7 @@ particles = 10000
|
|||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml File
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Nuclides
|
||||
|
|
@ -23,15 +23,15 @@ fuel = openmc.Material(material_id=1, name='fuel')
|
|||
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()
|
||||
# Instantiate a Materials object, register Material, and export to XML
|
||||
materials_file = openmc.Materials()
|
||||
materials_file.default_xs = '71c'
|
||||
materials_file.add_material(fuel)
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml File
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
|
|
@ -64,22 +64,18 @@ root = openmc.Universe(universe_id=0, name='root universe')
|
|||
# Register Cell with Universe
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry and register the root Universe
|
||||
# Instantiate a Geometry and register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
# Instantiate a GeometryFile, register Geometry, and export to XML
|
||||
geometry_file = openmc.GeometryFile()
|
||||
geometry_file.geometry = geometry
|
||||
geometry_file.export_to_xml()
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml File
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a SettingsFile, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.SettingsFile()
|
||||
# Instantiate a Settings object, set all runtime parameters, and export to XML
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = batches
|
||||
settings_file.inactive = inactive
|
||||
settings_file.particles = particles
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue