magnet.generate.circular_holes#
- magnet.generate.circular_holes(output_path: str, lc: float | tuple[float, float] = 0.04, N: int | tuple[int, int] = 10, r: float = 0.03)#
Create a mesh with circular holes.
Creates a triangular mesh of the unit square including N circular holes of radius r.
- Parameters:
output_path (str) – File path where the mesh will be saved.
lc (tuple[float, float], optional) – Triangle size parameter, or bounds of the uniform distribution from which it is sampled. Default is 0.04.
N (int or tuple[int, int], optional) – Number of holes in the mesh, or bounds of the uniform distribuiton from which it is sampled. Default is 10.
r (float, optional) – Radius of the circular holes; default is 0.03.
- Returns:
adjacency (sparse.csr_matrix of np.uint8) – Adjacency matrix describing the mesh.
centroids (np.ndarray of float) – Centroid coordinates of each cell of the mesh.
areas (np.ndarray of float) – Areas of the cells.
Notes
To avoid intersections between the holes and with the external boundary, a minimum distance equal to 10% of r is imposed. To have a fairly uniform mesh, it is recommended to choose r at least 3 times bigger than lc.