openmc.RegularMesh¶
- class openmc.RegularMesh(mesh_id=None, name='')[source]¶
A regular Cartesian mesh in one, two, or three dimensions
- Parameters
- 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 structured 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_domain(domain, dimension=(10, 10, 10), mesh_id=None, name='')[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 of the mesh instance
dimension (Iterable of int) – The number of mesh cells in each direction.
mesh_id (int) – Unique identifier for the mesh
name (str) – Name of the mesh
- Returns
RegularMesh instance
- Return type
- 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
- 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
- property volumes¶
Return Volumes for every mesh cell
- Returns
volumes – Volumes
- Return type
- write_data_to_vtk(filename, datasets, volume_normalization=True)[source]¶
Creates a VTK object of the mesh
- Parameters
filename (str or pathlib.Path) – Name of the VTK file to write.
datasets (dict) – Dictionary whose keys are the data labels and values are the data sets.
volume_normalization (bool, optional) – Whether or not to normalize the data by the volume of the mesh elements. Defaults to True.
- Returns
the VTK object
- Return type
vtk.vtkStructuredGrid