class openmc.Surface(surface_id=None, boundary_type='transmission', name='')[source]

An implicit surface with an associated boundary condition.

An implicit surface is defined as the set of zeros of a function of the three Cartesian coordinates. Surfaces in OpenMC are limited to a set of algebraic surfaces, i.e., surfaces that are polynomial in x, y, and z.

  • surface_id (int, optional) – Unique identifier for the surface. If not specified, an identifier will automatically be assigned.
  • boundary_type ({'transmission, 'vacuum', 'reflective', 'periodic', 'white'}, optional) – Boundary condition that defines the behavior for particles hitting the surface. Defaults to transmissive boundary condition where particles freely pass through the surface. Note that periodic boundary conditions can only be applied to x-, y-, and z-planes, and only axis-aligned periodicity is supported.
  • name (str, optional) – Name of the surface. If not specified, the name will be the empty string.
  • boundary_type ({'transmission, 'vacuum', 'reflective', 'periodic', 'white'}) – Boundary condition that defines the behavior for particles hitting the surface.
  • coefficients (dict) – Dictionary of surface coefficients
  • id (int) – Unique identifier for the surface
  • name (str) – Name of the surface
  • type (str) – Type of the surface

Determine an axis-aligned bounding box.

An axis-aligned bounding box for surface half-spaces is represented by its lower-left and upper-right coordinates. If the half-space is unbounded in a particular direction, numpy.inf is used to represent infinity.

Parameters:side ({'+', '-'}) – Indicates the negative or positive half-space
  • numpy.ndarray – Lower-left coordinates of the axis-aligned bounding box for the desired half-space
  • numpy.ndarray – Upper-right coordinates of the axis-aligned bounding box for the desired half-space

Create a copy of this surface with a new unique ID.

Parameters:memo (dict or None) – A nested dictionary of previously cloned objects. This parameter is used internally and should not be specified by the user.
Returns:clone – The clone of this surface
Return type:openmc.Surface

Evaluate the surface equation at a given point.

Parameters:point (3-tuple of float) – The Cartesian coordinates, \((x',y',z')\), at which the surface equation should be evaluated.
Returns:Evaluation of the surface polynomial at point \((x',y',z')\)
Return type:float
static from_hdf5(group)[source]

Create surface from HDF5 group

Parameters:group (h5py.Group) – Group in HDF5 file
Returns:Instance of surface subclass
Return type:openmc.Surface
static from_xml_element(elem)[source]

Generate surface from an XML element

Parameters:elem (xml.etree.ElementTree.Element) – XML element
Returns:Instance of a surface subclass
Return type:openmc.Surface

Determine if this Surface is equivalent to another

Parameters:other (instance of openmc.Surface) – Instance of openmc.Surface that should be compared to the current surface

Normalize coefficients by first nonzero value

New in version 0.12.

Parameters:coeffs (tuple, optional) – Tuple of surface coefficients to normalize. Defaults to None. If no coefficients are supplied then the coefficients will be taken from the current Surface.
Return type:tuple of normalized coefficients
rotate(rotation, pivot=(0.0, 0.0, 0.0), order='xyz', inplace=False)[source]

Rotate surface by angles provided or by applying matrix directly.

New in version 0.12.

  • rotation (3-tuple of float, or 3x3 iterable) – A 3-tuple of angles \((\phi, \theta, \psi)\) in degrees where the first element is the rotation about the x-axis in the fixed laboratory frame, the second element is the rotation about the y-axis in the fixed laboratory frame, and the third element is the rotation about the z-axis in the fixed laboratory frame. The rotations are active rotations. Additionally a 3x3 rotation matrix can be specified directly either as a nested iterable or array.
  • pivot (iterable of float, optional) – (x, y, z) coordinates for the point to rotate about. Defaults to (0., 0., 0.)
  • order (str, optional) – A string of ‘x’, ‘y’, and ‘z’ in some order specifying which rotation to perform first, second, and third. Defaults to ‘xyz’ which means, the rotation by angle \(\phi\) about x will be applied first, followed by \(\theta\) about y and then \(\psi\) about z. This corresponds to an x-y-z extrinsic rotation as well as a z-y’-x’’ intrinsic rotation using Tait-Bryan angles \((\phi, \theta, \psi)\).
  • inplace (boolean) – Whether or not to return a new instance of Surface or to modify the coefficients of this Surface in place. Defaults to False.

Rotated surface

Return type:



Return XML representation of the surface

Returns:element – XML element containing source data
Return type:xml.etree.ElementTree.Element
translate(vector, inplace=False)[source]

Translate surface in given direction

  • vector (iterable of float) – Direction in which surface should be translated
  • inplace (boolean) – Whether or not to return a new instance of this Surface or to modify the coefficients of this Surface. Defaults to False

Translated surface

Return type:

instance of openmc.Surface