openmc.Surface¶

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.
Parameters:  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 zplanes, and only axisaligned periodicity is supported.
 name (str, optional) – Name of the surface. If not specified, the name will be the empty string.
Variables:  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

bounding_box
(side)[source]¶ Determine an axisaligned bounding box.
An axisaligned bounding box for surface halfspaces is represented by its lowerleft and upperright coordinates. If the halfspace is unbounded in a particular direction, numpy.inf is used to represent infinity.
Parameters: side ({'+', ''}) – Indicates the negative or positive halfspace Returns:  numpy.ndarray – Lowerleft coordinates of the axisaligned bounding box for the desired halfspace
 numpy.ndarray – Upperright coordinates of the axisaligned bounding box for the desired halfspace

clone
(memo=None)[source]¶ 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
(point)[source]¶ Evaluate the surface equation at a given point.
Parameters: point (3tuple 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

is_equal
(other)[source]¶ 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
(coeffs=None)[source]¶ 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. Returns: 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.
Parameters:  rotation (3tuple of float, or 3x3 iterable) – A 3tuple of angles \((\phi, \theta, \psi)\) in degrees where the first element is the rotation about the xaxis in the fixed laboratory frame, the second element is the rotation about the yaxis in the fixed laboratory frame, and the third element is the rotation about the zaxis 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 xyz extrinsic rotation as well as a zy’x’’ intrinsic rotation using TaitBryan 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.
Returns: Rotated surface
Return type:

to_xml_element
()[source]¶ 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
Parameters:  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
Returns: Translated surface
Return type: instance of openmc.Surface