14#ifndef MIXTURE_VISCOUS_FLUX_H
15#define MIXTURE_VISCOUS_FLUX_H
17#include <Kokkos_Core.hpp>
48 Kokkos::View<rtype *[N_CONSERVATIVE]>
W;
51 Kokkos::View<double **, Kokkos::LayoutRight>
diffusion;
52 Kokkos::View<rtype **, Kokkos::LayoutRight>
values;
57 const double rho =
static_cast<double>(
W(
c, 0)), p =
static_cast<double>(
W(
c,
N_DIM + 1));
59 const double T = p / (rho * R);
66 double nu = Kokkos::fmax(4.0 / 3.0 * mu / rho,
lambda / (rho * (cp - R)));
68 nu = Kokkos::fmax(
nu,
D[k]);
91 Kokkos::View<rtype **, Kokkos::LayoutRight>
values;
92 Kokkos::View<rtype ***, Kokkos::LayoutRight>
gradients;
93 Kokkos::View<rtype **, Kokkos::LayoutRight>
bc_values;
113 if (v >= n)
continue;
175 Kokkos::View<rtype **, Kokkos::LayoutRight>
values;
180 Kokkos::View<rtype ***, Kokkos::LayoutRight>
slots;
183 Kokkos::View<rtype *[3]>
sgs;
296 q_f[k] =
bc->data[1 + k];
305 const bool les =
sgs.extent(0) > 0;
307 if (!les ||
wall)
return 0.0
_r;
347 :
static_cast<double>(
scalars(c0, k));
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_CONSERVATIVE
Definition common_typedef.h:33
#define N_CONSERVATIVE
Definition common_typedef.h:29
#define FOR_I_DIM
Definition common_typedef.h:32
Cell gradient reconstruction.
Thermally perfect gas mixture: the gas model of runs with a mechanism.
MixtureCoefficient
Columns of the per-cell transport coefficients.
Definition mixture_viscous_flux.h:27
@ NU_EFF
Definition mixture_viscous_flux.h:27
@ LAMBDA
Definition mixture_viscous_flux.h:27
@ MU
Definition mixture_viscous_flux.h:27
constexpr double GAS_CONSTANT
Definition mechanism.h:26
Reconstruction of a gas mixture's cell scalars to faces.
Kokkos::View< rtype **, Kokkos::LayoutRight > ScalarView
Cell scalars of a mixture: (cell, j) = Y_1 .. Y_Ns, gamma, e0.
Definition scalar_reconstruction.h:26
Device-copyable boundary condition.
Definition boundary.h:97
Device-side lookup from faces to boundary conditions.
Definition boundary.h:229
Kokkos::View< int32_t * > face_bc
Definition boundary.h:230
Kokkos::View< BoundaryCondition * > bcs
Definition boundary.h:249
Kokkos::View< int32_t * > face_image_face
Definition boundary.h:232
Weighted least-squares gradient of W = [rho, u, p] over face neighbors, with boundary ghost states pl...
Definition gradient.h:85
KOKKOS_INLINE_FUNCTION void neighbor(const uint32_t i_cell, const uint32_t i_face, const rtype *W_i, rtype *dx, rtype *W_j) const
Offset to and state of the neighbor across face i_face.
Definition gradient.h:114
Kokkos::View< uint32_t * > offsets_faces_of_cell
Definition gradient.h:86
Kokkos::View< uint32_t * > faces_of_cell
Definition gradient.h:87
BoundaryData boundaries
Definition gradient.h:94
Kokkos::View< int32_t *[2]> cells_of_face
Definition gradient.h:88
Kokkos::View< rtype *[N_CONSERVATIVE]> W
Definition gradient.h:95
Gradient over all vertex neighbors plus the boundary ghost states of the cell's own boundary faces,...
Definition gradient.h:233
Kokkos::View< uint32_t * > offsets_cells_of_cell
Definition gradient.h:235
Kokkos::View< uint32_t * > cells_of_cell
Definition gradient.h:236
LSQGradientFunctor faces
Definition gradient.h:234
VertexGradientWeights weights
Definition gradient.h:238
Gradients of [u, T, X_1 .. X_Ns] with the weights and stencil of the viscous gradient (LSQVertexGradi...
Definition mixture_viscous_flux.h:89
Kokkos::View< rtype ***, Kokkos::LayoutRight > gradients
Definition mixture_viscous_flux.h:92
static constexpr uint32_t CHUNK
Definition mixture_viscous_flux.h:96
KOKKOS_INLINE_FUNCTION void operator()(const uint32_t c) const
Definition mixture_viscous_flux.h:99
Kokkos::View< rtype **, Kokkos::LayoutRight > bc_values
Definition mixture_viscous_flux.h:93
uint32_t n_species
Definition mixture_viscous_flux.h:94
LSQVertexGradientFunctor stencil
Definition mixture_viscous_flux.h:90
Kokkos::View< rtype **, Kokkos::LayoutRight > values
Definition mixture_viscous_flux.h:91
Per cell: viscosity, conductivity and the time step's effective diffusivity max(4/3 mu / rho,...
Definition mixture_viscous_flux.h:46
Kokkos::View< rtype *[N_CONSERVATIVE]> W
Definition mixture_viscous_flux.h:48
Kokkos::View< double **, Kokkos::LayoutRight > diffusion
Definition mixture_viscous_flux.h:51
Kokkos::View< rtype **, Kokkos::LayoutRight > values
Definition mixture_viscous_flux.h:52
ScalarView scalars
Definition mixture_viscous_flux.h:49
Mixture gas
Definition mixture_viscous_flux.h:47
Kokkos::View< rtype *[3]> coefficients
Definition mixture_viscous_flux.h:50
KOKKOS_INLINE_FUNCTION void operator()(const uint32_t c) const
Definition mixture_viscous_flux.h:55
Geometry of an interior face: unit normal, centroid offset and its normal component.
Definition mixture_viscous_flux.h:191
int32_t c0
Definition mixture_viscous_flux.h:192
int32_t c1
Definition mixture_viscous_flux.h:192
rtype dvar
Definition mixture_viscous_flux.h:195
rtype d[N_DIM]
Definition mixture_viscous_flux.h:193
rtype d_n
Definition mixture_viscous_flux.h:193
rtype n[N_DIM]
Definition mixture_viscous_flux.h:193
rtype t
Definition mixture_viscous_flux.h:194
Diffusive fluxes of a gas mixture on every face (one-point rule), added to face_flux (momentum and en...
Definition mixture_viscous_flux.h:164
Kokkos::View< rtype *[3]> coefficients
Definition mixture_viscous_flux.h:177
ScalarView scalars
Definition mixture_viscous_flux.h:174
Kokkos::View< rtype *[3]> covariance
Definition mixture_viscous_flux.h:182
Kokkos::View< rtype *[3]> sgs
Definition mixture_viscous_flux.h:183
static constexpr uint8_t NQ
Definition mixture_viscous_flux.h:186
KOKKOS_INLINE_FUNCTION Geometry geometry(const uint32_t f) const
Definition mixture_viscous_flux.h:199
Mixture gas
Definition mixture_viscous_flux.h:173
Kokkos::View< rtype *[N_DIM]> shifts
Definition mixture_viscous_flux.h:170
Kokkos::View< rtype *[N_DIM]> cell_coords
Definition mixture_viscous_flux.h:168
bool axisymmetric
Definition mixture_viscous_flux.h:181
Kokkos::View< rtype ***, Kokkos::LayoutRight > slots
Definition mixture_viscous_flux.h:180
Kokkos::View< rtype *[N_DIM]> normals
Definition mixture_viscous_flux.h:165
BoundaryData boundaries
Definition mixture_viscous_flux.h:172
Mode
Definition mixture_viscous_flux.h:188
Kokkos::View< rtype *[N_DIM]> face_coords
Definition mixture_viscous_flux.h:167
Kokkos::View< int32_t *[2]> cells_of_face
Definition mixture_viscous_flux.h:169
Kokkos::View< rtype *[N_CONSERVATIVE]> face_flux
Definition mixture_viscous_flux.h:179
Kokkos::View< rtype **, Kokkos::LayoutRight > values
Definition mixture_viscous_flux.h:175
Kokkos::View< uint8_t * > face_shift
Definition mixture_viscous_flux.h:171
Kokkos::View< rtype * > face_area
Definition mixture_viscous_flux.h:166
bool sgs_only
Definition mixture_viscous_flux.h:184
Kokkos::View< double **, Kokkos::LayoutRight > diffusion
Definition mixture_viscous_flux.h:178
KOKKOS_INLINE_FUNCTION rtype interior(const Geometry &G, const uint32_t v, rtype *g) const
Value and gradient of variable v on an interior face.
Definition mixture_viscous_flux.h:220
Kokkos::View< rtype ***, Kokkos::LayoutRight > gradients
Definition mixture_viscous_flux.h:176
KOKKOS_INLINE_FUNCTION void operator()(const uint32_t i_face) const
Definition mixture_viscous_flux.h:243
Device side of the mixture gas model, captured by value in kernels.
Definition mixture.h:45
uint32_t n_species
Definition mixture.h:48
chemistry::ThermoTable thermo
Definition mixture.h:46
chemistry::TransportTable transport
Definition mixture.h:47
Mass fractions of a cell from its scalars, in double.
Definition mixture_viscous_flux.h:30
KOKKOS_INLINE_FUNCTION double operator()(const uint32_t k) const
Definition mixture_viscous_flux.h:32
const rtype * Y
Definition mixture_viscous_flux.h:31
Kokkos::View< rtype *[N_DIM]> cells
Definition gradient.h:218
Kokkos::View< rtype *[N_DIM]> faces
Definition gradient.h:219
KOKKOS_INLINE_FUNCTION double gas_constant(const F_Y &y) const
Mixture gas constant R_u sum_k Y_k / W_k [J/(kg K)].
Definition thermo.h:117
KOKKOS_INLINE_FUNCTION double cp_mass(const double T, const F_Y &y) const
Mixture cp [J/(kg K)].
Definition thermo.h:125
KOKKOS_INLINE_FUNCTION double h_RT(const uint32_t k, const Powers &p) const
h_k / (R T), molar enthalpy including the formation enthalpy.
Definition thermo.h:96
Kokkos::View< double *, MemorySpace > inv_W
Definition thermo.h:45
static KOKKOS_INLINE_FUNCTION Powers powers(const double T)
Definition thermo.h:59
Kokkos::View< double *, MemorySpace > W
Definition transport.h:90
KOKKOS_INLINE_FUNCTION void properties(const double T, const double p, const double rho, const double cp, const F_Y &y, double &mu, double &lambda, double *D, double *DT=nullptr) const
Mixture viscosity mu [Pa s], conductivity lambda [W/(m K)] and species diffusion coefficients D [m^2/...
Definition transport.h:139
bool thermal_diffusion
Definition transport.h:97
CellSetup< ExecSpace > c
Definition teno_setup.cpp:1810
Geometry< Space > g
Definition teno_setup.cpp:678
uint16_t ns
Definition teno_setup.cpp:688
SlotArray< double, Space > A
Definition teno_setup.cpp:478
@ DT
Definition time_integrator.h:55
Viscous (diffusive) flux functor for the Navier-Stokes equations.
KOKKOS_INLINE_FUNCTION rtype mean_offset(const rtype *g0, const rtype *g1, const rtype *d, const rtype dvar)
Part of the jump of two cell averages that comes from the cells' different spreads (variance jump dva...
Definition viscous_flux.h:82
KOKKOS_INLINE_FUNCTION rtype variance_jump(const Kokkos::View< rtype *[3]> &covariance, const int32_t c0, const int32_t c1, const rtype *d)
Axisymmetric meshes: jump from cell c0 to c1 of the cells' r-weighted variance along d (Mesh::cell_co...
Definition viscous_flux.h:58
KOKKOS_INLINE_FUNCTION void viscous_traction(const rtype mu, const rtype g[][N_DIM], const rtype *n, rtype *tau_n, const rtype hoop_divergence=0.0_r)
Viscous traction tau . n of a Newtonian fluid under Stokes' hypothesis, tau = mu (grad u + grad u^T -...
Definition viscous_flux.h:27
KOKKOS_INLINE_FUNCTION rtype hoop_divergence(const rtype r, const rtype *u, const rtype g[][N_DIM])
u_r / r at radius r for velocity u and gradient g (g[k][i] = d u_k / d x_i), with r = y: its limit d ...
Definition viscous_flux.h:49
KOKKOS_INLINE_FUNCTION rtype face_fraction(const Kokkos::View< rtype *[N_DIM]> &face_coords, const Kokkos::View< rtype *[N_DIM]> &cell_coords, const uint32_t f, const int32_t c0, const rtype *d)
Fraction along d (from the center of cell c0 to that of its neighbor) of the projection of face f's c...
Definition viscous_flux.h:93