openmc.Mesh¶
-
class
openmc.
Mesh
(mesh_id=None, name='')[source]¶ A structured Cartesian mesh in one, two, or three dimensions
Parameters: Variables: - id (int) – Unique identifier for the mesh
- name (str) – Name of the mesh
- type (str) – Type of the mesh
- dimension (Iterable of int) – The number of mesh cells in each direction.
- 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.
-
build_cells
(bc=['reflective', 'reflective', 'reflective', 'reflective', 'reflective', 'reflective'])[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', or 'vacuum'}) – Boundary conditions for each of the four faces of a rectangle (if aplying 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. 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.
-
cell_generator
()[source]¶ Generator function to traverse through every [i,j,k] index of the mesh
For example the following code:
for mesh_index in mymesh.cell_generator(): print(mesh_index)
will produce the following output for a 3-D 2x2x2 mesh in mymesh:
[1, 1, 1] [2, 1, 1] [1, 2, 1] [2, 2, 1] ...
-
classmethod
from_hdf5
(group)[source]¶ Create mesh from HDF5 group
Parameters: group (h5py.Group) – Group in HDF5 file Returns: Mesh instance 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