openmc.UnstructuredMesh¶
- class openmc.UnstructuredMesh(filename: Union[str, PathLike], library: str, mesh_id: Optional[int] = None, name: str = '', length_multiplier: float = 1.0, options: Optional[str] = None)[source]¶
A 3D unstructured mesh
New in version 0.12.
Changed in version 0.12.2: Support for libMesh unstructured meshes was added.
- Parameters
filename (str or pathlib.Path) – Location of the unstructured mesh file
library ({'moab', 'libmesh'}) – Mesh library used for the unstructured mesh tally
mesh_id (int) – Unique identifier for the mesh
name (str) – Name of the mesh
length_multiplier (float) – Constant multiplier to apply to mesh coordinates
options (str, optional) – Special options that control spatial search data structures used. This is currently only used to set parameters for MOAB’s AdaptiveKDTree. If None, OpenMC internally uses a default of “MAX_DEPTH=20;PLANE_SET=2;”.
- Variables
id (int) – Unique identifier for the mesh
name (str) – Name of the mesh
filename (str) – Name of the file containing the unstructured mesh
length_multiplier (float) – Multiplicative factor to apply to mesh coordinates
library ({'moab', 'libmesh'}) – Mesh library used for the unstructured mesh tally
options (str) –
Special options that control spatial search data structures used. This is currently only used to set parameters for MOAB’s AdaptiveKDTree. If None, OpenMC internally uses a default of “MAX_DEPTH=20;PLANE_SET=2;”.
output (bool) – Indicates whether or not automatic tally output should be generated for this mesh
volumes (Iterable of float) – Volumes of the unstructured mesh elements
centroids (numpy.ndarray) – Centroids of the mesh elements with array shape (n_elements, 3)
vertices (numpy.ndarray) –
Coordinates of the mesh vertices with array shape (n_elements, 3)
New in version 0.13.1.
connectivity (numpy.ndarray) –
Connectivity of the elements with array shape (n_elements, 8)
New in version 0.13.1.
element_types (Iterable of integers) –
Mesh element types
New in version 0.13.1.
total_volume (float) – Volume of the unstructured mesh in total
bounding_box (openmc.BoundingBox) – Axis-aligned bounding box of the mesh as defined by the upper-right and lower-left coordinates.
- centroid(bin: int)[source]¶
Return the vertex averaged centroid of an element
- Parameters
bin (int) – Bin ID for the returned centroid
- Returns
x, y, z values of the element centroid
- Return type
- 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_xml_element(elem: Element)[source]¶
Generate unstructured mesh object from XML element
- Parameters
elem (lxml.etree._Element) – XML element
- Returns
UnstructuredMesh generated from an XML element
- Return type
- 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 if populated by a StatePoint file
- Returns
volumes – Volumes
- Return type
- write_data_to_vtk(filename: Optional[Union[str, PathLike]] = None, datasets: Optional[dict] = None, volume_normalization: bool = True)[source]¶
Map data to unstructured VTK mesh elements.
- 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 numpy appropriately sized arrays of the data
volume_normalization (bool) – Whether or not to normalize the data by the volume of the mesh elements
- write_vtk_mesh(**kwargs)[source]¶
Map data to unstructured VTK mesh elements.
Deprecated since version 0.13: Use
UnstructuredMesh.write_data_to_vtk()
instead.- 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) – Whether or not to normalize the data by the volume of the mesh elements