specfem::assembly::boundaries_impl::stacey

template<specfem::element::dimension_tag DimensionTag>
struct stacey

Primary template declaration for Stacey boundary conditions.

Data required to compute Stacey boundary conditions.

General template declaration for Stacey boundary conditions.

Dimension-Specific Implementations

template<>
struct stacey<specfem::element::dimension_tag::dim2>

Stacey absorbing boundary condition implementation for 2D SEM simulations.

This class provides the implementation for Stacey absorbing boundary conditions in 2D spectral element simulations. Stacey boundary conditions work by applying a velocity-proportional damping term at boundary edges that approximates the impedance of the outgoing waves. The boundary condition is implemented as:

\( \mathbf{T} \cdot \mathbf{n} = -\rho c \mathbf{v} \cdot \mathbf{n} \)

where \(\mathbf{T}\) is the traction, \(\mathbf{n}\) is the outward normal, \(\rho\) is density, \(c\) is wave speed, and \(\mathbf{v}\) is velocity.

Applications:

  • Seismic wave propagation in unbounded domains

  • Reduction of spurious reflections from domain boundaries

  • Truncation of infinite geological media

  • Wave scattering problems requiring non-reflecting boundaries

Implementation Details: The class stores geometric and physical data required for Stacey boundary implementation:

  • Boundary tags for identification during assembly

  • Edge normal vectors for computing outward flux

  • Edge integration weights for boundary integral evaluation

  • Both device and host storage for hybrid CPU/GPU execution

Type Definitions

using BoundaryTagView = Kokkos::View<specfem::element::boundary_tag_container***, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Kokkos view type for storing boundary tag containers on device.

Stores boundary tag information for quadrature points within Stacey boundary elements. Dimensions: [nspec_stacey, ngllz, ngllx]

using EdgeNormalView = Kokkos::View<type_real****, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Kokkos view type for storing edge normal vectors on device.

Stores outward normal vectors at boundary edges for each quadrature point. Dimensions: [nspec_stacey, ngllz, ngllx, ndim] where ndim=2 for 2D problems

using EdgeWeightView = Kokkos::View<type_real***, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Kokkos view type for storing edge integration weights on device.

Stores integration weights for boundary edge quadrature. Dimensions: [nspec_stacey, ngllz, ngllx]

Public Constants

static constexpr auto dimension_tag = specfem::element::dimension_tag::dim2

Dimension tag indicating this is a 2D implementation.

Data Members

BoundaryTagView quadrature_point_boundary_tag

Device-accessible boundary tag information for quadrature points.

Contains boundary tag containers for every quadrature point within spectral elements that have Stacey absorbing boundaries. Used during device kernel execution to identify points requiring Stacey boundary treatment.

Dimensions: [nspec_stacey, ngllz, ngllx]

  • nspec_stacey: Number of elements with Stacey boundaries

  • ngllz, ngllx: Number of GLL points in z and x directions

BoundaryTagView::host_mirror_type h_quadrature_point_boundary_tag

Host-accessible mirror of boundary tag information.

Host mirror of quadrature_point_boundary_tag for CPU access during initialization, debugging, and host-side computations.

EdgeNormalView edge_normal

Device-accessible edge normal vectors for boundary quadrature points.

Stores the outward unit normal vectors at boundary edges for each quadrature point. These normals are essential for computing the impedance-based absorption terms in the Stacey boundary condition formulation.

Dimensions: [nspec_stacey, ngllz, ngllx, 2]

  • Component 0: Normal vector x-component

  • Component 1: Normal vector z-component

EdgeWeightView edge_weight

Device-accessible edge integration weights for boundary quadrature.

Contains integration weights for evaluating boundary integrals along Stacey edges. These weights incorporate the Jacobian transformation from reference to physical coordinates and are zero for interior points not on boundary edges.

Dimensions: [nspec_stacey, ngllz, ngllx]

EdgeNormalView::host_mirror_type h_edge_normal

Host-accessible mirror of edge normal vectors.

Host mirror of edge_normal for CPU access and initialization.

EdgeWeightView::host_mirror_type h_edge_weight

Host-accessible mirror of edge integration weights.

Host mirror of edge_weight for CPU access and initialization.

Constructors

stacey() = default

Default constructor.

Creates an empty Stacey boundary condition container with uninitialized data members. Data must be set up via assignment or the parametrized constructor.

stacey(const int nspec, const int ngllz, const int ngllx, const specfem::mesh::absorbing_boundary<dimension_tag> &stacey, const specfem::assembly::mesh<dimension_tag> &mesh, const specfem::assembly::jacobian_matrix<dimension_tag> &jacobian_matrix, const Kokkos::View<int*, Kokkos::HostSpace> &boundary_index_mapping, std::vector<specfem::element::boundary_tag_container> &boundary_tag)

Construct Stacey absorbing boundary condition data from mesh information.

This constructor processes mesher-supplied absorbing boundary information and converts it into per-quadrature-point data required for implementing Stacey absorbing boundary conditions during SEM simulations.

Parameters:
  • nspec – Number of spectral elements with Stacey absorbing boundaries

  • ngllz – Number of GLL points in the z (vertical) direction

  • ngllx – Number of GLL points in the x (horizontal) direction

  • stacey – Mesh-level absorbing boundary information containing edge lists, normal vectors, and geometric data from the mesher

  • mesh – Assembly mesh with coordinate information and element connectivity

  • jacobian_matrix – Jacobian matrix container with basis function derivatives used for computing geometric transformations at quadrature points

  • boundary_index_mapping – Mapping from global spectral element indices to boundary-local indices for elements with Stacey boundaries

  • boundary_tag – Vector of boundary tag containers updated with element-level boundary information for assembly processes

Device Data Access Methods

Methods for loading Stacey boundary condition data on GPU devices. These functions are optimized for device execution and provide access to geometric and physical data required for absorbing boundary condition implementation.

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == false, int> = 0>
inline void load_on_device(const IndexType &index, specfem::point::boundary<boundary_tag, dimension_tag, false> &boundary) const

Load Stacey boundary data for a non-SIMD quadrature point on device.

This function loads complete Stacey boundary information for a specific quadrature point during GPU kernel execution. It populates the boundary object with all data needed for absorbing boundary condition calculations, including geometric normals and integration weights.

Note

This is an implementation detail and is typically called by a higher-level load_on_device function

Template Parameters:

IndexType – Must be a valid non-SIMD index type (specfem::point::index)

Parameters:
  • index – Quadrature point location specifier containing

  • boundary – Output boundary object populated with Stacey boundary data

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == false, int> = 0>
inline void load_on_device(const IndexType &index, specfem::point::boundary<specfem::element::boundary_tag::composite_stacey_dirichlet, dimension_tag, false> &boundary) const

Load Stacey boundary data for composite boundary conditions on device.

Note

This is an implementation detail and is typically called by a higher-level load_on_device function

Template Parameters:

IndexType – Must be a valid non-SIMD index type

Parameters:
  • index – Quadrature point location specifier

  • boundary – Output composite boundary object populated with Stacey contributions

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == true, int> = 0>
inline void load_on_device(const IndexType &index, specfem::point::boundary<boundary_tag, dimension_tag, true> &boundary) const

Load Stacey boundary data for SIMD quadrature points on device.

Note

This is an implementation detail and is typically called by a higher-level load_on_device function

Template Parameters:

IndexType – Must be a valid SIMD index type

Parameters:
  • index – SIMD index containing multiple quadrature point locations

  • boundary – Output SIMD boundary object with vectorized data storage

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == true, int> = 0>
inline void load_on_device(const IndexType &index, specfem::point::boundary<specfem::element::boundary_tag::composite_stacey_dirichlet, dimension_tag, true> &boundary) const

Load Stacey boundary data for SIMD composite boundaries on device.

Note

This is an implementation detail and is typically called by a higher-level load_on_device function

Template Parameters:

IndexType – Must be a valid SIMD index type

Parameters:
  • index – SIMD index with masked lanes for multiple quadrature points

  • boundary – Output SIMD composite boundary object

Host Data Access Methods

Methods for loading Stacey boundary condition data on CPU hosts. These functions provide equivalent functionality to device methods but operate on host-accessible data for CPU-based computations, debugging, and initialization.

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == false, int> = 0>
inline void load_on_host(const IndexType &index, specfem::point::boundary<boundary_tag, dimension_tag, false> &boundary) const

Load Stacey boundary data for a quadrature point on host.

Note

This is an implementation detail and is typically called by a higher-level load_on_host function

Template Parameters:

IndexType – Must be a valid non-SIMD index type (specfem::point::index)

Parameters:
  • index – Quadrature point location specifier

  • boundary – Output boundary object populated with Stacey boundary data

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == false, int> = 0>
inline void load_on_host(const IndexType &index, specfem::point::boundary<specfem::element::boundary_tag::composite_stacey_dirichlet, dimension_tag, false> &boundary) const

Load Stacey boundary data for composite boundaries on host.

Note

This is an implementation detail and is typically called by a higher-level load_on_host function

Template Parameters:

IndexType – Must be a valid non-SIMD index type

Parameters:
  • index – Quadrature point location specifier

  • boundary – Output composite boundary object populated with Stacey contributions

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == true, int> = 0>
inline void load_on_host(const IndexType &index, specfem::point::boundary<boundary_tag, dimension_tag, true> &boundary) const

Load Stacey boundary data for SIMD quadrature points on host.

Note

This is an implementation detail and is typically called by a higher-level load_on_host function

Template Parameters:

IndexType – Must be a valid SIMD index type

Parameters:
  • index – SIMD index with masked lanes for multiple quadrature points

  • boundary – Output SIMD boundary object with vectorized data storage

template<typename IndexType, typename std::enable_if_t<specfem::data_access::is_index_type<IndexType>::value && specfem::data_access::is_point<IndexType>::value && IndexType::using_simd == true, int> = 0>
inline void load_on_host(const IndexType &index, specfem::point::boundary<specfem::element::boundary_tag::composite_stacey_dirichlet, dimension_tag, true> &boundary) const

Load Stacey boundary data for SIMD composite boundaries on host.

Note

This is an implementation detail and is typically called by a higher-level load_on_host function

Template Parameters:

IndexType – Must be a valid SIMD index type

Parameters:
  • index – SIMD index with masked lanes for multiple quadrature points

  • boundary – Output SIMD composite boundary object