16#include <unordered_map>
19#include <Kokkos_Core.hpp>
41static const std::unordered_map<std::string, BoundaryType> BOUNDARY_TYPES = {
56static const std::unordered_map<BoundaryType, std::string> BOUNDARY_NAMES = {
112 KOKKOS_INLINE_FUNCTION
118 KOKKOS_INLINE_FUNCTION
124 KOKKOS_INLINE_FUNCTION
143 KOKKOS_INLINE_FUNCTION
145 const bool viscous,
rtype * W_g)
const {
146 constexpr uint8_t E =
N_DIM + 1;
147 for (uint8_t i = 0; i <
N_DIM + 2; i++) W_g[i] = W_i[i];
184 if (Kokkos::fabs(
u_n) >=
a_i) {
249 Kokkos::View<BoundaryCondition *>
bcs;
257 Kokkos::View<rtype **, Kokkos::LayoutRight>
bc_Y;
270 template <
typename T_W,
typename T_F,
typename T_FT,
typename T_CT>
277 const bool characteristic =
bc.is_characteristic();
286 if constexpr (
N_DIM == 2) {
295 }
else if (
image >= 0) {
309 if (!characteristic)
return;
333 template <
typename T_W,
typename T_F>
348 template <
typename T_W,
typename T_F>
357 if constexpr (
N_DIM == 2) {
365 }
else if (
image >= 0) {
433 const rtype a_T = (
bc.relax[Relax::TEMPERATURE] < 0.0
_r)
434 ? 1.0
_r : Kokkos::fmin(1.0
_r,
hc_u *
bc.relax[Relax::TEMPERATURE]);
436 ? 1.0
_r : Kokkos::fmin(1.0
_r,
hc_u *
bc.relax[Relax::TANGENTIAL]);
496 const std::vector<BoundaryCondition> &
h_bcs,
497 rtype gamma,
rtype R = 1.0,
bool viscous =
false,
BoundaryData make_boundary_data(const Mesh &mesh, const std::vector< int32_t > &h_face_bc, const std::vector< BoundaryCondition > &h_bcs, rtype gamma, rtype R=1.0, bool viscous=false, const Euler &gas=Euler())
Build BoundaryData (face -> condition map and transmissive image cells) on the host and copy it to th...
Definition boundary.cpp:180
BoundaryType
Definition boundary.h:25
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
float rtype
Definition common_typedef.h:39
#define N_DIM
Definition common_typedef.h:28
#define FOR_I_DIM
Definition common_typedef.h:32
Physics model declaration.
Device-copyable boundary condition.
Definition boundary.h:97
BoundaryType type
Definition boundary.h:108
rtype relax[N_RELAX]
Definition boundary.h:110
Relax
Entries of relax: relaxation rates over the sound speed are sigma / L (1/length).
Definition boundary.h:99
@ BETA
Definition boundary.h:103
@ ACOUSTIC
Definition boundary.h:100
@ TANGENTIAL
Definition boundary.h:102
@ T_TARGET
Definition boundary.h:104
@ N_RELAX
Definition boundary.h:105
@ TEMPERATURE
Definition boundary.h:101
static BoundaryCondition from_input(const toml::value &input, const Euler &physics)
Parse a [[boundaries]] table entry.
Definition boundary.cpp:27
KOKKOS_INLINE_FUNCTION bool is_characteristic() const
Definition boundary.h:119
KOKKOS_INLINE_FUNCTION void ghost_W(const rtype *W_i, const rtype *n, const rtype gamma, const rtype R, const bool viscous, rtype *W_g) const
Ghost state W_g = [rho, u, p] given the interior state W_i.
Definition boundary.h:144
rtype data[N_DIM+2]
Definition boundary.h:109
KOKKOS_INLINE_FUNCTION bool is_transmissive() const
Whether the exterior state is transmissive away from the Riemann solver (image faces).
Definition boundary.h:125
KOKKOS_INLINE_FUNCTION bool is_wall() const
Definition boundary.h:113
Device-side lookup from faces to boundary conditions.
Definition boundary.h:229
KOKKOS_INLINE_FUNCTION void exterior_mixture(const uint32_t i_face, const uint8_t i_quad, const uint8_t n_quad, const rtype *W_i, const rtype *th_i, const rtype *n, const T_W &W_cells, const T_F &face_solution, const T_FT &face_thermo, const T_CT &cell_thermo, rtype *W_g, rtype *th_g) const
Exterior state of a gas mixture on boundary face i_face: W as in exterior_W (with the interior gamma ...
Definition boundary.h:272
Kokkos::View< rtype *[N_DIM]> char_target
Definition boundary.h:243
Kokkos::View< uint8_t ** > face_image_quad
Definition boundary.h:235
Kokkos::View< int32_t * > face_bc
Definition boundary.h:230
rtype gravity[N_DIM]
Definition boundary.h:254
Kokkos::View< rtype *[3]> char_transverse
Definition boundary.h:241
Kokkos::View< rtype * > char_depth
Definition boundary.h:240
Kokkos::View< int32_t * > face_image
Definition boundary.h:231
KOKKOS_INLINE_FUNCTION void transmissive_W(const uint32_t i_face, const uint8_t i_quad, const uint8_t n_quad, const rtype *W_i, const rtype *n, const T_W &W_cells, const T_F &face_solution, rtype *W_g) const
Exterior state of exterior_W before the characteristic treatment.
Definition boundary.h:350
Kokkos::View< rtype *[N_DIM]> char_target_next
Definition boundary.h:244
KOKKOS_INLINE_FUNCTION GhostEntropy characteristic_W(const uint32_t i_face, const rtype *W_l, const rtype *W_e, const rtype *n, const rtype gamma_l, rtype *W_g) const
Characteristic (NSCBC) exterior state of boundary face i_face for the Riemann solver (docs/design/nsc...
Definition boundary.h:389
Kokkos::View< rtype *[2]> char_state
Definition boundary.h:242
bool viscous
Definition boundary.h:252
KOKKOS_INLINE_FUNCTION void ghost_W(const uint32_t i_face, const rtype *W_i, const rtype *n, rtype *W_g) const
Ghost state for boundary face i_face.
Definition boundary.h:471
Kokkos::View< uint32_t * > char_faces
Definition boundary.h:239
KOKKOS_INLINE_FUNCTION void ghost_W_at(const uint32_t i_face, const rtype *W_i, const rtype *n, const rtype dist, rtype *W_g) const
Ghost state for a point a distance dist outside boundary face i_face (the mirror image of an interior...
Definition boundary.h:458
Kokkos::View< uint8_t * > char_edge
Definition boundary.h:248
Kokkos::View< rtype **, Kokkos::LayoutRight > bc_Y
Definition boundary.h:257
Kokkos::View< rtype *[N_DIM]> char_neighbor_dx
Definition boundary.h:247
Kokkos::View< BoundaryCondition * > bcs
Definition boundary.h:249
Kokkos::View< uint8_t * > face_image_side
Definition boundary.h:233
KOKKOS_INLINE_FUNCTION void exterior_W(const uint32_t i_face, const uint8_t i_quad, const uint8_t n_quad, const rtype *W_i, const rtype *n, const T_W &W_cells, const T_F &face_solution, rtype *W_g) const
Exterior state seen by the Riemann solver on boundary face i_face.
Definition boundary.h:335
Kokkos::View< int32_t * > face_image_face
Definition boundary.h:232
Kokkos::View< rtype *[N_DIM+2]> face_state
Definition boundary.h:237
Kokkos::View< uint8_t * > face_image_flip
Definition boundary.h:234
Euler gas
Definition boundary.h:253
rtype gamma
Definition boundary.h:250
Kokkos::View< uint32_t * > char_offsets
Definition boundary.h:245
Kokkos::View< uint32_t * > char_neighbors
Definition boundary.h:246
rtype R
Definition boundary.h:251
Kokkos::View< rtype *[2]> bc_thermo
Definition boundary.h:258
Kokkos::View< int32_t * > face_char
Definition boundary.h:238
Kokkos::View< int32_t * > face_state_index
Definition boundary.h:236
GhostEntropy
Where the entropy of a characteristic ghost state comes from.
Definition boundary.h:373
Calorically perfect gas, inviscid (Euler) or viscous and heat conducting (Navier-Stokes,...
Definition physics.h:54
CellSetup< ExecSpace > c
Definition teno_setup.cpp:1810