openmc.UnstructuredMesh

class openmc.UnstructuredMesh(filename, library, mesh_id=None, name='', length_multiplier=1.0)[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) – 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

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

  • 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

  • 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

property volumes

Return Volumes for every mesh cell if populated by a StatePoint file

Returns

volumes – Volumes

Return type

numpy.ndarray

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