magnet.generate.heterogeneous_square#

magnet.generate.heterogeneous_square(output_path: str, lc: tuple[float, float] = (0.07, 0.47))#

Create a mesh of a heterogeneous square.

Creates a triangular mesh of the unit square divided into two parts along a line; the two parts have different physical group.

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.07, 0.47).

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.