16template <
typename ScalarT >
33 ScalarT zeta_boundary_;
58 , boundary_flag_( boundary_flag )
59 , zeta_boundary_( boundary_flag == grid::shell::ShellBoundaryFlag::CMB ? -1.0 : 1.0 )
60 , operator_apply_mode_( operator_apply_mode )
61 , operator_communication_mode_( operator_communication_mode )
63 , send_buffers_( domain )
64 , recv_buffers_( domain )
68 Kokkos::abort(
"BoundaryMass only implemented for 1 radial subdomain." );
86 Kokkos::MDRangePolicy< Kokkos::Rank< 4 > >(
88 {
static_cast< long long >( domain_.
subdomains().size() ),
98 Kokkos::MDRangePolicy< Kokkos::Rank< 4 > >(
99 { 0, 0, 0, domain_.
domain_info().subdomain_num_nodes_radially() - 2 },
100 {
static_cast< long long >( domain_.
subdomains().size() ),
111 std::vector< std::unique_ptr< std::array< int, 11 > > > expected_recvs_metadata;
112 std::vector< std::unique_ptr< MPI_Request > > expected_recvs_requests;
115 domain_, dst_, send_buffers_, recv_buffers_ );
120 KOKKOS_INLINE_FUNCTION
void
121 operator()(
const int local_subdomain_id,
const int x_cell,
const int y_cell,
const int r_cell )
const
134 ScalarT quad_weights[num_quad_points];
140 const ScalarT r_1 = radii_( local_subdomain_id, r_cell );
141 const ScalarT r_2 = radii_( local_subdomain_id, r_cell + 1 );
150 for (
int q = 0; q < num_quad_points; q++ )
153 wedge_phy_surf[wedge][0],
154 wedge_phy_surf[wedge][1],
155 wedge_phy_surf[wedge][2],
157 quad_points[q]( 1 ) );
160 j_lat( 0, 0 ) = j_lat_3x3( 0, 0 );
161 j_lat( 0, 1 ) = j_lat_3x3( 0, 1 );
162 j_lat( 1, 0 ) = j_lat_3x3( 1, 0 );
163 j_lat( 1, 1 ) = j_lat_3x3( 1, 1 );
164 j_lat( 2, 0 ) = j_lat_3x3( 2, 0 );
165 j_lat( 2, 1 ) = j_lat_3x3( 2, 1 );
168 const auto det = Kokkos::sqrt( Kokkos::abs( ( j_lat.transposed() * j_lat ).det() ) );
175 quad_points[q]( 0 ), quad_points[q]( 1 ), zeta_boundary_ };
180 A[wedge]( i, j ) += quad_weights[q] * ( shape_i * shape_j * det );
191 dst[0] = A[0] * src[0];
192 dst[1] = A[1] * src[1];
Definition boundary_mass.hpp:18
ScalarT ScalarType
Definition boundary_mass.hpp:22
BoundaryMass(const grid::shell::DistributedDomain &domain, const grid::Grid3DDataVec< ScalarT, 3 > &grid, const grid::Grid2DDataScalar< ScalarT > &radii, const grid::Grid4DDataScalar< grid::shell::ShellBoundaryFlag > &mask, const grid::shell::ShellBoundaryFlag boundary_flag, linalg::OperatorApplyMode operator_apply_mode=linalg::OperatorApplyMode::Replace, linalg::OperatorCommunicationMode operator_communication_mode=linalg::OperatorCommunicationMode::CommunicateAdditively)
Definition boundary_mass.hpp:45
void apply_impl(const SrcVectorType &src, DstVectorType &dst)
Definition boundary_mass.hpp:72
void operator()(const int local_subdomain_id, const int x_cell, const int y_cell, const int r_cell) const
Definition boundary_mass.hpp:121
Parallel data structure organizing the thick spherical shell metadata for distributed (MPI parallel) ...
Definition spherical_shell.hpp:2498
const std::map< SubdomainInfo, std::tuple< LocalSubdomainIdx, SubdomainNeighborhood > > & subdomains() const
Definition spherical_shell.hpp:2580
const DomainInfo & domain_info() const
Returns a const reference.
Definition spherical_shell.hpp:2577
int subdomain_num_nodes_radially() const
Equivalent to calling subdomain_num_nodes_radially( subdomain_refinement_level() )
Definition spherical_shell.hpp:861
int subdomain_num_nodes_per_side_laterally() const
Equivalent to calling subdomain_num_nodes_per_side_laterally( subdomain_refinement_level() )
Definition spherical_shell.hpp:852
int num_subdomains_in_radial_direction() const
Definition spherical_shell.hpp:849
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
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
constexpr int quad_triangle_3_num_quad_points
Definition triangle/quadrature/quadrature.hpp:8
constexpr void quad_triangle_3_quad_points(dense::Vec< T, 2 >(&quad_points)[quad_triangle_3_num_quad_points])
Definition triangle/quadrature/quadrature.hpp:12
constexpr void quad_triangle_3_quad_weights(T(&quad_weights)[quad_triangle_3_num_quad_points])
Definition triangle/quadrature/quadrature.hpp:21
Definition boundary_mass.hpp:14
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
constexpr T shape_rad(const int node_idx, const T zeta)
Radial shape function.
Definition integrands.hpp:86
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 T shape_lat(const int node_idx, const T xi, const T eta)
Lateral shape function.
Definition integrands.hpp:118
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_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
constexpr int num_nodes_per_wedge
Definition kernel_helpers.hpp:7
constexpr dense::Mat< T, 3, 3 > jac_lat(const dense::Vec< T, 3 > &p1_phy, const dense::Vec< T, 3 > &p2_phy, const dense::Vec< T, 3 > &p3_phy, const T xi, const T eta)
Definition integrands.hpp:620
ShellBoundaryFlag
FlagLike that indicates boundary types for the thick spherical shell.
Definition shell/bit_masks.hpp:12
Kokkos::View< ScalarType ***[VecDim], Layout > Grid3DDataVec
Definition grid_types.hpp:40
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.