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.14.1.

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 = 10000, prn_seed: Optional[int] = None) List[List[Tuple[Material, float]]][source]

Determine volume of materials in each mesh element

New in version 0.14.1.

Parameters
  • n_samples (int) – Number of samples in each mesh element

  • prn_seed (int) – Pseudorandom number generator (PRNG) seed; if None, one will be generated randomly.

Returns

  • List of tuple of (material, volume) for each mesh element. Void volume

  • is represented by having a value of None in the first element of a

  • tuple.