Version:

salvus.mesh.algorithms.unstructured_mesh.deformations

salvus.mesh.algorithms.unstructured_mesh.deformations salvus mesh algorithms unstructured_mesh deformations
Deformation algorithms of unstructured meshes.

Functions

apply_deformations()

Apply the previously added deformations.
SIGNATURE
def apply_deformations(
    mesh: UnstructuredMesh, names: list[str] | None = None
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.
Optional
names
Type:list[str] | None
Default value:None
Description:
Names of the deformations to apply. Defaults to all added ones.

apply_scale()

Apply the scaling factor to the mesh.
SIGNATURE
def apply_scale(mesh: UnstructuredMesh) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.

compute_deformation_2D()

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.
SIGNATURE
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: ...
ARGUMENTS
Required
points
Type:npt.NDArray
Description:
The points to deform.
Required
x
Type:npt.NDArray
Description:
horizontal coordinates of the deformation. Angle in radians for spherical models.
Required
deformation
Type:npt.NDArray
Description:
The deformation sampled at coordinates x.
Required
mode
Type:DeformationMode2D
Description:
The interpolation mode.
Optional
vertical_reference
Type:float | None
Default value:None
Description:
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.
Optional
vertical_begin_deformation
Type:float
Default value:0.0
Description:
Don't deform any points with a vertical coordinate smaller than this.
Optional
vertical_end_deformation
Type:float
Default value:inf
Description:
Don't deform any points with a vertical coordinate larger than this.
RETURNS
Return type: npt.NDArray

compute_deformations_3D()

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.
SIGNATURE
def compute_deformations_3D(
    points: npt.NDArray,
    x: npt.NDArray,
    y: npt.NDArray,
    deformation: npt.NDArray,
    mode: DeformationMode3D,
    vertical_reference: float | None = None,
    vertical_begin_deformation: float = 0.0,
    vertical_end_deformation: float = inf,
    interpolation_order: int = 3,
) -> npt.NDArray: ...
ARGUMENTS
Required
points
Type:npt.NDArray
Description:
The points to deform.
Required
x
Type:npt.NDArray
Description:
first horizontal coordinate of the deformation. Angle in radians for spherical models.
Required
y
Type:npt.NDArray
Description:
second horizontal coordinate of the deformation. Angle in radians for spherical models.
Required
deformation
Type:npt.NDArray
Description:
The deformation sampled at coordinates x and y.
Required
mode
Type:DeformationMode3D
Description:
Interpolation mode.
Optional
vertical_reference
Type:float | None
Default value:None
Description:
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.
Optional
vertical_begin_deformation
Type:float
Default value:0.0
Description:
Don't deform any points with a vertical coordinate smaller than this.
Optional
vertical_end_deformation
Type:float
Default value:inf
Description:
Don't deform any points with a vertical coordinate larger than this.
Optional
interpolation_order
Type:int
Default value:3
Description:
horizontal degree of the spline interpolation. For unstructured data either 1 or 3.
RETURNS
Return type: npt.NDArray

compute_deformations_cylindrical()

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.
SIGNATURE
def compute_deformations_cylindrical(
    points: npt.NDArray,
    phi: npt.NDArray,
    z: npt.NDArray,
    deformation: npt.NDArray,
    r0: float = 0.0,
    r1: float = inf,
    rref: float | None = None,
    kx: int = 1,
    ky: int = 1,
) -> npt.NDArray: ...
ARGUMENTS
Required
points
Type:npt.NDArray
Description:
The points whose deformation is to be computed.
Required
phi
Type:npt.NDArray
Description:
Angle in the x-y-plane of the DEM in radians.
Required
z
Type:npt.NDArray
Description:
z-coordinates of the DEM.
Required
deformation
Type:npt.NDArray
Description:
the DEM sampled at the coordinates (phi,z)
Optional
r0
Type:float
Default value:0.0
Description:
radius in x-y-plane at which the stretching begins
Optional
r1
Type:float
Default value:inf
Description:
radius in x-y-plane at which the stretching ends, can be infinity
Optional
rref
Type:float | None
Default value:None
Description:
radius in x-y-plane at which the deformation should be applied
Optional
kx
Type:int
Default value:1
Description:
horizontal degree of the spline interpolation
Optional
ky
Type:int
Default value:1
Description:
vertical degree of the spline interpolation
RETURNS
Return type: npt.NDArray

compute_deformations_ellipticity()

Compute elliptic deformations of a 3-D set of points.
SIGNATURE
def compute_deformations_ellipticity(
    points: npt.NDArray, deformation: npt.NDArray, scale: float = 1.0
) -> npt.NDArray: ...
ARGUMENTS
Required
points
Type:npt.NDArray
Description:
The points to compute it for.
Required
deformation
Type:npt.NDArray
Description:
The deformation for each point.
Optional
scale
Type:float
Default value:1.0
Description:
Scale the radius by this value.
RETURNS
Return type: npt.NDArray

queue_mesh_deformations_2D()

Queue a 2D deformation for later application.
Please see the compute_deformation_2D function for more information.
SIGNATURE
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: float | None = None,
    name: str | None = None,
    mode: DeformationMode2D | str = DeformationMode2D.cartesian,
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to queue for.
Required
x
Type:npt.NDArray
Description:
horizontal coordinates of the deformation. Angle in radians for spherical models.
Required
deformation
Type:npt.NDArray
Description:
The deformation sampled at coordinates x.
Optional
vertical_begin_deformation
Type:float
Default value:0.0
Description:
Don't deform any points with a vertical coordinate smaller than this.
Optional
vertical_end_deformation
Type:float
Default value:inf
Description:
Don't deform any points with a vertical coordinate larger than this.
Optional
vertical_reference
Type:float | None
Default value:None
Description:
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.
Optional
name
Type:str | None
Default value:None
Description:
Optionally pass a name for the deformation.
Optional
mode
Type:DeformationMode2D | str
Default value:DeformationMode2D.cartesian
Description:
The deformation mode.

queue_mesh_deformations_3D()

Queue a 3D deformation for later application.
Please see the compute_deformation_3D function for more information.
SIGNATURE
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: float | None = None,
    interpolation_order: int = 3,
    mode: DeformationMode3D | str = DeformationMode3D.cartesian,
    name: str | None = None,
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to queue for.
Required
x
Type:npt.NDArray
Description:
first horizontal coordinate of the deformation. Angle in radians for spherical models.
Required
y
Type:npt.NDArray
Description:
second horizontal coordinate of the deformation. Angle in radians for spherical models.
Required
deformation
Type:npt.NDArray
Description:
The deformation sampled at coordinates x.
Optional
vertical_begin_deformation
Type:float
Default value:0.0
Description:
Don't deform any points with a vertical coordinate smaller than this.
Optional
vertical_end_deformation
Type:float
Default value:inf
Description:
Don't deform any points with a vertical coordinate larger than this.
Optional
vertical_reference
Type:float | None
Default value:None
Description:
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.
Optional
interpolation_order
Type:int
Default value:3
Description:
Horizontal interpolation order.
Optional
mode
Type:DeformationMode3D | str
Default value:DeformationMode3D.cartesian
Description:
The deformation mode.
Optional
name
Type:str | None
Default value:None
Description:
Optionally pass a name for the deformation.

queue_mesh_deformations_cylindrical()

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.
SIGNATURE
def queue_mesh_deformations_cylindrical(
    mesh: UnstructuredMesh,
    phi: npt.NDArray,
    z: npt.NDArray,
    dem: npt.NDArray,
    r0: float = 0.0,
    r1: float = inf,
    rref: float | None = None,
    name: str | None = None,
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.
Required
phi
Type:npt.NDArray
Description:
Angle in the x-y-plane of the DEM in radians.
Required
z
Type:npt.NDArray
Description:
z-coordinates of the DEM.
Required
dem
Type:npt.NDArray
Description:
the DEM sampled at the coordinates (phi,z)
Optional
r0
Type:float
Default value:0.0
Description:
radius in x-y-plane at which the stretching begins
Optional
r1
Type:float
Default value:inf
Description:
radius in x-y-plane at which the stretching ends, can be infinity
Optional
rref
Type:float | None
Default value:None
Description:
radius in x-y-plane at which the deformation should be applied
Optional
name
Type:str | None
Default value:None
Description:
name of this deformation to refer to it in UnstructuredMesh.apply_dem()

Classes

DeformationMode2D

The deformation mode for 2D deformations.
SIGNATURE
class DeformationMode2D(enum.Enum):
    def __init__(self): ...

DeformationMode3D

The deformation mode for 3D deformations.
SIGNATURE
class DeformationMode3D(enum.Enum):
    def __init__(self): ...
PAGE CONTENTS