openmc.UnstructuredMesh

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

A 3D unstructured mesh

New in version 0.12.

Parameters:
  • filename (str) – Location of the unstructured mesh file
  • 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
  • filename (str) – Name of the file containing the unstructured mesh
  • volumes (Iterable of float) – Volumes of the unstructured mesh elements
  • total_volume (float) – Volume of the unstructured mesh in total
  • centroids (Iterable of tuple) – An iterable of element centroid coordinates, e.g. [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0), …]
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_xml_element(elem)[source]

Generate unstructured mesh object from XML element

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

Return XML representation of the mesh

Returns:element – XML element containing mesh data
Return type:xml.etree.ElementTree.Element
write_data_to_vtk(filename, datasets, volume_normalization=True)[source]
Map data to the unstructured mesh element centroids
to create a VTK point-cloud dataset.
Parameters:
  • filename (str) – 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