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.UniverseBase) – A universe to fill all space outside the lattice

  • universes (Iterable of Iterable of openmc.UniverseBase) – A two-or three-dimensional list/array of universes filling each element of the lattice

clone(clone_materials=True, clone_regions=True, memo=None)[source]

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

Parameters:
  • clone_materials (bool) – Whether to create separate copies of the materials filling cells contained in this lattice and its outer universe.

  • clone_regions (bool) – Whether to create separate copies of the regions bounding cells contained in this lattice and its outer universe.

  • 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.UniverseBase.

Returns:

Instance of lattice subclass

Return type:

openmc.Lattice

get_all_cells(memo=None)[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:

dict

get_all_materials(memo=None)[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:

dict

get_all_universes(memo=None)[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:

dict

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.UniverseBase instances

Return type:

dict

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 for “y” orientations and \(\alpha,y\) or \(\alpha,y,z\) coordinate systems for “x” orientations.

Returns:

Universe with given indices

Return type:

openmc.UniverseBase