specfem::assembly::compute_source_array¶
2D Source Array Computation¶
Compute Lagrange interpolant-weighted source contributions at GLL quadrature points for a 2D source.
Computes the source array for a given source by evaluating Lagrange interpolants at the source location and distributing source contributions to GLL points. Supports both vector and tensor sources:
Vector sources: Direct force components multiplied by Lagrange interpolants
Tensor sources: Moment tensor components transformed via spatial derivatives
// Vector source example auto force = std::make_shared<specfem::sources::force<dim2>>( x, z, angle, stf, wavefield_type); Kokkos::View<type_real***> source_array("src", 2, ngllz, ngllx); compute_source_array(force, mesh, jacobian_matrix, source_array); // Tensor source example auto moment_tensor = std::make_shared<specfem::sources::moment_tensor<dim2>>( x, z, Mxx, Mzz, Mxz, stf, wavefield_type); compute_source_array(moment_tensor, mesh, jacobian_matrix, source_array);
- Template Parameters:
SourceArrayViewType – Kokkos view type (must be rank-3)
- Parameters:
source – Source object (vector_source or tensor_source)
mesh – Mesh containing quadrature information
jacobian_matrix – Jacobian matrix for coordinate transformations
source_array – Output array of shape (ncomponents, ngllz, ngllx)
3D Source Array Computation¶
Compute Lagrange interpolant-weighted source contributions at GLL quadrature points for a 3D source.
3D version supporting vector and tensor sources with trilinear Lagrange interpolation across xi, eta, and gamma coordinates. Supports both vector and tensor sources:
Vector sources: Direct force components multiplied by Lagrange interpolants
Tensor sources: Moment tensor components transformed via spatial derivatives
// Vector source example auto force = std::make_shared<specfem::sources::force<dim3>>( x, y, z, angle, stf, wavefield_type); Kokkos::View<type_real****> source_array("src", 3, ngllz, nglly, ngllx); compute_source_array(force, mesh, jacobian_matrix, source_array); // Tensor source example auto moment_tensor = std::make_shared<specfem::sources::moment_tensor<dim3>>( x, y, z, Mxx, Myy, Mzz, Mxy, Mxz, Myz, stf, wavefield_type); compute_source_array(moment_tensor, mesh, jacobian_matrix, source_array);
- Template Parameters:
SourceArrayViewType – Kokkos view type (must be rank-4)
- Parameters:
source – Source object (vector_source or tensor_source)
mesh – Mesh containing quadrature information
jacobian_matrix – Jacobian matrix for coordinate transformations
source_array – Output array of shape (ncomponents, ngllz, nglly, ngllx)