jax_sbgeom.flux_surfaces.flux_surface_meshing module
- mesh_poloidal_plane(flux_surface: ParametrisedSurface, s_layers: Array, phi: float, n_theta: int)[source]
Mesh a poloidal plane of a flux surface at the given s_layers and toroidal angle phi with n_theta poloidal points.
Vertices are ordered first axis if present (s[0]==0), then increasing theta, then increasing s.
Connectivity is ordered first axis wedges if present, then each closed theta strip, then increasing s.
Parameters flux_surface : ParametrisedSurface
The parametrized surface object containing the parameterization.
- s_layersjnp.ndarray
The normalized radii of the flux surfaces to mesh. Shape (n_layers,)
- phifloat
The toroidal angle (in radians) at which to mesh the poloidal plane.
- n_thetaint
The number of poloidal points.
- Returns:
points (jnp.ndarray) – An array of shape (n_points, 3) containing the Cartesian coordinates of the mesh points.
connectivity (jnp.ndarray) – An array of shape (n_triangles, 3) containing the indices of the vertices for each triangle.
- mesh_surface(flux_surfaces: ParametrisedSurface, s: float, toroidal_extent: ToroidalExtent, n_theta: int, n_phi: int, normals_facing_outwards: bool = True)[source]
Create a mesh of points on a flux surface at normalized radius s, with n_theta poloidal and n_phi toroidal points.
This cannot be jitted because the toroidal extent determines whether it is closed, which determines the number of triangles. Therefore, the size of the arrays is unknown at compile time (which cannot be jitted unless toroidal_extent is static, but this is inconvenient because then the function would recompile for every different extent).
This is therefore a convenience function only. Internal functions should not build on this function.
- Parameters:
flux_surfaces (
ParametrisedSurface) – The parametrized surface object containing the parameterization.s (
float) – The normalized radius of the flux surface to mesh.toroidal_extent (
ToroidalExtent) – The toroidal extent of the mesh.n_theta (
int) – The number of poloidal points.n_phi (
int) – The number of toroidal points.normals_facing_outwards (
bool) – Whether the normals should face outwards. Default is True.
- Returns:
positions (jnp.ndarray) – An array of shape (n_points, 3) containing the Cartesian coordinates of the mesh points.
triangles (jnp.ndarray) – An array of shape (n_triangles, 3) containing the indices of the vertices for each triangle.
- mesh_surfaces_closed(flux_surfaces: ParametrisedSurface, s_values_start: float, s_value_end: float, toroidal_extent: ToroidalExtent, n_theta: int, n_phi: int, n_cap: int)[source]
Create a closed mesh of points on flux surfaces between normalized radius s_values_start and s_value_end, with n_theta poloidal and n_phi toroidal points.
This cannot be jitted because the toroidal extent determines whether it is closed, which determines the number of triangles. Therefore, the size of the arrays is unknown at compile time (which cannot be jitted unless toroidal_extent is static, but this is inconvenient because then the function would recompile for every different extent).
This is therefore a convenience function only. Internal functions should not build on this function.
- Parameters:
flux_surfaces (
ParametrisedSurface) – The parametrized surface object containing the parameterization.s_values_start (
float) – The starting normalized radius of the flux surfaces to mesh.s_value_end (
float) – The ending normalized radius of the flux surfaces to mesh.include_axis (bool) – Whether to include the magnetic axis in the mesh.
toroidal_extent (
ToroidalExtent) – The toroidal extent of the mesh.n_theta (
int) – The number of poloidal points.n_phi (
int) – The number of toroidal points.n_cap (
int) – The number of radial points in the caps if not full toroidal extent.
- Returns:
positions (jnp.ndarray) – An array of shape (n_points, 3) containing the Cartesian coordinates of the mesh points.
triangles (jnp.ndarray) – An array of shape (n_triangles, 3) containing the indices of the vertices for each triangle.
- mesh_tetrahedra(flux_surfaces: ParametrisedSurface, s_values: Array, toroidal_extent: ToroidalExtent, n_theta: int, n_phi: int)[source]
Create a tetrahedral mesh between layers of flux surfaces at normalized radii s_values, with n_theta poloidal and n_phi toroidal points.
This cannot be jitted because the toroidal extent determines whether it is closed, which determines the number of tetrahedra. Therefore, the size of the arrays is unknown at compile time (which cannot be jitted unless toroidal_extent is static, but this is inconvenient because then the function would recompile for every different extent).
This is therefore a convenience function only. Internal functions should not build on this function.
- Parameters:
flux_surfaces (
ParametrisedSurface) – The flux surface object containing the parameterization.s_values (
Array) – An array of normalized radii of the flux surfaces to mesh.toroidal_extent (
ToroidalExtent) – The toroidal extent of the mesh.n_theta (
int) – The number of poloidal points.n_phi (
int) – The number of toroidal points.
- Returns:
positions (jnp.ndarray) – An array of shape (n_points, 3) containing the Cartesian coordinates of the mesh points.
tetrahedra (jnp.ndarray) – An array of shape (n_tetrahedra, 4) containing the indices of the vertices for each tetrahedron.
- mesh_watertight_layers(flux_surfaces: ParametrisedSurface, s_values: Array, toroidal_extent: ToroidalExtent, n_theta: int, n_phi: int)[source]
Create a watertight mesh of points on flux surfaces at normalized radii s_values, with n_theta poloidal and n_phi toroidal points.
This cannot be jitted because the toroidal extent determines whether it is closed, which determines the number of triangles. Therefore, the size of the arrays is unknown at compile time (which cannot be jitted unless toroidal_extent is static, but this is inconvenient because then the function would recompile for every different extent).
This is therefore a convenience function only. Internal functions should not build on this function.
- Parameters:
flux_surfaces (
ParametrisedSurface) – The parametrized surface object containing the parameterization.s_values (
Array) – An array of normalized radii of the flux surfaces to mesh.toroidal_extent (
ToroidalExtent) – The toroidal extent of the mesh.n_theta (
int) – The number of poloidal points.n_phi (
int) – The number of toroidal points.
- Returns:
positions (jnp.ndarray) – An array of shape (n_points, 3) containing the Cartesian coordinates of the mesh points.
triangles (jnp.ndarray) – An array of shape (n_triangles, 3) containing the indices of the vertices for each triangle.