openmc.RegularMesh

class openmc.RegularMesh(mesh_id=None, name='')[source]

A regular Cartesian mesh in one, two, or three dimensions

Parameters:
  • mesh_id (int) – Unique identifier for the mesh
  • name (str) – Name of the mesh
Variables:
  • id (int) – Unique identifier for the mesh
  • name (str) – Name of the mesh
  • dimension (Iterable of int) – The number of mesh cells in each direction.
  • n_dimension (int) – Number of mesh dimensions.
  • lower_left (Iterable of float) – The lower-left corner of the structured mesh. If only two coordinate are given, it is assumed that the mesh is an x-y mesh.
  • upper_right (Iterable of float) – The upper-right corner of the structrued mesh. If only two coordinate are given, it is assumed that the mesh is an x-y mesh.
  • width (Iterable of float) – The width of mesh cells in each direction.
  • indices (Iterable of tuple) – An iterable of mesh indices for each mesh element, e.g. [(1, 1, 1), (2, 1, 1), …]
build_cells(bc=None)[source]

Generates a lattice of universes with the same dimensionality as the mesh object. The individual cells/universes produced will not have material definitions applied and so downstream code will have to apply that information.

Parameters:bc (iterable of {'reflective', 'periodic', 'transmission', 'vacuum', or 'white'}) – Boundary conditions for each of the four faces of a rectangle (if applying to a 2D mesh) or six faces of a parallelepiped (if applying to a 3D mesh) provided in the following order: [x min, x max, y min, y max, z min, z max]. 2-D cells do not contain the z min and z max entries. Defaults to ‘reflective’ for all faces.
Returns:
  • root_cell (openmc.Cell) – The cell containing the lattice representing the mesh geometry; this cell is a single parallelepiped with boundaries matching the outermost mesh boundary with the boundary conditions from bc applied.
  • cells (iterable of openmc.Cell) – The list of cells within each lattice position mimicking the mesh geometry.
classmethod from_hdf5(group)[source]

Create mesh from HDF5 group

Parameters:group (h5py.Group) – Group in HDF5 file
Returns:Instance of a MeshBase subclass
Return type:openmc.MeshBase
classmethod from_rect_lattice(lattice, division=1, mesh_id=None, name='')[source]

Create mesh from an existing rectangular lattice

Parameters:
  • lattice (openmc.RectLattice) – Rectangular lattice used as a template for this mesh
  • division (int) – Number of mesh cells per lattice cell. If not specified, there will be 1 mesh cell per lattice cell.
  • mesh_id (int) – Unique identifier for the mesh
  • name (str) – Name of the mesh
Returns:

RegularMesh instance

Return type:

openmc.RegularMesh

classmethod from_xml_element(elem)[source]

Generate mesh from an XML element

Parameters:elem (xml.etree.ElementTree.Element) – XML element
Returns:Mesh generated from XML element
Return type:openmc.Mesh
to_xml_element()[source]

Return XML representation of the mesh

Returns:element – XML element containing mesh data
Return type:xml.etree.ElementTree.Element