2#include "../../quadrature/quadrature.hpp"
28template <
typename ScalarT,
int VelocityVecDim = 3 >
63 const ScalarT diffusivity,
72 , velocity_( velocity )
73 , diffusivity_( diffusivity )
74 , operator_apply_mode_( operator_apply_mode )
75 , operator_communication_mode_( operator_communication_mode )
77 , send_buffers_( domain )
78 , recv_buffers_( domain )
97 domain_, dst_, send_buffers_, recv_buffers_ );
102 KOKKOS_INLINE_FUNCTION
void
103 operator()(
const int local_subdomain_id,
const int x_cell,
const int y_cell,
const int r_cell )
const
110 const ScalarT r_1 = radii_( local_subdomain_id, r_cell );
111 const ScalarT r_2 = radii_( local_subdomain_id, r_cell + 1 );
117 ScalarT quad_weights[num_quad_points];
127 for (
int d = 0; d < VelocityVecDim; d++ )
130 vel_coeffs[d], local_subdomain_id, x_cell, y_cell, r_cell, d, vel_grid_ );
135 for (
int q = 0; q < num_quad_points; q++ )
139 const auto shape_i =
shape( i, quad_points[q] );
140 for (
int d = 0; d < VelocityVecDim; d++ )
142 vel_interp[wedge][q]( d ) += vel_coeffs[d][wedge]( i ) * shape_i;
156 for (
int q = 0; q < num_quad_points; q++ )
160 const auto shape_i =
shape( i, quad_points[q] );
161 f_interp[wedge][q] += f_coeffs[wedge]( i ) * shape_i;
171 const auto h = r_2 - r_1;
175 ScalarT tau_accum = 0.0;
176 ScalarT waccum = 0.0;
178 for (
int q = 0; q < num_quad_points; ++q )
181 const auto& uq = vel_interp[wedge][q];
182 const ScalarT vel_norm_q = uq.
norm();
184 const ScalarT tau_q = operators::shell::supg_tau< ScalarT >( vel_norm_q, diffusivity_, h, 1e-08 );
187 const ScalarT wq = quad_weights[q];
188 tau_accum += tau_q * wq;
193 ScalarT tau_cell = ( waccum > 0.0 ) ? ( tau_accum / waccum ) : 0.0;
194 streamline_diffusivity[wedge] = tau_cell;
200 for (
int q = 0; q < num_quad_points; q++ )
202 const auto w = quad_weights[q];
206 const auto J =
jac( wedge_phy_surf[wedge], r_1, r_2, quad_points[q] );
207 const auto det = Kokkos::abs( J.det() );
208 const auto J_inv_transposed = J.inv().transposed();
212 const auto shape_i =
shape( i, quad_points[q] );
213 const auto grad_i = J_inv_transposed *
grad_shape( i, quad_points[q] );
215 contrib[wedge]( i ) += w * streamline_diffusivity[wedge] * vel_interp[wedge][q].dot( grad_i ) *
216 f_interp[wedge][q] * det;
Parallel data structure organizing the thick spherical shell metadata for distributed (MPI parallel) ...
Definition spherical_shell.hpp:2498
Q1 scalar finite element vector on a distributed shell grid.
Definition vector_q1.hpp:21
const grid::Grid4DDataScalar< ScalarType > & grid_data() const
Get const reference to grid data.
Definition vector_q1.hpp:137
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
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
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
void atomically_add_local_wedge_scalar_coefficients(const grid::Grid4DDataScalar< T > &global_coefficients, const int local_subdomain_id, const int x_cell, const int y_cell, const int r_cell, 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:407
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
constexpr int num_wedges_per_hex_cell
Definition kernel_helpers.hpp:5
void extract_local_wedge_scalar_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 grid::Grid4DDataScalar< T > &global_coefficients)
Extracts the local vector coefficients for the two wedges of a hex cell from the global coefficient v...
Definition kernel_helpers.hpp:306
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
constexpr dense::Vec< T, 3 > grad_shape(const int node_idx, const T xi, const T eta, const T zeta)
Gradient of the full shape function:
Definition integrands.hpp:228
constexpr T shape(const int node_idx, const T xi, const T eta, const T zeta)
(Tensor-product) Shape function.
Definition integrands.hpp:146
constexpr dense::Mat< T, 3, 3 > jac(const dense::Vec< T, 3 > &p1_phy, const dense::Vec< T, 3 > &p2_phy, const dense::Vec< T, 3 > &p3_phy, const T r_1, const T r_2, const T xi, const T eta, const T zeta)
Definition integrands.hpp:643
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 > Grid4DDataScalar
Definition grid_types.hpp:25
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.
T norm() const
Definition vec.hpp:76