Mesh Refinement
- tokamesh.construction.refine_mesh(R: ndarray, z: ndarray, triangles: ndarray, refinement_bools: ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]
Refine a mesh by partitioning specified triangles into 4 sub-triangles. Triangles sharing one or more edges with those being refined will also be partitioned in such a way to ensure the resulting mesh is valid.
- Parameters
R – The major radius of each mesh vertex as a 1D numpy array.
z – The z-height of each mesh vertex as a 1D numpy array.
triangles – A 2D numpy array of integers specifying the indices of the vertices which form each of the triangles in the mesh. The array must have shape
(N,3)whereNis the total number of triangles.refinement_bools – A numpy array of bools specifying which triangles will be refined. Triangles with indices corresponding to
Truevalues in the bool array will be refined.
- Return R, z, triangles
The
R,zandtrianglesarrays (defined as described above) for the refined mesh.
- tokamesh.construction.trim_vertices(R: ndarray, z: ndarray, triangles: ndarray, trim_bools: ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]
Removes chosen vertices (and any triangles containing those vertices) from a mesh.
- Parameters
R – The major radius of each mesh vertex as a 1D numpy array.
z – The z-height of each mesh vertex as a 1D numpy array.
triangles – A 2D numpy array of integers specifying the indices of the vertices which form each of the triangles in the mesh. The array must have shape
(N,3)whereNis the total number of triangles.trim_bools – A 1D array of boolean values corresponding to the vertices, which is
Truefor any vertices which are to be removed from the mesh.
- Return R, z, triangles
The
R,zandtrianglesarrays (defined as described above) with the specified vertices removed.