2D specfem::sources::adjoint_source

Adjoint source implementation for 2D simulations

template<>
class adjoint_source<specfem::dimension::type::dim2> : public specfem::sources::vector_source<specfem::dimension::type::dim2>

Adjoint source.

This class implements an adjoint source in 2D, which is used in adjoint simulations for seismic inversion and sensitivity analysis. Adjoint sources are typically placed at receiver locations and represent data residuals.

Usage Example
// Create a Ricker wavelet source time function for the adjoint source
auto stf = std::make_unique<specfem::source_time_functions::Ricker>(
    20.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 adjoint source at receiver location (12.5, 8.3)
auto adj_source =
specfem::sources::adjoint_source<specfem::dimension::type::dim2>( 12.5,  //
x-coordinate (receiver location) 8.3,   // z-coordinate (receiver location)
    std::move(stf),
    "STA01",    // station name
    "NETWORK"   // network name
);

// Set the medium type where the adjoint source is located
adj_source.set_medium_tag(specfem::element::medium_tag::elastic_psv);

// Get the force vector (unit vector components based on medium)
auto force_vector = adj_source.get_force_vector();

// Adjoint sources always return adjoint wavefield type
assert(adj_source.get_wavefield_type() ==
       specfem::wavefield::simulation_field::adjoint);

Public Functions

virtual std::string print() const override

User output.

virtual specfem::kokkos::HostView1d<type_real> get_force_vector() const override

Get the force vector.

Returns a unit force vector for adjoint source computations:

\[\begin{split} \mathbf{f}_{adjoint} = \begin{cases} [1.0] & \text{acoustic: unit pressure amplitude} \\ [1.0] & \text{elastic SH: unit force out-of-plane} \\ [1.0, 1.0] & \text{elastic PSV: unit forces in x,z directions} \\ [1.0, 1.0, 1.0, 1.0] & \text{poroelastic: solid/fluid phases} \\ [1.0, 1.0] & \text{electromagnetic TE} \\ [1.0, 1.0, 0.0] & \text{elastic PSV-T: no rotation component} \end{cases} \end{split}\]

Where the unit components provide the basis for adjoint computations in full waveform inversion. The adjoint source acts as a time-reversed receiver that backpropagates data residuals through the medium.

Returns:

Kokkos::View<type_real *, Kokkos::LayoutLeft, Kokkos::HostSpace> Unit force vector with size depending on 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 object.

Returns:

source_type

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