Mondaic
This API reference is not for the latest stable Salvus version.

salvus.mesh.algorithms.spherical

Cubed sphere mesh generation following Ronchi et al. (1996).

Functions

cubed_sphere_chunk_on_unit_sphere()

def cubed_sphere_chunk_on_unit_sphere(
    euler_angles_in_degrees: Union[
        Sequence[float], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]]
    ],
    chunk_dim_1: Union[
        salvus.mesh.algorithms.spherical.EquiAzimuthalGrid,
        salvus.mesh.algorithms.spherical.AzimuthalGrid,
    ],
    chunk_dim_2: Optional[
        salvus.mesh.algorithms.spherical.EquiAzimuthalGrid,
        salvus.mesh.algorithms.spherical.AzimuthalGrid,
    ] = None,
) -> Tuple[
    numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
    numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
    numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
]: ...

Generate a point cloud for a spherical chunk on a unit sphere.

Parameters
  • euler_angles_in_degrees Union[Sequence[float], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]]] — Euler angles to use for rotation of the chunk consecutively around z, y and z axis in degrees.
  • chunk_dim_1 Union[salvus.mesh.algorithms.spherical.EquiAzimuthalGrid, salvus.mesh.algorithms.spherical.AzimuthalGrid] — Dimensions of the spherical chunk along the first axis.
  • chunk_dim_2 Optional[salvus.mesh.algorithms.spherical.EquiAzimuthalGrid, salvus.mesh.algorithms.spherical.AzimuthalGrid] — Dimensions of the spherical chunk along the second axis. If not provided, the values of the first dimension will be copied.
Returns Tuple[numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]]]

euler_angles_from_chunk_id()

def euler_angles_from_chunk_id(
    chunk_id: Union[int, numpy.int32, numpy.int64]
) -> numpy.ndarray: ...

Utility to compute Euler angles from the id of the cubed sphere chunk.

For details, see Fig. 3 in Ronchi et al. (1996).

Parameters
  • chunk_id Union[int, numpy.int32, numpy.int64] — Number of the chunk following the numbering convention of Ronchi et al.
Returns numpy.ndarray

map_cartesian_grid_to_sphere()

def map_cartesian_grid_to_sphere(
    spherical_chunk_grid: salvus.mesh.algorithms.spherical.SphericalChunkGrid,
    euler_angles_in_degrees: Optional[
        Sequence[
            Union[
                int,
                numpy.int32,
                numpy.int64,
                float,
                numpy.float32,
                numpy.float64,
            ]
        ],
        numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
    ] = None,
) -> Tuple[
    numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
    numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
    numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
]: ...

Morph a rectilinear grid in Cartesian coordinates to a cubed sphere.

Parameters
  • spherical_chunk_grid salvus.mesh.algorithms.spherical.SphericalChunkGrid — Dimensions and discretization of the grid.
  • euler_angles_in_degrees Optional[Sequence[Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64]], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]]] — Euler angles to use for rotation of the chunk consecutively around z, y and z axis in degrees.
Returns Tuple[numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]]]

Classes

AzimuthalGrid

class AzimuthalGrid(salvus.mesh.algorithms.spherical._AzimuthalGridBase):
    def __init__(
        self,
        min_angle_in_degrees: Optional[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ] = None,
        max_angle_in_degrees: Optional[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ] = None,
        grid_points: numpy.ndarray,
    ) -> None: ...

Class for specifying the discretization of a spherical chunk in one azimuthal dimension.

Parameters
  • min_angle_in_degrees Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Lower bound of the angular range. Defaults to the negative maximum angle if not provided.
  • max_angle_in_degrees Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Upper bound of the angular range. Defaults to 45 degress if not provided.
  • grid_points numpy.ndarray — Array of grid points to be projected onto the azimuthal arc.
Methods
get_grid_points_on_arc()
def get_grid_points_on_arc(self) -> numpy.ndarray: ...

Return the array of grid points projected onto the azimuthal arc.

Returns numpy.ndarray
max_angle_in_radians()
def max_angle_in_radians(self) -> float: ...

Return the maximum angle in radians.

If the angle in degrees is not set, the method defaults to pi/4.

Returns float
min_angle_in_radians()
def min_angle_in_radians(self) -> float: ...

Return the maximum angle in radians.

If the angle in degrees is not set, the method defaults to -max angle.

Returns float
number_of_grid_points()
def number_of_grid_points(self) -> int: ...

Return the number of grid points on the arc.

Returns int

EquiAzimuthalGrid

class EquiAzimuthalGrid(salvus.mesh.algorithms.spherical._AzimuthalGridBase):
    def __init__(
        self,
        min_angle_in_degrees: Optional[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ] = None,
        max_angle_in_degrees: Optional[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ] = None,
        number_of_elements: Union[int, numpy.int32, numpy.int64],
    ) -> None: ...

Class for specifying the discretization of a spherical chunk in one azimuthal dimension.

Parameters
  • min_angle_in_degrees Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Lower bound of the angular range. Defaults to the negative maximum angle if not provided.
  • max_angle_in_degrees Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Upper bound of the angular range. Defaults to 45 degress if not provided.
  • number_of_elements Union[int, numpy.int32, numpy.int64] — The number of elements per dimension.
Methods
get_grid_points_on_arc()
def get_grid_points_on_arc(self) -> numpy.ndarray: ...

Return an equiangular array of grid points on the azimuthal arc.

Returns numpy.ndarray
max_angle_in_radians()
def max_angle_in_radians(self) -> float: ...

Return the maximum angle in radians.

If the angle in degrees is not set, the method defaults to pi/4.

Returns float
min_angle_in_radians()
def min_angle_in_radians(self) -> float: ...

Return the maximum angle in radians.

If the angle in degrees is not set, the method defaults to -max angle.

Returns float
number_of_grid_points()
def number_of_grid_points(self) -> Union[int, numpy.int32, numpy.int64]: ...

Return the number of grid points on the arc.

Returns Union[int, numpy.int32, numpy.int64]
to_azimuthal_grid()
def to_azimuthal_grid(
    self, grid_points: numpy.ndarray
) -> salvus.mesh.algorithms.spherical.AzimuthalGrid: ...

Return an azimuthal grid with the same dimensions and a new set of grid points.

Parameters
  • grid_points numpy.ndarray — Array of grid points to be projected onto the azimuthal arc.
Returns salvus.mesh.algorithms.spherical.AzimuthalGrid

EquidistantRadialGrid

class EquidistantRadialGrid(builtins.object):
    def __init__(
        self,
        min_radius: float,
        max_radius: float,
        number_of_elements: Union[
            int,
            numpy.int32,
            numpy.int64,
            numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]],
        ],
    ) -> None: ...

Class for specifying the discretization of a spherical chunk in radial direction using an equidistantly spacing.

Parameters
  • min_radius float — Lower bound of the radial range.
  • max_radius float — Upper bound of the radial range.
  • number_of_elements Union[int, numpy.int32, numpy.int64, numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]]] — Number of elements in radial direction.
Attributes
grid_points numpy.ndarray

Array of grid points to be projected onto the spherical chunk in the radial dimension.

RadialGrid

class RadialGrid(builtins.object):
    def __init__(self, grid_points: numpy.ndarray) -> None: ...

Class for specifying the discretization of a spherical chunk in radial directoin.

The radial discretization can either be specified

Parameters
  • grid_points numpy.ndarray — Array of grid points to be projected onto the spherical chunk in the radial dimension.
Attributes
max_radius float

Upper bound of the radial range.

min_radius float

Lower bound of the radial range.

number_of_elements Union[int, numpy.int32, numpy.int64]

Number of elements in radial direction.

SphericalChunkDimensions

class SphericalChunkDimensions(builtins.object):
    def __init__(
        self,
        radial_grid: Union[
            salvus.mesh.algorithms.spherical.RadialGrid,
            salvus.mesh.algorithms.spherical.EquidistantRadialGrid,
        ],
        chunk_dim_1: salvus.mesh.algorithms.spherical.EquiAzimuthalGrid,
        chunk_dim_2: Optional[
            salvus.mesh.algorithms.spherical.EquiAzimuthalGrid
        ] = None,
    ) -> None: ...

Class for specifying the discretization of a spherical chunk in one azimuthal dimension.

Parameters
  • radial_grid Union[salvus.mesh.algorithms.spherical.RadialGrid, salvus.mesh.algorithms.spherical.EquidistantRadialGrid] — Discretization of the spherical chunk in radial direction.
  • chunk_dim_1 salvus.mesh.algorithms.spherical.EquiAzimuthalGrid — Discretization of the spherical chunk in the first azimuthal dimension.
  • chunk_dim_2 Optional[salvus.mesh.algorithms.spherical.EquiAzimuthalGrid] — Discretization of the spherical chunk in the second azimuthal dimension.

SphericalChunkGrid

class SphericalChunkGrid(builtins.object):
    def __init__(
        self,
        grid_points_radius: numpy.ndarray,
        min_radius_in_meters: float = 0.5,
        max_radius_in_meters: float = 1.0,
        chunk_dim_1: salvus.mesh.algorithms.spherical.AzimuthalGrid,
        chunk_dim_2: salvus.mesh.algorithms.spherical.AzimuthalGrid,
    ) -> None: ...

Class for specifying the discretization of a spherical chunk in one azimuthal dimension.

Parameters
  • grid_points_radius numpy.ndarray — Array of grid points to be projected onto the spherical chunk in the radial dimension.
  • min_radius_in_meters float — Lower bound of the radial range. Defaults to 0.5 if not provided.
  • max_radius_in_meters float — Upper bound of the radial range. Defaults to 1.0 if not provided.
  • chunk_dim_1 salvus.mesh.algorithms.spherical.AzimuthalGrid — Discretization of the spherical chunk in the first azimuthal dimension.
  • chunk_dim_2 salvus.mesh.algorithms.spherical.AzimuthalGrid — Discretization of the spherical chunk in the second azimuthal dimension.
Methods
get_radial_grid_points()
def get_radial_grid_points(self) -> numpy.ndarray: ...

Return the array of grid points projected onto the range of radii.

Returns numpy.ndarray
get_shape()
def get_shape(self) -> Tuple: ...

Return the shape of the rectilinear grid.

Returns Tuple