openmc.Geometry

class openmc.Geometry(root_universe=None)[source]

Geometry representing a collection of surfaces, cells, and universes.

Parameters:root_universe (openmc.Universe, optional) – Root universe which contains all others
Variables:root_universe (openmc.Universe) – Root universe which contains all others
export_to_xml()[source]

Create a geometry.xml file that can be used for a simulation.

find(point)[source]

Find cells/universes/lattices which contain a given point

Parameters:point (3-tuple of float) – Cartesian coordinates of the point
Returns:Sequence of universes, cells, and lattices which are traversed to find the given point
Return type:list
get_all_cells()[source]

Return all cells defined

Returns:Cells in the geometry
Return type:list of openmc.Cell
get_all_lattices()[source]

Return all lattices defined

Returns:Lattices in the geometry
Return type:list of openmc.Lattice
get_all_material_cells()[source]

Return all cells filled by a material

Returns:Cells filled by Materials in the geometry
Return type:list of openmc.Cell
get_all_material_universes()[source]

Return all universes composed of at least one non-fill cell

Returns:Universes with non-fill cells
Return type:list of openmc.Universe
get_all_materials()[source]

Return all materials assigned to a cell

Returns:Materials in the geometry
Return type:list of openmc.Material
get_all_nuclides()[source]

Return all nuclides assigned to a material in the geometry

Returns:Nuclides in the geometry
Return type:list of openmc.Nuclide
get_all_universes()[source]

Return all universes defined

Returns:Universes in the geometry
Return type:list of openmc.Universe
get_cell_instance(path)[source]

Return the instance number for the final cell in a geometry path.

The instance is an index into tally distribcell filter arrays.

Parameters:path (list) – A list of IDs that form the path to the target. It should begin with 0 for the base universe, and should cover every universe, cell, and lattice passed through. For the case of the lattice, a tuple should be provided to indicate which coordinates in the lattice should be entered. This should be in the form: (lat_id, i_x, i_y, i_z)
Returns:instance – Index in tally results array for distribcell filters
Return type:int
get_cells_by_fill_name(name, case_sensitive=False, matching=False)[source]

Return a list of cells with fills with matching names.

Parameters:
  • name (str) – The name to match
  • case_sensitive (bool) – Whether to distinguish upper and lower case letters in each cell’s name (default is False)
  • matching (bool) – Whether the names must match completely (default is False)
Returns:

Cells with fills matching the queried name

Return type:

list of openmc.Cell

get_cells_by_name(name, case_sensitive=False, matching=False)[source]

Return a list of cells with matching names.

Parameters:
  • name (str) – The name to search match
  • case_sensitive (bool) – Whether to distinguish upper and lower case letters in each cell’s name (default is False)
  • matching (bool) – Whether the names must match completely (default is False)
Returns:

Cells matching the queried name

Return type:

list of openmc.Cell

get_lattices_by_name(name, case_sensitive=False, matching=False)[source]

Return a list of lattices with matching names.

Parameters:
  • name (str) – The name to match
  • case_sensitive (bool) – Whether to distinguish upper and lower case letters in each lattice’s name (default is False)
  • matching (bool) – Whether the names must match completely (default is False)
Returns:

Lattices matching the queried name

Return type:

list of openmc.Lattice

get_materials_by_name(name, case_sensitive=False, matching=False)[source]

Return a list of materials with matching names.

Parameters:
  • name (str) – The name to match
  • case_sensitive (bool) – Whether to distinguish upper and lower case letters in each material’s name (default is False)
  • matching (bool) – Whether the names must match completely (default is False)
Returns:

Materials matching the queried name

Return type:

list of openmc.Material

get_universes_by_name(name, case_sensitive=False, matching=False)[source]

Return a list of universes with matching names.

Parameters:
  • name (str) – The name to match
  • case_sensitive (bool) – Whether to distinguish upper and lower case letters in each universe’s name (default is False)
  • matching (bool) – Whether the names must match completely (default is False)
Returns:

Universes matching the queried name

Return type:

list of openmc.Universe