specfem::point::stress¶
-
template<specfem::dimension::type DimensionTag, specfem::element::medium_tag MediumTag, bool UseSIMD>
struct stress : public specfem::data_access::Accessor<specfem::data_access::AccessorType::point, specfem::data_access::DataClassType::stress, DimensionTag, UseSIMD>¶ Represents a stress tensor at a quadrature point in spectral element simulations.
The stress class encapsulates stress tensor data and provides operations for stress transformations in finite element computations. The tensor dimensions and components are determined by the medium type and spatial dimension:
Acoustic medium: 1 component in 2D/3D (scalar pressure)
Elastic medium: 2 components in 2D, 3 components in 3D (velocity components)
Poroelastic medium: 4 components in 2D (solid and fluid phases)
The class inherits from the data access framework providing SIMD vectorization support and efficient memory access patterns for high-performance computing.
// Example: Create stress tensor for 2D elastic medium using stress_type = specfem::point::stress<specfem::dimension::type::dim2, specfem::element::medium_tag::elastic_psv, false>; // Initialize stress components (2x2 tensor for 2D elastic) typename stress_type::value_type T(1.1, 2.1, // first column (component 0, 1) 1.2, 2.2); // second column (component 0, 1) stress_type stress_tensor(T); // Transform stress using jacobian matrix // auto jacobian = initialize_jacobian_matrix(); auto transformed_stress = stress_tensor * jacobian;
See also
See also
- Template Parameters:
DimensionTag – Spatial dimension (dim2 or dim3)
MediumTag – Physical medium type (acoustic, elastic_psv, elastic, poroelastic)
UseSIMD – Enable SIMD vectorization for performance optimization
Type Definitions
Type aliases for SIMD and tensor operations
-
using value_type = typename base_type::template tensor_type<type_real, components, dimension>¶
Tensor type for storing stress components (components × dimension)
Static Properties
Compile-time constants derived from template parameters
-
static constexpr int dimension = specfem::element::attributes<DimensionTag, MediumTag>::dimension¶
Spatial dimension (2 or 3)
-
static constexpr int components = specfem::element::attributes<DimensionTag, MediumTag>::components¶
Number of stress components based on medium type.
-
static constexpr specfem::dimension::type dimension_tag = DimensionTag¶
Template parameter for spatial dimension.
-
static constexpr specfem::element::medium_tag medium_tag = MediumTag¶
Template parameter for medium type.
Data Members
-
value_type T¶
Stress tensor storage with shape (components × dimension)
Constructors
-
stress() = default¶
Default constructor.
Initializes stress tensor with default values (typically zero).
-
inline stress(const value_type &T)¶
Constructor with stress tensor initialization.
// For 2D elastic medium (2 components × 2 dimensions) typename stress_type::value_type tensor(1.1, 2.1, // component 0: (σxx, σxz) 1.2, 2.2); // component 1: (σzx, σzz) stress_type stress(tensor);
- Parameters:
T – Stress tensor with components arranged as (components × dimension)
Operators
-
inline value_type operator*(const specfem::point::jacobian_matrix<specfem::dimension::type::dim2, true, UseSIMD> &jacobian_matrix) const¶
Transform stress tensor using jacobian matrix.
Applies the coordinate transformation from reference element to physical element using the jacobian matrix. This operation transforms stress components from the reference (ξ, ζ) coordinate system to the physical (x, z) coordinate system.
The transformation formula for 2D is: \( F(i,0) = J \cdot (T(i,0) \cdot \frac{\partial\xi}{\partial x} + T(i,1) \cdot \frac{\partial\zeta}{\partial x}) \) \( F(i,1) = J \cdot (T(i,0) \cdot \frac{\partial\xi}{\partial z} + T(i,1) \cdot \frac{\partial\zeta}{\partial z}) \)
where \( J \) is the jacobian determinant and the partial derivatives are the inverse jacobian matrix elements.
stress_type stress(stress_tensor); auto jacobian = compute_jacobian_matrix(quadrature_point); auto transformed = stress * jacobian;
- Parameters:
jacobian_matrix – Jacobian matrix containing transformation derivatives
- Returns:
Transformed stress tensor in physical coordinates
-
inline value_type operator*(const specfem::point::jacobian_matrix<specfem::dimension::type::dim3, true, UseSIMD> &jacobian_matrix) const¶
Transform stress tensor using 3D jacobian matrix.
Applies the coordinate transformation from reference element to physical element using the jacobian matrix. This operation transforms stress components from the reference (ξ, η, ζ) coordinate system to the physical (x, y, z) coordinate system.
The transformation formula for 3D is: \( F(i,0) = J \cdot (T(i,0) \cdot \frac{\partial\xi}{\partial x} + T(i,1) \cdot \frac{\partial\eta}{\partial x} + T(i,2) \cdot \frac{\partial\zeta}{\partial x}) \) \( F(i,1) = J \cdot (T(i,0) \cdot \frac{\partial\xi}{\partial y} + T(i,1) \cdot \frac{\partial\eta}{\partial y} + T(i,2) \cdot \frac{\partial\zeta}{\partial y}) \) \( F(i,2) = J \cdot (T(i,0) \cdot \frac{\partial\xi}{\partial z} + T(i,1) \cdot \frac{\partial\eta}{\partial z} + T(i,2) \cdot \frac{\partial\zeta}{\partial z}) \)
where \( J \) is the jacobian determinant and the partial derivatives are the inverse jacobian matrix elements.
stress_type stress(stress_tensor); auto jacobian = compute_jacobian_matrix_3d(quadrature_point); auto transformed = stress * jacobian;
- Parameters:
jacobian_matrix – 3D Jacobian matrix containing transformation derivatives
- Returns:
Transformed stress tensor in physical coordinates
Utility Functions
-
inline std::string print() const¶
Generate string representation of the stress tensor.
Creates a formatted string showing all components of the stress tensor for debugging and visualization purposes. The output format shows each component with its (component, dimension) indices.
stress_type stress(tensor_data); std::cout << stress.print() << std::endl; // Output: // Stress Tensor: // T(0, 0) = 1.1, T(0, 1) = 1.2 // T(1, 0) = 2.1, T(1, 1) = 2.2
- Returns:
Formatted string representation of the stress tensor
Private Types
-
using base_type = specfem::data_access::Accessor<specfem::data_access::AccessorType::point, specfem::data_access::DataClassType::stress, DimensionTag, UseSIMD>¶
Base accessor type for data access framework integration.