Mondaic

salvus.mesh.layered_meshing.utils.compute_ellipticity

salvus.mesh.layered_meshing.utils.compute_ellipticity salvus mesh layered_meshing utils compute_ellipticity

A utility for computing the ellipticity of a layered model.

Functions

apply_ellipticity()

def apply_ellipticity(
    mesh: UnstructuredMesh,
    ellipticity: typing.Callable[[npt.NDArray], npt.NDArray],
    radius: float,
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
) -> UnstructuredMesh: ...

Deform a spherical mesh according to its ellipticity.

Parameters
  • mesh UnstructuredMesh — The mesh to deform. NOTE: Will be updated in place.
  • ellipticity typing.Callable[[npt.NDArray], npt.NDArray] — A callable that provides the ellipticity at an array of radii. Can be computed from a layered model using the compute_ellipticity function in this module.
  • radius float — The radius of the sphere to apply ellipticity to.
  • execution_policy bindings.ExecutionPolicy — Execution policy governing the maximum allowable parallelism of child routines.
Returns UnstructuredMesh — A mesh with ellipticity applied.

compute_ellipticity()

def compute_ellipticity(
    layered_model: LayeredModel, ellipsoid: str | float
) -> typing.Callable[[npt.NDArray], npt.NDArray]: ...

Computes the ellipticity of a layered model as a function of radius.

All realized parameter types are acceptable. For discrete parameters the mean ellipticity will be computed at each radial sample, and for analytic parameters only 1-D radially-varying models are accepted.

Each layer is discretized using 100 equally-spaced points in the radial direction, and the density is evaluated at those points. These discrete values are then used to integrate Clairaut’s equation. The discrete interval is then interpolated using a 3rd order spline, and returned as a callable that can be evaluated at any absolute radius in meters.

Parameters
  • layered_model LayeredModel — The layered model to compute the ellipticity of.
  • ellipsoid str | float — The ellipticity (or flattening — the terms are used interchangeably here) of the sphere at the surface. If a string is passed, it can be one of WGS84, GRS80, or MARS, which will be converted to the corresponding ellipticity.
Returns typing.Callable[[npt.NDArray], npt.NDArray] — A function that can be called to compute the ellipticity at a given absolute radius in meters.