Version:

salvus.project.components.types

salvus.project.components.types salvus project components types
Types to be used throughout project.

Classes

Dim

The spatial dimension.
SIGNATURE
class Dim(enum.Enum):
    def __init__(self): ...

MeshResolution

The mesh resolution specification.
The canonical measure of the resolution of a Salvus waveform simulation is the number of elements that span a given reference wavelength in the mesh. For instance, a phrase like "we design our mesh so that there are 1.5 elements per minimum wavelength at 1 MHz" would communicate that signals up to 1 MHz can be interpreted with confidence. Often, however, one does not know the minimum wavelength a-priori, and only in fact knows the cutoff frequency of their transducer, or the minimum period of their earthquake source model, for instance. This class enables the user to express their intent to resolve waves up to a given maximum frequency, and it will be used in conjunction with the meshing algorithms and model interpolators to produce a mesh that attempts to honor that intent.
Specify resolution in terms of frequency and elements per wavelength.
Users can to specify the desired elements per wavelength per dimension and per layer. For example, in a 2-D 2-layer model one could specify:
- [(1.0, 2.0), (2.0, 4.0)] to request, in the first layer, 1.0
  element per wavelength in the horizontal direction and 2.0 in
  the vertical direction, and in the second layer, 2.0 elements
  per wavelength in the horizontal direction and 4.0 in the
  vertical direction.
While in a 3-D 2-layer model one could specify:
- [(1.0, 1.0, 2.0), (2.0, 2.0, 4.0)] to request, in the first
  layer, 1.0 element per wavelength in _both_ horizontal
  directions and 2.0 in the vertical direction, and in the
  second layer, 2.0 elements per wavelength in _both_
  horizontal directions and 4.0 in the vertical direction.
Broadcasting rules in 2-D, where values for not all dimensions or layers are specified, are as follows:
- 1.0 => 1.0 elements per wavelength in all dimensions for all
  layers.
- (1.0, 2.0) => 1.0 elements per wavelength in the horizontal
  direction, 2.0 in the vertical direction, for all layers.
- [(1.0, 2.0), (2.0, 4.0)] => That which is described in the
  2-D example above, with the additional comment that the last
  entry (2.0, 4.0) will be used for all subsequent layers beyond 2.
Broadcasting rules in 3-D, where values for not all dimensions or layers are specified, are slightly different: - 1.0 => 1.0 elements per wavelength in all dimensions for all layers. - (1.0, 2.0) => 1.0 elements per wavelength in both horizontal direction, 2.0 in the vertical direction, for all layers. - [(1.0, 2.0), (2.0, 4.0)] => That which is described in the 3-D example above: note that the horizontal direction is broadcast to become (1.0, 1.0, 2.0) and (2.0, 2.0, 4.0) respectively. The last entry (2.0, 4.0) will be used for all subsequent layers beyond 2, with the same horizontal broadcasting rules applied.
The corresponding dimensions to each of the elements per wavelength are independent of the coordinate system, and simply reference horizontal and vertical directions, respectively. Coordinate names will always be alphabetical, so:
- in 2-D: x, y
- in 3-D: x, y, z
- in 2-D spherical: latitude, radius
- in 3-D spherical: latitude, longitude, radius
SIGNATURE
class MeshResolution(builtins.object):
    def __init__(
        self,
        reference_frequency: salvus._core.types.float_,
        elements_per_wavelength: (
            salvus._core.types.float_ | tuple[salvus._core.types.float_, ...]
        ) = 1.5,
        model_order: salvus._core.types.int_ = 1,
        model_precision: type[np.number] = numpy.float64,
    ): ...
ARGUMENTS
Required
reference_frequency
Type:salvus._core.types.float_
Description:
Reference frequency at which to compute the local wavelengths.
Optional
elements_per_wavelength
Type:salvus._core.types.float_ | tuple[salvus._core.types.float_, ...]
Default value:1.5
Description:
The number of elements per wavelength, specified according to the description above.
Optional
model_order
Type:salvus._core.types.int_
Default value:1
Description:
The polynomial order of the model representation on each element.
Optional
model_precision
Type:type[np.number]
Default value:numpy.float64
Description:
The numerical precision of the model parameters in the mesh. Defaults to np.float64 for double precision.

Properties

  • elements_per_wavelength(tuple[float, ...])-Return the elements per wavelength as a tuple of at least length 1. The elements per wavelength parameter can be specified differently in different dimensions. Since the `MeshResolution` object has no concept of dimension itself, for a scalar _epw parameter is upcast to a 1-element tuple so it can easily be repeated where necessary in an iterable context. Returns: A tuple of the number of elements per length in each dimension. A 1-element tuple return implies that the elements_per_wavelength parameter is constant in all dimensions.
  • model_order(int)-The polynomial order of the model representation on each element.
  • model_precision(type[np.number])-The numerical precision of the model parameters in the mesh.
  • reference_frequency(float)-Reference frequency at which to compute the local wavelengths.

Class Methods

MeshResolution.from_period()
Specify resolution in terms of period and elements per wavelength.
SIGNATURE
def from_period(
    reference_period: salvus._core.types.float_,
    elements_per_wavelength: salvus._core.types.float_ = 1.5,
    model_order: salvus._core.types.int_ = 1,
) -> MeshResolution: ...
ARGUMENTS
Required
reference_period
Type:salvus._core.types.float_
Description:
Reference period at which to compute the local wavelengths.
Optional
elements_per_wavelength
Type:salvus._core.types.float_
Default value:1.5
Description:
Number of elements that should span the local wavelength.
Optional
model_order
Type:salvus._core.types.int_
Default value:1
Description:
The polynomial order of the model representation on each element.

Methods

MeshResolution.broadcast_elements_per_wavelength()
Get the elements per wavelength expanded across dimensions and layers.
See the docstring of elements_per_wavelength in this class' init method for a description of broadcasting behavior over dimensions and layers.
SIGNATURE
def broadcast_elements_per_wavelength(
    self, n_dim: int, n_layers: int
) -> list[tuple[salvus._core.types.float_, ...]]: ...
ARGUMENTS
Required
n_dim
Type:int
Description:
The number of dimensions in the model.
Required
n_layers
Type:int
Description:
The number of layers in the model.
MeshResolution.replace()
Return a copy of this MeshResolution with some fields replaced.
SIGNATURE
def replace(self) -> MeshResolution: ...

Used in tutorials

Functionality from this module is used in the following tutorials.
PAGE CONTENTS