openmc.Universe

class openmc.Universe(universe_id=None, name='', cells=None)[source]

A collection of cells that can be repeated.

Parameters
  • universe_id (int, optional) – Unique identifier of the universe. If not specified, an identifier will automatically be assigned

  • name (str, optional) – Name of the universe. If not specified, the name is the empty string.

  • cells (Iterable of openmc.Cell, optional) – Cells to add to the universe. By default no cells are added.

Variables
  • id (int) – Unique identifier of the universe

  • name (str) – Name of the universe

  • cells (dict) – Dictionary whose keys are cell IDs and values are Cell instances

  • volume (float) – Volume of the universe in cm^3. This can either be set manually or calculated in a stochastic volume calculation and added via the Universe.add_volume_information() method.

  • bounding_box (openmc.BoundingBox) – Lower-left and upper-right coordinates of an axis-aligned bounding box of the universe.

add_cell(cell)[source]

Add a cell to the universe.

Parameters

cell (openmc.Cell) – Cell to add

create_xml_subelement(xml_element, memo=None)[source]

Add the universe xml representation to an incoming xml element

Parameters
  • xml_element (lxml.etree._Element) – XML element to be added to

  • memo (set or None) – A set of object id’s representing geometry entities already written to the xml_element. This parameter is used internally and should not be specified by users.

Return type

None

classmethod from_hdf5(group, cells)[source]

Create universe from HDF5 group

Parameters
  • group (h5py.Group) – Group in HDF5 file

  • cells (dict) – Dictionary mapping cell IDs to instances of openmc.Cell.

Returns

Universe instance

Return type

openmc.Universe

remove_cell(cell)[source]

Remove a cell from the universe.

Parameters

cell (openmc.Cell) – Cell to remove