2D specfem::sources::moment_tensor implementation

Moment-Tensor implementation

template<>
class moment_tensor<specfem::dimension::type::dim2> : public specfem::sources::tensor_source<specfem::dimension::type::dim2>

Moment-tensor source.

This class implements a moment tensor source in 2D, which represents seismic sources like earthquakes through a symmetric stress tensor. The moment tensor components Mxx, Mzz, and Mxz define the source mechanism.

Usage Example
// Create a Ricker wavelet source time function
auto stf = std::make_unique<specfem::source_time_functions::Ricker>(
    8.0,   // dominant frequency (Hz)
    0.01,  // time factor
    1.0,   // amplitude
    0.0,   // time shift
    1.0,   // normalization factor
    false  // do not reverse
);

// Create a 2D moment tensor source at (5.0, 8.0)
auto mt_source =
specfem::sources::moment_tensor<specfem::dimension::type::dim2>( 5.0,  //
x-coordinate 8.0,  // z-coordinate 1.0,  // Mxx - normal double couple in x
direction 2.0,  // Mzz - normal double couple in z direction 0.5,  // Mxz -
shear double couple in x-z plane std::move(stf),
    specfem::wavefield::simulation_field::forward
);

// Set the medium type (moment tensors work with elastic media)
mt_source.set_medium_tag(specfem::element::medium_tag::elastic_psv);

// Get the source tensor (2x2 symmetric matrix for 2D)
auto source_tensor = mt_source.get_source_tensor();
// source_tensor(0,0) = Mxx, source_tensor(0,1) = Mxz
// source_tensor(1,0) = Mxz, source_tensor(1,1) = Mzz

Public Functions

inline moment_tensor()

Default source constructor.

inline type_real get_Mxx() const

Get the Mxx component of the moment tensor.

Returns:

type_real x-coordinate

inline type_real get_Mxz() const

Get the Mxz component of the moment tensor.

Returns:

type_real z-coordinate

inline type_real get_Mzz() const

Get the Mzz component of the moment tensor.

Returns:

type_real z-coordinate

inline moment_tensor(YAML::Node &Node, const int nsteps, const type_real dt, const specfem::wavefield::simulation_field wavefield_type)

Construct a new moment tensor force object.

Parameters:

moment_tensor – a moment_tensor data holder read from source file written in .yml format

inline moment_tensor(type_real x, type_real z, const type_real Mxx, const type_real Mzz, const type_real Mxz, std::unique_ptr<specfem::source_time_functions::stf> source_time_function, const specfem::wavefield::simulation_field wavefield_type)

Costruct new moment tensor source using forcing function.

Parameters:
  • x – x-coordinate of source

  • z – z-coordinate of source

  • Mxx – Mxx component of moment tensor

  • Mzz – Mzz component of moment tensor

  • Mxz – Mxz component of moment tensor

  • source_time_function – pointer to source time function

  • wavefield_type – type of wavefield

virtual std::string print() const override

User output.

virtual specfem::kokkos::HostView2d<type_real> get_source_tensor() const override

Get the source tensor.

Returns the 2D seismic moment tensor for this source:

\[\begin{split} \mathbf{M}_{2D} = \begin{pmatrix} M_{xx} & M_{xz} \\ M_{xz} & M_{zz} \end{pmatrix} \end{split}\]

Where the components represent:

  • \(M_{xx}\): Normal stress component in x-direction

  • \(M_{zz}\): Normal stress component in z-direction

  • \(M_{xz}\): Shear stress component in x-z plane

The tensor format depends on the medium type:

Elastic PSV (2×2 matrix):

\[\begin{split} \begin{pmatrix} M_{xx} & M_{xz} \\ M_{xz} & M_{zz} \end{pmatrix} \end{split}\]

Elastic PSV-T (Cosserat) (3×2 matrix):

\[\begin{split} \begin{pmatrix} M_{xx} & M_{xz} \\ M_{xz} & M_{zz} \\ 0.0 & 0.0 \end{pmatrix} \end{split}\]

Poroelastic (4×2 matrix - duplicated for solid/fluid phases):

\[\begin{split} \begin{pmatrix} M_{xx} & M_{xz} \\ M_{xz} & M_{zz} \\ M_{xx} & M_{xz} \\ M_{xz} & M_{zz} \end{pmatrix} \end{split}\]

Electromagnetic TE (2×2 matrix - same as elastic PSV):

\[\begin{split} \begin{pmatrix} M_{xx} & M_{xz} \\ M_{xz} & M_{zz} \end{pmatrix} \end{split}\]

Returns:

Kokkos::View<type_real **, Kokkos::LayoutLeft, Kokkos::HostSpace> Source tensor with dimensions [ncomponents][2] where each row contains [Mxx, Mxz], [Mxz, Mzz] etc, depending on the medium type

virtual std::vector<specfem::element::medium_tag> get_supported_media() const override

Get the list of supported media for this source type.

Returns:

std::vector<specfem::element::medium_tag> list of supported media

inline virtual source_type get_source_type() const override

Get the source type.

Returns:

source_type type of source

inline type_real get_t0() const

Get the value of t0 from the specfem::stf::stf object.

Returns:

value of t0

inline void update_tshift(type_real tshift)

Update the value of tshift for specfem::stf::stf object.

Returns:

new value of tshift

void set_source_time_function(YAML::Node &Node, const int nsteps, const type_real dt)

Set the forcing function for the source.

This function initializes the source time function based on the configuration provided in the YAML node. It supports various types of source time functions such as Dirac, Gaussian, Ricker, dGaussian, Heaviside, and External. If the specified source time function is not recognized, an exception is thrown.

This method also is responsible for setting up the start time of the source time function depending on dimension (dim2, dim3) and forcing function type.

Parameters:
  • Node – YAML node containing source time function configuration

  • nsteps – number of time steps

  • dt – time step size

inline std::unique_ptr<specfem::source_time_functions::stf> &get_source_time_function()

Get the forcing function object.

Returns:

std::unique_ptr<specfem::source_time_functions::stf>&

inline void set_local_coordinates(const specfem::point::local_coordinates<dimension_tag> &local_coordinates)

Set the local xi coordinates of the source in the local coordinate system.

Parameters:

specfem::point::local_coordinates<dimension_tag> – local_coordinates

inline specfem::point::local_coordinates<dimension_tag> get_local_coordinates() const

Get the local coordinates of the source in the local coordinate system.

Returns:

specfem::point::local_coordinates<dimension_tag>

inline void set_global_coordinates(const specfem::point::global_coordinates<dimension_tag> &global_coordinates)

Set the global coordinates of the source in the global coordinate system.

Parameters:

specfem::point::global_coordinates<dimension_tag> – global_coordinates

inline specfem::point::global_coordinates<dimension_tag> get_global_coordinates() const

Get the global coordinates of the source in the global coordinate system.

Returns:

specfem::point::global_coordinates<dimension_tag>

void set_medium_tag(specfem::element::medium_tag medium_tag)

Set the medium tag for the source.

This needs to be set inside the since each medium requires a separate implementation for each medium and some source do not have implementations for certain media at all. E.g., if you want to assign a moment tensor to an element in the water column (acoustic), it does not make sense, or rather it is unphysical.

Parameters:

medium_tag – medium tag

inline specfem::element::medium_tag get_medium_tag() const

Get the medium tag for the source.

Returns:

specfem::medium::medium_tag medium tag