neso_fame.generators.hypnotoad_mesh(hypnotoad_poloidal_mesh: hypnotoad.core.mesh.Mesh, extrusion_limits: tuple[float, float] = (0.0, 6.283185307179586), n: int = 10, spatial_interp_resolution: int = 11, subdivisions: int = 1, max_aspect_ratio: float = 100, mesh_to_core: bool = False, restrict_to_vessel: bool = False, mesh_to_wall: bool = False, min_distance_to_wall: float = 0.025, wall_resolution: float | None = None, wall_angle_threshold: float = 0.2617993877991494, alignment_steps: int = 0, validator: Callable[[Prism], bool] | None = None, system: CoordinateSystem = CoordinateSystem.CYLINDRICAL) PrismMesh

Generate a 3D mesh from hypnotoad-generage mesh.

Edges are traced from the nodes making up the corners of elements. The tracing follows the magnetic field lines from the equilibrium backwards and forwards in the toroidal direction to form a single layer of field-aligned elements. The field is assumed not to vary in the toroidal direction, meaning this layer can be repeated. However, each layer will be non-conformal with the next.

Parameters:
hypnotoad_poloidal_mesh: hypnotoad.core.mesh.Mesh

A mesh object created by hypnotoad from an equilibrium magnetic field.

extrusion_limits: tuple[float, float] = (0.0, 6.283185307179586)

The lower and upper limits of the domain in the toroidal direction (in radians).

n: int = 10

Number of layers to generate in the x3 direction

spatial_interp_resolution: int = 11

Number of points used to interpolate distances along the field line.

subdivisions: int = 1

Depth of cells in x3-direction in each layer.

max_aspect_ratio: float = 100

The maximum ratio to allow between the length of the perpendicular and field-aligned edges of an element. If an element exceeds this ratio, it will be merged with an adjacent one. Note that this algorithm only checks elements radiating away from an X-point and may miss a few in order to maintain a conformal mesh.

mesh_to_core: bool = False

Whether to add extra prism elements to fill in the core of the tokamak

restrict_to_vessel: bool = False

Whether to remove the elements whose edges pass outside the tokamak wall

mesh_to_wall: bool = False

Whether to add extra prism and hex elements to fill the space between the edge of the field-aligned mesh and the tokamak wall. Requires restrict_to_vesel to be true.

min_distance_to_wall: float = 0.025

The minimum distance to leave between the hypnotoad mesh and the wall of the tokamak. Only used if mesh_to_wall is true.

wall_resolution: float | None = None

If present, indicates that the resolution of the tokamak wall should be adjusted so that the edges of elements on the wall are approximately the specified fraction of the size of those at the outer edge of the hypnotoad mesh. If None then use the wall elements specified in the eqdsk data, which may be of widely varying sizes.

wall_angle_threshold: float = 0.2617993877991494

If adjusting the resolution of the tokamak wall, any vertices with an angle above this threshold will be preserved as sharp corners. Angles below it will be smoothed out.

alignment_steps: int = 0

The number of steps to take between aligned and unaligned elements near the wall. I.e., 0 indicates that the change happens immediately between the hypnotoad-generated elements and the traingular elements. 1 indicates that there will be nodes in-between which are averaged between aligned and unaligned. Higher values indicate additional nodes with the weight between aligned and unaligned changing more gradually.

validator: Callable[[Prism], bool] | None = None

Function that checks whether the geometry of an element is valid. Default values means all elements will be assumed valid. This argument should change depending on the format you want to write your mesh to, the order of the basis for the element shapes, etc.

system: CoordinateSystem = CoordinateSystem.CYLINDRICAL

The coordinate system to use. This normally should not be changed. However, if you want to export the poloidal cross-section of the mesh then it can be useful to set this to be Cartesian.

Returns:

A 3D field-aligned, non-conformal grid

Return type:

PrismMesh


Last update: Sep 23, 2024