jax_sbgeom.interfaces.blanket_creation module
- class BlanketMeshStructure(n_theta: int, n_phi: int, n_s: int, include_axis: bool, full_angle: bool)[source]
Bases:
ModuleClass representing the structure of a volume blanket mesh.
Has several convenience functions to slice the blanket and functions defined on the blanket.
- n_theta: int
Number of poloidal points in the blanket mesh.
- n_phi: int
Number of toroidal points in the blanket mesh.
- n_s: int
Number of radial points in the blanket mesh.
- include_axis: bool
Whether the axis is included in the blanket mesh.
- full_angle: bool
Whether the blanket mesh covers a full torus.
- property n_phi_blocks
- property n_theta_blocks
- property n_layered_blocks
- reshape_to_layer(layer_i: int, arr: Array)[source]
Reshapes a flat array of shape (n_elements,) to the shape of the blocks in the given layer, which is (n_phi_blocks, n_theta_blocks, n_tet_per_block). This n_tet_per_block is 3 for the first layer if the axis is included, and 6 otherwise. For all other layers, it is 6.
- reshape_without_axis(arr: Array)[source]
Reshapes a flat array of shape (n_elements,) to the shape of the blocks in the blanket, which is (n_layered_blocks, n_phi_blocks, n_theta_blocks, n_tet_per_block).
Discards the first layer if an axis is present and then reshapes the last.
- map_radial_array_to_layers(arr: Array)[source]
Maps a flat array of shape (…, n_s) to the shape of the layers in the blanket, which is (n_layered_blocks,). This is useful for mapping a radial function defined on the layers to the blocks in the blanket (e.g. materials)
- property n_elements
- property n_points
- class LayeredDiscreteBlanket(n_theta: int, n_phi: int, resolution_layers: tuple, toroidal_extent: ToroidalExtent)[source]
Bases:
ModuleClass representing a layered, structured, discrete blanket structure around a flux surface.
- n_theta: int
Number of poloidal points in the blanket mesh.
- n_phi: int
Number of toroidal points in the blanket mesh.
- resolution_layers: tuple
Tuple of number of discrete layers in each layer of the blanket. The total number of discrete layers is given by the sum of the entries in this tuple. The length of this tuple should be equal to n_layers.
- toroidal_extent: ToroidalExtent
Toroidal extent of the blanket. This can be a full torus, a half module, etc. depending on the application.
- property n_discrete_layers
- property n_physical_layers
- abstract property volume_mesh_structure: BlanketMeshStructure
- property layer_array
Maps a flat array of shape (n_elements,) to the shape of the layers in the blanket, which is (n_layered_blocks,). This is useful for mapping a radial function defined on the layers to the blocks in the blanket (e.g. materials)
- abstract property s_spacing
The s spacing for the layered discrete blanket used for meshing the discrete layers.
- map_to_physical_spacing(d_layers: Array)[source]
Maps the s_spacing property to physical spacing. Takes a 1D array of the same size of the number of physical layers.
The result has the meaning of a normal radial coordinate until s = 1.0, beyond is the distance from the lcfs. In other words, 1.2 means a distance of 0.2 from the LCFS.
- Parameters:
d_layers (
Array) – Array of cumulative physical layer boundary positions. Must have length equal to the number of physical layers.- Returns:
The physical spacing for the layered discrete blanket.
- Return type:
jnp.ndarray
- class LayeredDiscreteBlanketTransformed(n_theta: int, n_phi: int, resolution_layers: tuple, toroidal_extent: ToroidalExtent)[source]
Bases:
LayeredDiscreteBlanketClass representing a layered discrete blanket structure around a flux surface, where the flux surface is transformed such that s = 1.0 corresponds to the innermost layer of the blanket, s = 2.0 to the first external layer, etc.
No volume mesh is assumed; a choice has to be made whether to include the plasma or not, which gives rise to different implementations.
- surface_mesh(parametrised_surface: ParametrisedSurface)[source]
- class LayeredDiscreteBlanketPlasmaTransformed(n_theta: int, n_phi: int, resolution_layers: tuple, toroidal_extent: ToroidalExtent, s_power_sampling: int = 2)[source]
Bases:
LayeredDiscreteBlanketTransformedClass representing a layered discrete blanket structure around a flux surface, where the flux surface is transformed such that s = 1.0 corresponds to the innermost layer of the blanket, s = 2.0 to the first external layer, etc.
Until s=1, it is meshed with a power-law spacing. This is done with the number of points specified in the first entry of resolution_layers (i.e., resolution_layers[0] - 1 layers). Then, the first external layer is placed immediately afterwards. Therefore, the total number of element layers until the first external layer is resolution_layers[0]. The number of elements in the first external layer is resolution_layers[1], and so on.
- s_power_sampling: int = 2
- volume_mesh(parametrised_surface: ParametrisedSurface)[source]
- property volume_mesh_structure: BlanketMeshStructure
- property s_spacing
The s spacing for the layered discrete blanket used for meshing the discrete layers.
- class DiscreteFiniteSizeCoilSet(n_points_per_coil: int, toroidal_extent: ToroidalExtent, width_R: float, width_phi: float)[source]
Bases:
objectClass representing a set of discrete finite size coils forming a coilset for blanket creation.
- n_points_per_coil
Number of discrete points per coil
- Type:
int
- toroidal_extent
Toroidal extent of the coilset
- Type:
- width_R
Radial width of the finite sized coils
- Type:
float
- width_phi
Toroidal width of the finite sized coils
- Type:
float
- n_points_per_coil: int
- toroidal_extent: ToroidalExtent
- width_R: float
- width_phi: float
- compute_d_spacing_transformed_axis(blanket: LayeredDiscreteBlanket, d_layers: Array, s_power_sampling: int)[source]
Computes the d spacing for the layered discrete blanket in physical coordinates.
- Parameters:
blanket (
LayeredDiscreteBlanket) – The layered discrete blanket to compute the spacing for.d_layers (
Array) – Array of cumulative physical layer boundary positions. Must have length equal to blanket.n_physical_layers.s_power_sampling (
int) – The power to which the radial coordinate s is raised when sampling. Higher values lead to more points near the inner layers.
- Returns:
The d spacing for the layered discrete blanket.
- Return type:
jnp.ndarray
- mesh_tetrahedral_blanket_transformed_axis(flux_surface: FluxSurface, blanket: LayeredDiscreteBlanket, s_power_sampling: int)[source]
Create a blanket mesh using structured tetrahedral meshing. It assumes that the flux surface is already transformed such that s = 1.0 corresponds to the innermost layer of the blanket, s = 2.0 to the first external layer, etc. The axis is included.
Until s=1, it is meshed with a power-law spacing. This is done with the number of points specified in the first entry of resolution_layers (i.e., resolution_layers[0] - 1 layers). Then, the first external layer is placed immediately afterwards. Therefore, the total number of element layers until the first external layer is resolution_layers[0]. The number of elements in the first external layer is resolution_layers[1], and so on.
- Parameters:
blanket (
LayeredDiscreteBlanket) – The layered discrete blanket to mesh.s_power_sampling (
int) – The power to which the radial coordinate s is raised when sampling. Higher values lead to more points near the inner layers.
- Returns:
nodes (jax.numpy.ndarray) – The nodes of the tetrahedral mesh.
connectivity (jax.numpy.ndarray) – The connectivity of the tetrahedral mesh.