specfem::assembly::fields_impl::field_impl¶
-
template<specfem::dimension::type DimensionTag, specfem::element::medium_tag MediumTag>
class field_impl : public specfem::assembly::fields_impl::base_field<DimensionTag, MediumTag, specfem::data_access::DataClassType::displacement>, public specfem::assembly::fields_impl::base_field<DimensionTag, MediumTag, specfem::data_access::DataClassType::velocity>, public specfem::assembly::fields_impl::base_field<DimensionTag, MediumTag, specfem::data_access::DataClassType::acceleration>, public specfem::assembly::fields_impl::base_field<DimensionTag, MediumTag, specfem::data_access::DataClassType::mass_matrix>¶ Complete field implementation for spectral element wave simulations.
This class provides a unified interface to all field components required for spectral element wave propagation simulations.
Field components by medium type:
Elastic media: displacement (u), velocity ( \(\dot{u}\)), acceleration ( \(\ddot{u}\))
Acoustic media: potential ( \(\phi\)), velocity potential ( \(\dot{\phi}\)), acceleration potential ( \(\ddot{\phi}\))
Poroelastic media: solid and fluid displacements, velocities, accelerations
- Template Parameters:
DimensionTag – Spatial dimension (2D or 3D)
MediumTag – Physical medium type (elastic, acoustic, poroelastic)
Public Functions
-
field_impl() = default¶
< Access velocity field values
Default constructor.
Creates an uninitialized field implementation with no allocated storage. Fields must be properly initialized before use.
-
field_impl(const specfem::assembly::mesh<dimension_tag> &mesh, const specfem::assembly::element_types<dimension_tag> &element_type, Kokkos::View<int*, Kokkos::LayoutLeft, specfem::kokkos::HostMemSpace> assembly_index_mapping)¶
Construct field implementation from mesh and element information.
Initializes all field components (displacement, velocity, acceleration, mass matrix) based on the spectral element mesh structure and element classifications. This constructor determines the number of global points from the mesh and element types, then allocates appropriate storage for all field components.
- Parameters:
mesh – Spectral element mesh containing connectivity and global numbering
element_type – Element type classification for medium-specific allocation
assembly_index_mapping – Host view mapping local to global indices
-
field_impl(const int nglob)¶
Construct field implementation with specified number of global points.
Allocates storage for all field components (displacement, velocity, acceleration, mass matrix) with the specified number of global points. This constructor is useful when the global point count is known a priori.
- Parameters:
nglob – Number of global points in the spectral element mesh
-
template<specfem::sync::kind SyncField>
void sync_fields() const¶ Synchronize all field components between host and device memory.
Performs synchronization of all field components (displacement, velocity, acceleration, mass matrix) in a single operation. This is more efficient than synchronizing each field individually when all fields need to be transferred.
- Template Parameters:
SyncField – Synchronization direction (HostToDevice or DeviceToHost)
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace> get_field() const¶
Get device view of displacement field \(\mathbf{u}\).
Returns a device-accessible Kokkos view of the displacement field for use in GPU kernels. The view has dimensions [nglob × components] where components correspond to spatial directions (ux, uy, uz for 3D elastic media).
- Returns:
Device view of displacement field data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace> get_field_dot() const¶
Get device view of velocity field \(\dot{\mathbf{u}}\).
Returns a device-accessible Kokkos view of the velocity field (first time derivative of displacement) for use in GPU kernels and time integration schemes.
- Returns:
Device view of velocity field data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace> get_field_dot_dot() const¶
Get device view of acceleration field \(\ddot{\mathbf{u}}\).
Returns a device-accessible Kokkos view of the acceleration field (second time derivative of displacement) for use in GPU kernels and time integration schemes.
- Returns:
Device view of acceleration field data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace> get_mass_inverse() const¶
Get device view of inverse mass matrix \(\mathbf{M}^{-1}\).
Returns a device-accessible Kokkos view of the inverse mass matrix for efficient solution of the spectral element wave equation. In spectral element methods, the mass matrix is typically diagonal, making inversion trivial.
- Returns:
Device view of inverse mass matrix data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, specfem::kokkos::HostMemSpace> get_host_field() const¶
Get host view of displacement field for CPU operations.
Returns a host-accessible Kokkos view of the displacement field for CPU-based operations, post-processing, I/O, and debugging. Data must be synchronized from device before accessing if computations were performed on GPU.
- Returns:
Host view of displacement field data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, specfem::kokkos::HostMemSpace> get_host_field_dot() const¶
Get host view of velocity field for CPU operations.
Returns a host-accessible Kokkos view of the velocity field for CPU-based post-processing, analysis, and I/O operations.
- Returns:
Host view of velocity field data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, specfem::kokkos::HostMemSpace> get_host_field_dot_dot() const¶
Get host view of acceleration field for CPU operations.
Returns a host-accessible Kokkos view of the acceleration field for CPU-based post-processing, analysis, and debugging operations.
- Returns:
Host view of acceleration field data
-
inline Kokkos::View<type_real**, Kokkos::LayoutLeft, specfem::kokkos::HostMemSpace> get_host_mass_inverse() const¶
Get host view of inverse mass matrix for CPU operations.
Returns a host-accessible Kokkos view of the inverse mass matrix for CPU-based analysis, debugging, and verification operations.
- Returns:
Host view of inverse mass matrix data
Public Members
-
int nglob¶
Number of global points in this field implementation.
Public Static Attributes
-
static constexpr auto dimension_tag = DimensionTag¶
Compile-time dimension tag for this field implementation.
-
static constexpr auto medium_tag = MediumTag¶
Compile-time medium tag for this field implementation.
-
static constexpr int components = specfem::element::attributes<DimensionTag, MediumTag>::components¶
Number of field components for this medium and dimension combination.
-
static constexpr auto data_class¶
Data class type identifier for this field component.
-
static constexpr auto data_class
Data class type identifier for this field component.
-
static constexpr auto data_class
Data class type identifier for this field component.
-
static constexpr auto data_class
Data class type identifier for this field component.