salvus.mesh.algorithms.unstructured_mesh.deformations
Deformation algorithms of unstructured meshes.
Functions
apply_deformations()
apply_deformations()def apply_deformations(
mesh: UnstructuredMesh, names: typing.Optional[typing.List[str]] = None
) -> None: ...Apply the previously added deformations.
meshUnstructuredMesh — The mesh.namestyping.Optional[typing.List[str]] — Names of the deformations to apply. Defaults to all added ones.
apply_scale()
apply_scale()def apply_scale(mesh: UnstructuredMesh) -> None: ...Apply the scaling factor to the mesh.
meshUnstructuredMesh — The mesh.
compute_deformation_2D()
compute_deformation_2D()def compute_deformation_2D(
points: npt.NDArray,
x: npt.NDArray,
deformation: npt.NDArray,
mode: DeformationMode2D,
vertical_reference: float | None = None,
vertical_begin_deformation: float = 0.0,
vertical_end_deformation: float = inf,
) -> npt.NDArray: ...Compute vertical deformation of a 2-D array of points.
The deformation is applied to the points at vertical_reference with control over how the points above and below move.
Any keyword arguments are passed to scipy’s RectBivariateSpline interpolator.
pointsnpt.NDArray — The points to deform.xnpt.NDArray — horizontal coordinates of the deformation. Angle in radians for spherical models.deformationnpt.NDArray — The deformation sampled at coordinates x.modeDeformationMode2D — The interpolation mode.vertical_referencefloat | None — Vertical coordinate, at which the deformation should be applied, e.g. y-coordinate of the surface for surface deformation. Defaults to the max y coordinate / radius in case at least one of y0, y1 are finite.vertical_begin_deformationfloat — Don’t deform any points with a vertical coordinate smaller than this.vertical_end_deformationfloat — Don’t deform any points with a vertical coordinate larger than this.
compute_deformations_3D()
compute_deformations_3D()def compute_deformations_3D(
points: npt.NDArray,
x: npt.NDArray,
y: npt.NDArray,
deformation: npt.NDArray,
mode: DeformationMode3D,
vertical_reference: typing.Optional[float] = None,
vertical_begin_deformation: float = 0.0,
vertical_end_deformation: float = inf,
interpolation_order: int = 3,
) -> npt.NDArray: ...Compute vertical deformation of a 3-D array of points.
The deformation is applied to the points at vertical_reference with control over how the points above and below move.
Any keyword arguments are passed to scipy’s RectBivariateSpline interpolator.
pointsnpt.NDArray — The points to deform.xnpt.NDArray — first horizontal coordinate of the deformation. Angle in radians for spherical models.ynpt.NDArray — second horizontal coordinate of the deformation. Angle in radians for spherical models.deformationnpt.NDArray — The deformation sampled at coordinates x and y.modeDeformationMode3D — Interpolation mode.vertical_referencetyping.Optional[float] — Vertical coordinate, at which the deformation should be applied, e.g. y-coordinate of the surface for surface deformation. Defaults to the max z coordinate / radius in case at least one of z0, z1 are finite.vertical_begin_deformationfloat — Don’t deform any points with a vertical coordinate smaller than this.vertical_end_deformationfloat — Don’t deform any points with a vertical coordinate larger than this.interpolation_orderint — horizontal degree of the spline interpolation. For unstructured data either 1 or 3.
compute_deformations_cylindrical()
compute_deformations_cylindrical()def compute_deformations_cylindrical(
points: npt.NDArray,
phi: npt.NDArray,
z: npt.NDArray,
deformation: npt.NDArray,
r0: float = 0.0,
r1: float = inf,
rref: typing.Optional[float] = None,
kx: int = 1,
ky: int = 1,
) -> npt.NDArray: ...Compute mesh deformations in a cylindrical coordinate system.
Add deformation for cylindrical meshes where the axis of the cylinder is aligned with the z component. The DEM radially stretches the domain in the region of (x,y)-radii in [r0, r1] - points below r0 are kept fixed, points above r1 are moved as the DEM, points in between are interpolated and the full DEM is applied to points at rref.
Usage: first call add_dem_cylindrical for each boundary that is to be perturbed and finally call apply_dem to add the perturbation to the mesh coordinates.
pointsnpt.NDArray — The points whose deformation is to be computed.phinpt.NDArray — Angle in the x-y-plane of the DEM in radians.znpt.NDArray — z-coordinates of the DEM.deformationnpt.NDArray — the DEM sampled at the coordinates (phi,z)r0float — radius in x-y-plane at which the stretching beginsr1float — radius in x-y-plane at which the stretching ends, can be infinityrreftyping.Optional[float] — radius in x-y-plane at which the deformation should be appliedkxint — horizontal degree of the spline interpolationkyint — vertical degree of the spline interpolation
compute_deformations_ellipticity()
compute_deformations_ellipticity()def compute_deformations_ellipticity(
points: npt.NDArray, deformation: npt.NDArray, scale: float = 1.0
) -> npt.NDArray: ...Compute elliptic deformations of a 3-D set of points.
pointsnpt.NDArray — The points to compute it for.deformationnpt.NDArray — The deformation for each point.scalefloat — Scale the radius by this value.
queue_mesh_deformations_2D()
queue_mesh_deformations_2D()def queue_mesh_deformations_2D(
mesh: UnstructuredMesh,
x: npt.NDArray,
deformation: npt.NDArray,
vertical_begin_deformation: float = 0.0,
vertical_end_deformation: float = inf,
vertical_reference: typing.Optional[float] = None,
name: typing.Optional[str] = None,
mode: DeformationMode2D | str = DeformationMode2D.cartesian,
) -> None: ...Queue a 2D deformation for later application.
Please see the compute_deformation_2D function for more information.
meshUnstructuredMesh — The mesh to queue for.xnpt.NDArray — horizontal coordinates of the deformation. Angle in radians for spherical models.deformationnpt.NDArray — The deformation sampled at coordinates x.vertical_begin_deformationfloat — Don’t deform any points with a vertical coordinate smaller than this.vertical_end_deformationfloat — Don’t deform any points with a vertical coordinate larger than this.vertical_referencetyping.Optional[float] — Vertical coordinate, at which the deformation should be applied, e.g. y-coordinate of the surface for surface deformation. Defaults to the max y coordinate / radius in case at least one of y0, y1 are finite.nametyping.Optional[str] — Optionally pass a name for the deformation.modeDeformationMode2D | str — The deformation mode.
queue_mesh_deformations_3D()
queue_mesh_deformations_3D()def queue_mesh_deformations_3D(
mesh: UnstructuredMesh,
x: npt.NDArray,
y: npt.NDArray,
deformation: npt.NDArray,
vertical_begin_deformation: float = 0.0,
vertical_end_deformation: float = inf,
vertical_reference: typing.Optional[float] = None,
interpolation_order: int = 3,
mode: DeformationMode3D | str = DeformationMode3D.cartesian,
name: typing.Optional[str] = None,
) -> None: ...Queue a 3D deformation for later application.
Please see the compute_deformation_3D function for more information.
meshUnstructuredMesh — The mesh to queue for.xnpt.NDArray — first horizontal coordinate of the deformation. Angle in radians for spherical models.ynpt.NDArray — second horizontal coordinate of the deformation. Angle in radians for spherical models.deformationnpt.NDArray — The deformation sampled at coordinates x.vertical_begin_deformationfloat — Don’t deform any points with a vertical coordinate smaller than this.vertical_end_deformationfloat — Don’t deform any points with a vertical coordinate larger than this.vertical_referencetyping.Optional[float] — Vertical coordinate, at which the deformation should be applied, e.g. y-coordinate of the surface for surface deformation. Defaults to the max y coordinate / radius in case at least one of y0, y1 are finite.interpolation_orderint — Horizontal interpolation order.modeDeformationMode3D | str — The deformation mode.nametyping.Optional[str] — Optionally pass a name for the deformation.
queue_mesh_deformations_cylindrical()
queue_mesh_deformations_cylindrical()def queue_mesh_deformations_cylindrical(
mesh: UnstructuredMesh,
phi: npt.NDArray,
z: npt.NDArray,
dem: npt.NDArray,
r0: float = 0.0,
r1: float = inf,
rref: typing.Optional[float] = None,
name: typing.Optional[str] = None,
) -> None: ...Queue cylindrical deformations for later application.
Add deformation for cylindrical meshes where the axis of the cylinder is aligned with the z component. The DEM radially stretches the domain in the region of (x,y)-radii in [r0, r1] - points below r0 are kept fixed, points above r1 are moved as the DEM, points in between are interpolated and the full DEM is applied to points at rref.
Usage: first call add_dem_cylindrical for each boundary that is to be perturbed and finally call apply_dem to add the perturbation to the mesh coordinates.
meshUnstructuredMesh — The mesh.phinpt.NDArray — Angle in the x-y-plane of the DEM in radians.znpt.NDArray — z-coordinates of the DEM.demnpt.NDArray — the DEM sampled at the coordinates (phi,z)r0float — radius in x-y-plane at which the stretching beginsr1float — radius in x-y-plane at which the stretching ends, can be infinityrreftyping.Optional[float] — radius in x-y-plane at which the deformation should be appliednametyping.Optional[str] — name of this deformation to refer to it in UnstructuredMesh.apply_dem()
Classes
DeformationMode2D
DeformationMode2Dclass DeformationMode2D(enum.Enum):
def __init__(self): ...The deformation mode for 2D deformations.
DeformationMode3D
DeformationMode3Dclass DeformationMode3D(enum.Enum):
def __init__(self): ...The deformation mode for 3D deformations.