specfem::algorithms::divergence

template<typename ChunkIndexType, typename TensorFieldType, typename WeightsType, typename QuadratureType, typename CallableType, std::enable_if_t<specfem::data_access::is_chunk_element<TensorFieldType>::value, int> = 0>
void divergence(const ChunkIndexType &chunk_index, const WeightsType &weights, const QuadratureType &hprime, const TensorFieldType &f, const CallableType &callback)

Compute the divergence of a vector field f using the spectral element formulation (eqn: A7 in Komatitsch and Tromp, 1999)

Template Parameters:
  • ChunkIndexType – Chunk index type

  • MemberType – Kokkos team member type

  • IteratorType – Iterator type (Chunk iterator)

  • TensorFieldType – Vector field view type (Chunk view)

  • QuadratureType – Quadrature view type

  • CallableType – Callback functor type

Parameters:
  • chunk_index – Chunk index specifying the elements within this chunk

  • jacobian_matrix – Jacobian matrix of basis functions

  • weights – Weights for the quadrature

  • hprime – Integration quadrature

  • f – Field to compute the divergence of

  • callback – Callback functor. Callback signature must be:

     void(const typename IteratorType::index_type, const
    specfem::datatype::VectorPointViewType<type_real, ViewType::components>)
    

Implementation Details

template<typename TensorFieldType, typename WeightsType, typename QuadratureType, typename std::enable_if_t<TensorFieldType::dimension_tag == specfem::element::dimension_tag::dim2, int> = 0>
auto specfem::algorithms::impl::element_divergence(const TensorFieldType &f, const typename TensorFieldType::index_type &local_index, const WeightsType &weights, const QuadratureType &lagrange_derivative)

Compute the divergence of a tensor field at a specific point in a 2D spectral element.

Compute the divergence of a tensor field at a specific point in a 3D spectral element.

Template Parameters:
  • TensorFieldType – Type of the tensor field (must be 2D)

  • WeightsType – Type of the quadrature weights

  • QuadratureType – Type of the Lagrange derivative polynomial

  • TensorFieldType – Type of the tensor field (must be 3D)

  • WeightsType – Type of the quadrature weights

  • QuadratureType – Type of the Lagrange derivative polynomial

Parameters:
  • f – Tensor field to compute divergence of

  • local_index – Local indices within the spectral element

  • weights – Quadrature weights for integration

  • lagrange_derivative – Lagrange derivative polynomials for differentiation

  • f – Tensor field to compute divergence of

  • local_index – Local indices within the spectral element

  • weights – Quadrature weights for integration

  • lagrange_derivative – Lagrange derivative polynomials for differentiation

Returns:

Auto-deduced return type containing the divergence values

Returns:

Auto-deduced return type containing the divergence values