openmc.SphericalMesh

class openmc.SphericalMesh(r_grid: Sequence[float], phi_grid: Sequence[float] = (0, 6.283185307179586), theta_grid: Sequence[float] = (0, 3.141592653589793), origin: Sequence[float] = (0.0, 0.0, 0.0), mesh_id: Optional[int] = None, name: str = '')[source]

A 3D spherical mesh

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

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

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

  • 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 (r_grid, theta_grid, phi_grid).

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

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

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

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

  • 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), …]

  • lower_left (numpy.ndarray) – 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 (numpy.ndarray) – 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.

  • bounding_box (openmc.BoundingBox) – Axis-aligned bounding box of the cell defined by the upper-right and lower- left coordinates

property centroids

Return coordinates of mesh element centroids.

Returns

centroids – Returns a numpy.ndarray representing the mesh element centroid coordinates with a shape equal to (dim1, …, dimn, ndim). X, Y, Z values can be unpacked with xx, yy, zz = np.rollaxis(mesh.centroids, -1).

Return type

numpy.ndarray

property centroids_spherical

Returns centroids of the mesh in cylindrical coordinates.

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

Parameters

elem (lxml.etree._Element) – XML element

Returns

Spherical mesh object

Return type

openmc.SphericalMesh

to_xml_element()[source]

Return XML representation of the mesh

Returns

element – XML element containing mesh data

Return type

lxml.etree._Element

property vertices
Return coordinates of mesh vertices in Cartesian coordinates. Also

see CylindricalMesh.vertices_cylindrical() and SphericalMesh.vertices_spherical() for coordinates in other coordinate systems.

Returns

vertices – Returns a numpy.ndarray representing the coordinates of the mesh vertices with a shape equal to (dim1 + 1, …, dimn + 1, ndim). X, Y, Z values can be unpacked with xx, yy, zz = np.rollaxis(mesh.vertices, -1).

Return type

numpy.ndarray

property vertices_spherical

Returns vertices of the mesh in cylindrical coordinates.

property volumes

Return Volumes for every mesh cell

Returns

volumes – Volumes

Return type

Iterable of float