mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
add example for white boundary
This commit is contained in:
parent
a09b17e933
commit
3040d4d3bb
3 changed files with 229 additions and 0 deletions
73
examples/python/white/build-hemisphere.py
Normal file
73
examples/python/white/build-hemisphere.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 500
|
||||
inactive = 100
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Material and register the Nuclide
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
surf1 = openmc.ZPlane(surface_id=1, z0=0.0, name='surf 1')
|
||||
surf2 = openmc.Sphere(surface_id=2, x0=0.0, y0=0.0, z0=0.0, r=0.39218, name='surf 2')
|
||||
|
||||
surf1.boundary_type = 'vacuum'
|
||||
surf2.boundary_type = 'white'
|
||||
|
||||
# Instantiate Cell
|
||||
cell = openmc.Cell(cell_id=1, name='cell 1')
|
||||
|
||||
# Use surface half-spaces to define region
|
||||
cell.region = -surf1 & -surf2
|
||||
|
||||
# Register Material with Cell
|
||||
cell.fill = fuel
|
||||
|
||||
# Instantiate Universes
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cell with Universe
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# 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
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Point(xyz=(0, 0, -0.1))
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
75
examples/python/white/build-pin.py
Normal file
75
examples/python/white/build-pin.py
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 500
|
||||
inactive = 100
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Material and register the Nuclide
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
surf1 = openmc.ZCylinder(surface_id=1, x0=0, y0=0, r=0.39218, name='surf 1')
|
||||
surf2 = openmc.ZPlane(surface_id=2, z0=-1, name='surf 2')
|
||||
surf3 = openmc.ZPlane(surface_id=3, z0=+1, name='surf 3')
|
||||
|
||||
surf1.boundary_type = 'white'
|
||||
surf2.boundary_type = 'vacuum'
|
||||
surf3.boundary_type = 'vacuum'
|
||||
|
||||
# Instantiate Cell
|
||||
cell = openmc.Cell(cell_id=1, name='cell 1')
|
||||
|
||||
# Use surface half-spaces to define region
|
||||
cell.region = -surf1 & +surf2 & -surf3
|
||||
|
||||
# Register Material with Cell
|
||||
cell.fill = fuel
|
||||
|
||||
# Instantiate Universes
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cell with Universe
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# 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
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Point(xyz=(0, 0, 0))
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
81
examples/python/white/build-plane.py
Normal file
81
examples/python/white/build-plane.py
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
|
||||
###############################################################################
|
||||
# Simulation Input File Parameters
|
||||
###############################################################################
|
||||
|
||||
# OpenMC simulation parameters
|
||||
batches = 500
|
||||
inactive = 100
|
||||
particles = 10000
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC materials.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate a Material and register the Nuclide
|
||||
fuel = openmc.Material(material_id=1, name='fuel')
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
fuel.add_nuclide('U235', 1.)
|
||||
|
||||
# Instantiate a Materials collection and export to XML
|
||||
materials_file = openmc.Materials([fuel])
|
||||
materials_file.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC geometry.xml file
|
||||
###############################################################################
|
||||
|
||||
# Instantiate Surfaces
|
||||
surf1 = openmc.XPlane(surface_id=1, x0=-1, name='surf 1')
|
||||
surf2 = openmc.XPlane(surface_id=2, x0=+1, name='surf 2')
|
||||
surf3 = openmc.YPlane(surface_id=3, y0=-1, name='surf 3')
|
||||
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.boundary_type = 'vacuum'
|
||||
surf2.boundary_type = 'vacuum'
|
||||
surf3.boundary_type = 'white'
|
||||
surf4.boundary_type = 'white'
|
||||
surf5.boundary_type = 'white'
|
||||
surf6.boundary_type = 'white'
|
||||
|
||||
# Instantiate Cell
|
||||
cell = openmc.Cell(cell_id=1, name='cell 1')
|
||||
|
||||
# Use surface half-spaces to define region
|
||||
cell.region = +surf1 & -surf2 & +surf3 & -surf4 & +surf5 & -surf6
|
||||
|
||||
# Register Material with Cell
|
||||
cell.fill = fuel
|
||||
|
||||
# Instantiate Universes
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
# Register Cell with Universe
|
||||
root.add_cell(cell)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry = openmc.Geometry(root)
|
||||
geometry.export_to_xml()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC settings.xml file
|
||||
###############################################################################
|
||||
|
||||
# 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
|
||||
|
||||
# Create an initial uniform spatial source distribution over fissionable zones
|
||||
uniform_dist = openmc.stats.Point(xyz=(0, 0, 0))
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.export_to_xml()
|
||||
Loading…
Add table
Add a link
Reference in a new issue