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.
Added in version 0.15.0.
- Parameters:
- 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, bounding_boxes: bool = False) 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.
Added 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.
bounding_boxes (bool, optional) – Whether or not to compute an axis-aligned bounding box for each (mesh element, material) combination. When enabled, the bounding box encloses the ray-estimator prisms used for the volume estimation.
- Returns:
Dictionary-like object that maps material IDs to an array of volumes equal in size to the number of mesh elements.
- Return type: