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 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.
- 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 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
- Returns
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
- 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
- abstract evaluate(point)[source]¶
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
- 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
- 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
- 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.
- Return type
tuple of normalized coefficients
- abstract 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 (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 (bool) – 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
- abstract translate(vector, inplace=False)[source]¶
Translate surface in given direction
- Parameters
vector (iterable of float) – Direction in which surface should be translated
inplace (bool) – Whether or not to return a new instance of this Surface or to modify the coefficients of this Surface.
- Returns
Translated surface
- Return type
instance of openmc.Surface