pyFM.mesh.geometry.div_f

pyFM.mesh.geometry.div_f(f, vertices, faces, normals, vert_areas=None, grads=None, face_areas=None)

Compute the divergence of a vector field on a mesh.

Takes a per-face vector field and returns a per-vertex divergence.

Parameters:
  • f ((m, 3) np.ndarray) – Vector field on each face.

  • vertices ((n, 3) np.ndarray) – Coordinates of the vertices.

  • faces ((m, 3) np.ndarray) – Vertex indices for each face.

  • normals ((m, 3) np.ndarray) – Normal coordinates for each face.

  • vert_areas ((n,) np.ndarray, optional) – Per-vertex areas, for faster computation. Computed from the mesh if not provided.

  • grads (iterable, optional) – Iterable of size 3 containing arrays of size (m, 3) giving gradient directions for all faces.

  • face_areas ((m,) np.ndarray, optional) – Per-face areas, for faster computation. Only used if grads is given.

Returns:

divergence – Divergence of f on the mesh.

Return type:

(n,) np.ndarray