10.3. Primitives

A few useful utilities for creating primitives particularly relevant for fusion.

cherab.tools.primitives.axisymmetric_mesh.axisymmetric_mesh_from_polygon()

Generates an Raysect Mesh primitive from the specified 2D polygon.

Parameters
  • polygon (np.ndarray) – A numpy array with shape [N,2] specifying the wall outline polygon in the R-Z plane. The polygon should not be closed, i.e. vertex i = 0 and i = N should not be the same vertex, but neighbours.

  • num_toroidal_segments (int) – The number of repeating toroidal segments that will be used to construct the mesh.

Returns

A Raysect Mesh primitive constructed from the R-Z polygon using symmetry.

>>> from cherab.tools.primitives import axisymmetric_mesh_from_polygon
>>>
>>> # wall_polygon is your (N, 2) ndarray describing the polygon
>>> mesh = axisymmetric_mesh_from_polygon(wall_polygon)