specfem::assembly::boundaries_impl::acoustic_free_surface

template<specfem::dimension::type DimensionTag>
struct acoustic_free_surface

Data required to compute acoustic free surface boundary conditions.

General template declaration for acoustic free surface boundary conditions.

See also

specfem::assembly::boundaries_impl::acoustic_free_surface<specfem::dimension::type::dim3> for 3D specialization.

Dimension-Specific Implementations

template<>
struct acoustic_free_surface<specfem::dimension::type::dim2>

Data container used to store acoustic free surface boundary information.

This class provides data structures and data access functions required to implement acoustic free surface boundary conditions in 2D spectral element simulations.

Physical Background: An acoustic free surface boundary condition enforces zero traction (pressure) at the boundary. Mathematically, this corresponds to setting the acceleration to zero at quadrature points located on the free surface. This is physically appropriate for:

  • Air-water interfaces

  • Fluid-vacuum boundaries

  • Ocean-atmosphere interfaces in seismic modeling

Implementation Details: The class stores boundary tag information for each quadrature point on elements that contain acoustic free surface boundaries. The boundary tags are used during the assembly process to identify which quadrature points require free surface treatment.

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.

This view stores boundary tag information for all quadrature points within elements that contain acoustic free surface boundaries. The view has dimensions [nspec, ngllz, ngllx] where nspec is the number of spectral elements with free surface boundaries.

Public Constants

static constexpr auto dimension_tag = specfem::dimension::type::dim2

Dimension tag indicating this is a 2D implementation.

Data Members

BoundaryTagView quadrature_point_boundary_tag

Device-accessible boundary tag information for quadrature points.

This view contains boundary tag containers for every quadrature point within spectral elements that have acoustic free surface boundaries. The boundary tags are used during device kernel execution to identify which points require free surface treatment.

Dimensions: [nspec_acoustic_free_surface, ngllz, ngllx]

  • nspec_acoustic_free_surface: Number of elements with free surface boundaries

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

BoundaryTagView::HostMirror h_quadrature_point_boundary_tag

Host-accessible mirror of boundary tag information.

This is the host mirror of quadrature_point_boundary_tag, used for CPU access during initialization, debugging, and host-side computations. Data is synchronized between host and device as needed.

Constructors

acoustic_free_surface() = default

Default constructor.

Creates an empty acoustic free surface boundary condition container. Data members are left uninitialized and must be set up via assignment or the parametrized constructor.

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

Construct acoustic free surface boundary condition data from mesh information.

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

Parameters:
  • nspec – Number of spectral elements with acoustic free surface boundaries

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

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

  • acoustic_free_surface – Mesh-level acoustic free surface boundary information containing element lists and edge definitions

  • mesh – Assembly mesh containing coordinate and connectivity information

  • boundary_index_mapping – Mapping from global spectral element indices to boundary-specific indices for elements with free surface boundaries

  • boundary_tag – Vector of boundary tag containers that will be populated with per-element boundary information

Device Data Access Methods

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 acoustic free surface boundary data for a non-SIMD quadrature point 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 index type (specfem::point::index) with SIMD disabled

Parameters:
  • index – Quadrature point location specifier containing

  • boundary – Output boundary object

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 acoustic free surface data for composite boundary conditions on device.

See also

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

Template Parameters:

IndexType – Must be a valid index type with SIMD disabled

Parameters:
  • index – Quadrature point location specifier

  • boundary – Output composite boundary object. The acoustic free surface contribution is accumulated into this boundary’s tag field.

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 acoustic free surface 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 tag 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 acoustic free surface 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

  • boundary – Output SIMD composite boundary object

Host Data Access Methods

Methods for loading boundary condition data on CPU hosts. These functions provide equivalent functionality to the device methods but operate on host-accessible 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<boundary_tag, dimension_tag, false> &boundary) const

Load acoustic free surface 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

Parameters:
  • index – Quadrature point location specifier

  • boundary – Output boundary object for tag accumulation

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 acoustic free surface 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

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 acoustic free surface boundary data for SIMD quadrature points on host.

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 boundary object with vectorized 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 acoustic free surface 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

  • boundary – Output SIMD composite boundary object