magnet.generate.circular_inclusions#

magnet.generate.circular_inclusions(output_path: str, lc: float | tuple = 0.15, N: int | tuple = 25, r: float = 0.015)#

Create a mesh with circular inclusions.

Creates a triangular mesh of the unit square including N circular inclusions of radius r. The cinclusions have physical group equal to 1, while the background has it equal to 0.

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.

  • Physical_groups (np.ndarray of int) – Physical groups of the cells.

Notes

To avoid intersections between the inclusions 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.