bfieldtools.mesh_calculus.laplacian_matrix

bfieldtools.mesh_calculus.laplacian_matrix(mesh, material_param=None)

Sparse Laplace-Beltrami operator.

This function returns the so-called cotangent-Laplacian L, which can be used to solve the Laplacian eigenvectors as L @ v_i = -k_i^2 M @ v_i, where M is the mass matrix of the mesh (see mass_matrix).

For meshes with boundaries, the matrix corresponds to zero-Neumann boundary conditions (the natural boundary condtion).

When solving something with zero-Dirichlet condition only the inner vertices should be free parameters and the associated elements of the matrix should be used.

For more discussion about the boundary conditions related to stream functions of divergence-free surface currents, see the associated publication about the physics (Makinen 2020).

Parameters
mesh: Trimesh Mesh object
material_param: array-like with length N_triangles

material parameter for each triangle, used for resistance matrix

Returns
sparse csr_matrix (N_vertices, N_vertices)

non-diagonal elements L_ij = - 0.5* (cot(alpha) + cot(beta)) diagonal elements L_ii = - sum_{i!=j} L_ij