16template <
typename ScalarT,
int VecDim = 3 >
55 , treat_boundary_( treat_boundary )
56 , diagonal_( diagonal )
57 , operator_apply_mode_( operator_apply_mode )
58 , operator_communication_mode_( operator_communication_mode )
60 , send_buffers_( domain )
61 , recv_buffers_( domain )
68 operator_apply_mode_ = operator_apply_mode;
69 operator_communication_mode_ = operator_communication_mode;
87 domain_, dst_, send_buffers_, recv_buffers_ );
92 KOKKOS_INLINE_FUNCTION
void
93 operator()(
const int local_subdomain_id,
const int x_cell,
const int y_cell,
const int r_cell )
const
106 ScalarT quad_weights[num_quad_points];
122 const ScalarT r_1 = radii_( local_subdomain_id, r_cell );
123 const ScalarT r_2 = radii_( local_subdomain_id, r_cell + 1 );
132 const ScalarT grad_r_inv = 1.0 / grad_r;
134 for (
int q = 0; q < num_quad_points; q++ )
138 const ScalarT r_inv = 1.0 / r;
146 const auto grad_i =
grad_shape_full( g_rad, g_lat, r_inv, grad_r_inv, wedge, i, q );
147 const auto grad_j =
grad_shape_full( g_rad, g_lat, r_inv, grad_r_inv, wedge, j, q );
149 const auto det =
det_full( det_jac_lat, r, grad_r, wedge, q );
151 A[wedge]( i, j ) += quad_weights[q] * ( grad_i.dot( grad_j ) * det );
157 if ( treat_boundary_ )
162 boundary_mask.
fill( 1.0 );
166 for (
int i = 0; i < 6; i++ )
168 for (
int j = 0; j < 6; j++ )
170 if ( i != j && ( i < 3 || j < 3 ) )
172 boundary_mask( i, j ) = 0.0;
178 if ( r_cell + 1 == radii_.extent( 1 ) - 1 )
181 for (
int i = 0; i < 6; i++ )
183 for (
int j = 0; j < 6; j++ )
185 if ( i != j && ( i >= 3 || j >= 3 ) )
187 boundary_mask( i, j ) = 0.0;
203 for (
int d = 0; d < VecDim; d++ )
210 dst[0] = A[0] * src[0];
211 dst[1] = A[1] * src[1];
Send and receive buffers for all process-local subdomain boundaries.
Definition communication.hpp:56
Definition vector_laplace_simple.hpp:18
void operator()(const int local_subdomain_id, const int x_cell, const int y_cell, const int r_cell) const
Definition vector_laplace_simple.hpp:93
void set_operator_apply_and_communication_modes(const linalg::OperatorApplyMode operator_apply_mode, const linalg::OperatorCommunicationMode operator_communication_mode)
Definition vector_laplace_simple.hpp:64
VectorLaplaceSimple(const grid::shell::DistributedDomain &domain, const grid::Grid3DDataVec< ScalarT, 3 > &grid, const grid::Grid2DDataScalar< ScalarT > &radii, bool treat_boundary, bool diagonal, linalg::OperatorApplyMode operator_apply_mode=linalg::OperatorApplyMode::Replace, linalg::OperatorCommunicationMode operator_communication_mode=linalg::OperatorCommunicationMode::CommunicateAdditively)
Definition vector_laplace_simple.hpp:43
ScalarT ScalarType
Definition vector_laplace_simple.hpp:22
void apply_impl(const SrcVectorType &src, DstVectorType &dst)
Definition vector_laplace_simple.hpp:72
Parallel data structure organizing the thick spherical shell metadata for distributed (MPI parallel) ...
Definition spherical_shell.hpp:2498
Static assertion: VectorQ1Scalar satisfies VectorLike concept.
Definition vector_q1.hpp:162
const grid::Grid4DDataVec< ScalarType, VecDim > & grid_data() const
Get const reference to grid data.
Definition vector_q1.hpp:280
Concept for types that behave like linear operators.
Definition operator.hpp:57
void unpack_and_reduce_local_subdomain_boundaries(const grid::shell::DistributedDomain &domain, const GridDataType &data, SubdomainNeighborhoodSendRecvBuffer< typename GridDataType::value_type, grid::grid_data_vec_dim< GridDataType >() > &boundary_recv_buffers, CommunicationReduction reduction=CommunicationReduction::SUM)
Unpacks and reduces local subdomain boundaries.
Definition communication.hpp:672
void pack_send_and_recv_local_subdomain_boundaries(const grid::shell::DistributedDomain &domain, const GridDataType &data, SubdomainNeighborhoodSendRecvBuffer< typename GridDataType::value_type, grid::grid_data_vec_dim< GridDataType >() > &boundary_send_buffers, SubdomainNeighborhoodSendRecvBuffer< typename GridDataType::value_type, grid::grid_data_vec_dim< GridDataType >() > &boundary_recv_buffers)
Packs, sends and recvs local subdomain boundaries using two sets of buffers.
Definition communication.hpp:242
Definition boundary_mass.hpp:14
constexpr void quad_felippa_3x2_quad_weights(T(&quad_weights)[quad_felippa_3x2_num_quad_points])
Definition wedge/quadrature/quadrature.hpp:93
constexpr int quad_felippa_3x2_num_quad_points
Definition wedge/quadrature/quadrature.hpp:66
constexpr void quad_felippa_3x2_quad_points(dense::Vec< T, 3 >(&quad_points)[quad_felippa_3x2_num_quad_points])
Definition wedge/quadrature/quadrature.hpp:70
constexpr int num_nodes_per_wedge_surface
Definition kernel_helpers.hpp:6
constexpr void lateral_parts_of_grad_phi(dense::Vec< T, 3 >(&g_rad)[num_wedges_per_hex_cell][num_nodes_per_wedge][NumQuadPoints], dense::Vec< T, 3 >(&g_lat)[num_wedges_per_hex_cell][num_nodes_per_wedge][NumQuadPoints], const dense::Mat< T, 3, 3 > jac_lat_inv_t[num_wedges_per_hex_cell][NumQuadPoints], const dense::Vec< T, 3 > quad_points[NumQuadPoints])
Computes the radially independent parts of the physical shape function gradients.
Definition kernel_helpers.hpp:208
constexpr dense::Vec< T, 3 > grad_shape_full(const dense::Vec< T, 3 > g_rad[num_wedges_per_hex_cell][num_nodes_per_wedge][NumQuadPoints], const dense::Vec< T, 3 > g_lat[num_wedges_per_hex_cell][num_nodes_per_wedge][NumQuadPoints], const T r_inv, const T grad_r_inv, const int wedge_idx, const int node_idx, const int quad_point_idx)
Computes and returns J^-T grad(N_j).
Definition kernel_helpers.hpp:247
constexpr T det_full(const T det_jac_lat[num_wedges_per_hex_cell][NumQuadPoints], const T r, const T grad_r, const int wedge_idx, const int quad_point_idx)
Computes |det(J)|.
Definition kernel_helpers.hpp:270
constexpr T grad_forward_map_rad(const T r_1, const T r_2)
Definition integrands.hpp:596
constexpr void jacobian_lat_inverse_transposed_and_determinant(dense::Mat< T, 3, 3 >(&jac_lat_inv_t)[num_wedges_per_hex_cell][NumQuadPoints], T(&det_jac_lat)[num_wedges_per_hex_cell][NumQuadPoints], const dense::Vec< T, 3 > wedge_surf_phy_coords[num_wedges_per_hex_cell][num_nodes_per_wedge_surface], const dense::Vec< T, 3 > quad_points[NumQuadPoints])
Computes the transposed inverse of the Jacobian of the lateral forward map from the reference triangl...
Definition kernel_helpers.hpp:126
void wedge_surface_physical_coords(dense::Vec< T, 3 >(&wedge_surf_phy_coords)[num_wedges_per_hex_cell][num_nodes_per_wedge_surface], const grid::Grid3DDataVec< T, 3 > &lateral_grid, const int local_subdomain_id, const int x_cell, const int y_cell)
Extracts the (unit sphere) surface vertex coords of the two wedges of a hex cell.
Definition kernel_helpers.hpp:26
void atomically_add_local_wedge_vector_coefficients(const grid::Grid4DDataVec< T, VecDim > &global_coefficients, const int local_subdomain_id, const int x_cell, const int y_cell, const int r_cell, const int d, const dense::Vec< T, 6 > local_coefficients[2])
Performs an atomic add of the two local wedge coefficient vectors of a hex cell into the global coeff...
Definition kernel_helpers.hpp:465
constexpr T forward_map_rad(const T r_1, const T r_2, const T zeta)
Definition integrands.hpp:579
constexpr int num_wedges_per_hex_cell
Definition kernel_helpers.hpp:5
void extract_local_wedge_vector_coefficients(dense::Vec< T, 6 >(&local_coefficients)[2], const int local_subdomain_id, const int x_cell, const int y_cell, const int r_cell, const int d, const grid::Grid4DDataVec< T, VecDim > &global_coefficients)
Extracts the local vector coefficients for the two wedges of a hex cell from the global coefficient v...
Definition kernel_helpers.hpp:356
constexpr int num_nodes_per_wedge
Definition kernel_helpers.hpp:7
Kokkos::MDRangePolicy< Kokkos::Rank< 4 > > local_domain_md_range_policy_cells(const DistributedDomain &distributed_domain)
Definition spherical_shell.hpp:2668
Kokkos::View< ScalarType ***[VecDim], Layout > Grid3DDataVec
Definition grid_types.hpp:40
Kokkos::View< ScalarType ****[VecDim], Layout > Grid4DDataVec
Definition grid_types.hpp:43
Kokkos::View< ScalarType **, Layout > Grid2DDataScalar
Definition grid_types.hpp:19
OperatorApplyMode
Modes for applying an operator to a vector.
Definition operator.hpp:30
@ Replace
Overwrite the destination vector.
OperatorCommunicationMode
Modes for communication during operator application.
Definition operator.hpp:40
@ CommunicateAdditively
Communicate and add results.
void fill(const T value)
Definition mat.hpp:201
constexpr Mat diagonal() const
Definition mat.hpp:377
Mat & hadamard_product(const Mat &mat)
Definition mat.hpp:213