29template <
typename ScalarT >
65template <
typename ScalarT >
74 const int fv_r_last =
static_cast< int >( data.extent( 3 ) ) - 2;
75 const int mask_r_last =
static_cast< int >( boundary_mask.extent( 3 ) ) - 1;
77 const ScalarT T_cmb = bcs.
T_cmb;
83 "apply_dirichlet_bcs",
85 KOKKOS_LAMBDA(
const int id,
const int x,
const int y,
const int r ) {
86 if ( do_cmb && r == 1 &&
util::has_flag( boundary_mask(
id, 0, 0, 0 ), Flag::CMB ) )
88 data(
id, x, y, 1 ) = T_cmb;
89 data(
id, x, y, 0 ) = T_cmb;
91 if ( do_surf && r == fv_r_last &&
util::has_flag( boundary_mask(
id, 0, 0, mask_r_last ), Flag::SURFACE ) )
93 data(
id, x, y, fv_r_last ) = T_surf;
94 data(
id, x, y, fv_r_last + 1 ) = T_surf;
101template <
typename ScalarT >
128template <
typename ScalarType,
typename Gr
idScalarType >
135 Kokkos::parallel_for(
136 "l2_project_into_fv_function",
137 Kokkos::MDRangePolicy(
141 const int local_subdomain_id,
const int hex_cell_x,
const int hex_cell_y,
const int hex_cell_r ) {
144 ScalarType quad_weights[num_quad_points];
148 ScalarType volume = 0.0;
154 wedge_phy_surf, coords_shell, local_subdomain_id, hex_cell_x - 1, hex_cell_y - 1 );
156 const auto r_1 = coords_radii( local_subdomain_id, hex_cell_r - 1 );
157 const auto r_2 = coords_radii( local_subdomain_id, hex_cell_r );
161 for (
int q = 0; q < num_quad_points; ++q )
163 const auto J =
fe::wedge::jac( wedge_phy_surf[wedge], r_1, r_2, quad_points[q] );
164 const auto det = J.det();
165 const auto abs_det = Kokkos::abs( det );
166 const auto Jw = abs_det * quad_weights[q];
167 volume = volume + Jw;
170 wedge_phy_surf[wedge][0],
171 wedge_phy_surf[wedge][1],
172 wedge_phy_surf[wedge][2],
177 quad_points[q]( 2 ) );
179 integral = integral + x * Jw;
183 for (
int d = 0; d < 3; ++d )
185 fv_grid( local_subdomain_id, hex_cell_x, hex_cell_y, hex_cell_r, d ) = integral( d ) / volume;
200template <
typename ScalarType,
typename Gr
idScalarType >
Parallel data structure organizing the thick spherical shell metadata for distributed (MPI parallel) ...
Definition spherical_shell.hpp:2518
Finite volume vector on distributed shell grid with one DoF per hex (merging 2 wedges) and ghost-laye...
Definition vector_fv.hpp:23
const grid::Grid4DDataScalar< ScalarType > & grid_data() const
Get const reference to grid data.
Definition vector_fv.hpp:145
Static assertion: VectorQ1Scalar satisfies VectorLike concept.
Definition vector_fv.hpp:170
const grid::Grid4DDataVec< ScalarType, VecDim > & grid_data() const
Get const reference to grid data.
Definition vector_fv.hpp:292
Ghost layer communication for scalar finite volume (FV) fields on the shell grid.
void update_fv_ghost_layers(const grid::shell::DistributedDomain &domain, const grid::Grid4DDataScalar< ScalarType > &data, FVGhostLayerBuffers< ScalarType > &bufs)
Fills all ghost layers of a scalar FV field from neighbouring subdomains.
Definition fv_communication.hpp:316
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 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
constexpr dense::Vec< T, 3 > forward_map(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:596
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:657
Definition conversion.hpp:13
void apply_dirichlet_bcs(grid::Grid4DDataScalar< ScalarT > data, const grid::Grid4DDataScalar< grid::shell::ShellBoundaryFlag > &boundary_mask, const DirichletBCs< ScalarT > &bcs, const grid::shell::DistributedDomain &domain)
Strongly enforce Dirichlet boundary conditions on the radial shell boundaries.
Definition helpers.hpp:66
void initialize_cell_centers(linalg::VectorFVVec< ScalarType, 3 > &dst, const grid::shell::DistributedDomain &domain, const grid::Grid3DDataVec< GridScalarType, 3 > &coords_shell, const grid::Grid2DDataScalar< GridScalarType > &coords_radii)
Computes cell center positions once and populates ghost layers via MPI communication.
Definition helpers.hpp:201
void compute_cell_centers(linalg::VectorFVVec< ScalarType, 3 > &dst, const grid::Grid3DDataVec< GridScalarType, 3 > &coords_shell, const grid::Grid2DDataScalar< GridScalarType > &coords_radii)
Computes cell centers and writes to a vector valued finite volume function.
Definition helpers.hpp:129
ShellBoundaryFlag
FlagLike that indicates boundary types for the thick spherical shell.
Definition shell/bit_masks.hpp:12
Kokkos::MDRangePolicy< Kokkos::Rank< 4 > > local_domain_md_range_policy_cells_fv_skip_ghost_layers(const DistributedDomain &distributed_domain)
Definition spherical_shell.hpp:2763
Kokkos::View< ScalarType ***[VecDim], Layout > Grid3DDataVec
Definition grid_types.hpp:42
Kokkos::View< ScalarType ****, Layout > Grid4DDataScalar
Definition grid_types.hpp:27
Kokkos::View< ScalarType **, Layout > Grid2DDataScalar
Definition grid_types.hpp:21
constexpr bool has_flag(E mask_value, E flag) noexcept
Checks if a bitmask value contains a specific flag.
Definition bit_masking.hpp:43
Constant Dirichlet boundary conditions for the inner (CMB) and outer (surface) radial boundaries of t...
Definition helpers.hpp:31
ScalarT T_cmb
Prescribed temperature at the core-mantle boundary.
Definition helpers.hpp:32
ScalarT T_surface
Prescribed temperature at the outer surface.
Definition helpers.hpp:33
bool apply_surface
Enforce surface Dirichlet BC when true.
Definition helpers.hpp:35
bool apply_cmb
Enforce CMB Dirichlet BC when true.
Definition helpers.hpp:34
auto extent(int i) const
Definition grid_types.hpp:75