Mondaic

salvus.mesh.algorithms.unstructured_mesh.spatial_gradients

salvus.mesh.algorithms.unstructured_mesh.spatial_gradients salvus mesh algorithms unstructured_mesh spatial_gradients

Functions related to the extraction of spatial gradients of fields defined on an unstructured mesh.

Functions

compute_spatial_gradients()

def compute_spatial_gradients(
    mesh: UnstructuredMesh, fields: str | list[str] | None = None
) -> None: ...

Extract spatial model gradients.

This function takes a mesh object and computes the spatial model gradient of each field contained in the mesh. The function returns the same mesh with additional fields for each component of the gradient.

Model gradients are always computed in Cartesian coordinates. By construction of the Lagrange basis, the gradients are not continuous across elemental boundaries. Hence, the values of the gradient on points shared between elements, depend on which element they are computed in.

Parameters
  • mesh UnstructuredMesh — Mesh object for which model gradients are to be computed.
  • fields str | list[str] | None — Optional list of fields for which model gradients should be computed. Defaults to all fields contained in the mesh.
Returns None

compute_volume_integrals()

def compute_volume_integrals(
    mesh: UnstructuredMesh, fields: str | list[str]
) -> dict[str, float]: ...

Compute volume integrals of fields over the mesh.

This function computes the volume integrals of the passed fields defined as elemental fields or elemental nodal fields.

Parameters
  • mesh UnstructuredMesh — Mesh object for which volume integrals are to be computed.
  • fields str | list[str] — The fields for which volume integrals should be computed.
Returns dict[str, float] — Dictionary containing the volume integrals of the fields. Each integral is a float.