openmc.lib.Mesh¶
- class openmc.lib.Mesh(uid=None, new=True, index=None)[source]¶
Base class to represent mesh objects
- get_plot_bins(origin: Sequence[float], width: Sequence[float], basis: str, pixels: Sequence[int]) ndarray [source]¶
Get mesh bin indices for a rasterized plot.
New in version 0.15.0.
- Parameters
origin (iterable of float) – Origin of the plotting view. Should have length 3.
width (iterable of float) – Width of the plotting view. Should have length 2.
basis ({'xy', 'xz', 'yz'}) – Plotting basis.
pixels (iterable of int) – Number of pixels in each direction. Should have length 2.
- Returns
2D numpy array with mesh bin indices corresponding to each pixel within
the plotting view.
- material_volumes(n_samples: int | tuple[int, int, int] = 10000, max_materials: int = 4, output: bool = True) MeshMaterialVolumes [source]¶
Determine volume of materials in each mesh element.
This method works by raytracing repeatedly through the mesh to count the estimated volume of each material in all mesh elements. Three sets of rays are used: one set parallel to the x-axis, one parallel to the y-axis, and one parallel to the z-axis.
New in version 0.15.0.
Changed in version 0.15.1: Material volumes are now determined by raytracing rather than by point sampling.
- Parameters
n_samples (int or 3-tuple of int) – Total number of rays to sample. The number of rays in each direction is determined by the aspect ratio of the mesh bounding box. When specified as a 3-tuple, it is interpreted as the number of rays in the x, y, and z dimensions.
max_materials (int, optional) – Estimated maximum number of materials in any given mesh element.
output (bool, optional) – Whether or not to show output.
- Returns
Dictionary-like object that maps material IDs to an array of volumes equal in size to the number of mesh elements.
- Return type