openmc.Lattice

class openmc.Lattice(lattice_id=None, name='')[source]

A repeating structure wherein each element is a universe.

Parameters:
  • lattice_id (int, optional) – Unique identifier for the lattice. If not specified, an identifier will automatically be assigned.
  • name (str, optional) – Name of the lattice. If not specified, the name is the empty string.
Variables:
  • id (int) – Unique identifier for the lattice
  • name (str) – Name of the lattice
  • pitch (Iterable of float) – Pitch of the lattice in each direction in cm
  • outer (openmc.Universe) – A universe to fill all space outside the lattice
  • universes (Iterable of Iterable of openmc.Universe) – A two- or three-dimensional list/array of universes filling each element of the lattice
clone(memo=None)[source]

Create a copy of this lattice with a new unique ID, and clones all universes within this lattice.

Parameters:memo (dict or None) – A nested dictionary of previously cloned objects. This parameter is used internally and should not be specified by the user.
Returns:clone – The clone of this lattice
Return type:openmc.Lattice
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
static from_hdf5(group, universes)[source]

Create lattice from HDF5 group

Parameters:
  • group (h5py.Group) – Group in HDF5 file
  • universes (dict) – Dictionary mapping universe IDs to instances of openmc.Universe.
Returns:

Instance of lattice subclass

Return type:

openmc.Lattice

get_all_cells()[source]

Return all cells that are contained within the lattice

Returns:cells – Dictionary whose keys are cell IDs and values are Cell instances
Return type:collections.OrderedDict
get_all_materials()[source]

Return all materials that are contained within the lattice

Returns:materials – Dictionary whose keys are material IDs and values are Material instances
Return type:collections.OrderedDict
get_all_universes()[source]

Return all universes that are contained within the lattice

Returns:universes – Dictionary whose keys are universe IDs and values are Universe instances
Return type:collections.OrderedDict
get_nuclides()[source]

Returns all nuclides in the lattice

Returns:nuclides – List of nuclide names
Return type:list of str
get_unique_universes()[source]

Determine all unique universes in the lattice

Returns:universes – Dictionary whose keys are universe IDs and values are openmc.Universe instances
Return type:collections.OrderedDict
get_universe(idx)[source]

Return universe corresponding to a lattice element index

Parameters:idx (Iterable of int) – Lattice element indices. For a rectangular lattice, the indices are given in the \((x,y)\) or \((x,y,z)\) coordinate system. For hexagonal lattices, they are given in the \(x,\alpha\) or \(x,\alpha,z\) coordinate systems.
Returns:Universe with given indices
Return type:openmc.Universe