openmc.CylindricalMesh

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

A 3D cylindrical mesh

Parameters
  • 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

  • dimension (Iterable of int) – The number of mesh cells in each direction.

  • n_dimension (int) – Number of mesh dimensions (always 3 for a CylindricalMesh).

  • r_grid (numpy.ndarray) – 1-D array of mesh boundary points along the r-axis. Requirement is r >= 0.

  • phi_grid (numpy.ndarray) – 1-D array of mesh boundary points along the phi-axis in radians. The default value is [0, 2π], i.e. the full phi range.

  • z_grid (numpy.ndarray) – 1-D array of mesh boundary points along the z-axis.

  • origin (numpy.ndarray) – 1-D array of length 3 the (x,y,z) origin of the mesh in cartesian coordinates

  • indices (Iterable of tuple) – An iterable of mesh indices for each mesh element, e.g. [(1, 1, 1), (2, 1, 1), …]

classmethod from_domain(domain, dimension=(10, 10, 10), mesh_id=None, phi_grid_bounds=(0.0, 6.283185307179586), name='')[source]

Creates a regular CylindricalMesh from an existing openmc domain.

Parameters
  • domain (openmc.Cell or openmc.Region or openmc.Universe or 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 r_grid, z_grid ranges.

  • dimension (Iterable of int) – The number of equally spaced mesh cells in each direction (r_grid, phi_grid, z_grid)

  • mesh_id (int) – Unique identifier for the mesh

  • phi_grid_bounds (numpy.ndarray) – Mesh bounds points along the phi-axis in radians. The default value is (0, 2π), i.e., the full phi range.

  • name (str) – Name of the mesh

Returns

RegularMesh instance

Return type

openmc.RegularMesh

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 a cylindrical mesh from an XML element

Parameters

elem (xml.etree.ElementTree.Element) – XML element

Returns

Cylindrical mesh object

Return type

openmc.CylindricalMesh

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

Returns

volumes – Volumes

Return type

Iterable of float

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