openmc.RegularMesh

class openmc.RegularMesh(mesh_id: Optional[int] = None, name: str = '')[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 (x, y, z).

  • 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 structured mesh. If only two coordinate are given, it is assumed that the mesh is an x-y mesh.

  • bounding_box (openmc.BoundingBox) – Axis-aligned bounding box of the cell defined by the upper-right and lower- left coordinates

  • 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: Optional[str] = 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_domain(domain: Union[Cell, Region, Universe, Geometry], dimension: Sequence[int] = (10, 10, 10), mesh_id: Optional[int] = None, name: str = '')[source]

Create mesh from an existing openmc cell, region, universe or geometry by making use of the objects bounding box property.

Parameters
  • domain ({openmc.Cell, openmc.Region, openmc.Universe, openmc.Geometry}) – The object passed in will be used as a template for this mesh. The bounding box of the property of the object passed will be used to set the lower_left and upper_right and of the mesh instance

  • dimension (Iterable of int) – The number of mesh cells in each direction (x, y, z).

  • mesh_id (int) – Unique identifier for the mesh

  • name (str) – Name of the mesh

Returns

RegularMesh instance

Return type

openmc.RegularMesh

classmethod from_hdf5(group: 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: RectLattice, division: int = 1, mesh_id: Optional[int] = None, name: str = '')[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: Element)[source]

Generate mesh from an XML element

Parameters

elem (lxml.etree._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

lxml.etree._Element

property volumes

Return Volumes for every mesh cell

Returns

volumes – Volumes

Return type

numpy.ndarray