Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
teno.h File Reference

Device helpers for the TENO-E reconstruction. More...

#include <Kokkos_Core.hpp>
#include "common.h"

Go to the source code of this file.

Classes

struct  teno::PackedStencils
 Per-cell stencils of different sizes, stored without padding to the largest one in the mesh. Slot s of a cell's stencil holds the stencil cell, its mirror boundary face (or -1) and width pseudo-inverse entries. Consecutive cells form slices of 2^shift cells; a slice is padded to its largest stencil and interleaves its cells' slots. With single, pinv holds the pseudo-inverse entries as floats, two to an element, at the same indices. More...
 
struct  teno::PackedStencils::RowT< T >
 One cell's stencil, resolved once per cell, for pseudo-inverse entries of type T. More...
 
struct  teno::SmoothnessTerms
 The terms of the smoothness-indicator matrix (3D): entry e (upper_index(l, m)) is sum_t weight(t) moments(cell, moment(t)) over t in [start(e), start(e + 1)), with products of D^beta factors (whole numbers below 2^16) as weights; term(t) holds weight(t) << 16 | moment(t). More...
 

Namespaces

namespace  teno
 

Typedefs

using teno::Moments = Kokkos::View< double **, Kokkos::LayoutRight >
 (cell, k): central moments of each cell, mean of ((x - x_c) / h_c)^a ... (3D).
 

Functions

KOKKOS_INLINE_FUNCTION constexpr uint8_t teno::n_dof (const uint8_t r)
 Number of non-constant N_DIM-variate monomials of total degree <= r.
 
KOKKOS_INLINE_FUNCTION constexpr uint16_t teno::upper_index (const uint8_t l, const uint8_t m, const uint8_t n)
 Index of entry (l, m), l <= m, of a symmetric n x n matrix stored as its upper triangle, row by row.
 
KOKKOS_INLINE_FUNCTION void teno::exponents (const uint8_t l, uint8_t &a, uint8_t &b)
 Exponents (a, b) of the l-th monomial xi^a eta^b, ordered by total degree: (1,0), (0,1), (2,0), (1,1), (0,2), (3,0), ...
 
KOKKOS_INLINE_FUNCTION void teno::exponents (const uint8_t l, uint8_t &a, uint8_t &b, uint8_t &c)
 Exponents (a, b, c) of the l-th trivariate monomial xi^a eta^b zeta^c, ordered by total degree, then by decreasing a, then decreasing b: (1,0,0), (0,1,0), (0,0,1), (2,0,0), (1,1,0), (1,0,1), (0,2,0), ...
 
template<typename T >
KOKKOS_INLINE_FUNCTION T teno::ipow (const T x, const uint8_t n)
 
template<typename T >
KOKKOS_INLINE_FUNCTION void teno::monomials (const uint8_t r, const T xi, const T eta, T *phi)
 Evaluate all monomials of degree 1..r at (xi, eta).
 
template<typename T >
KOKKOS_INLINE_FUNCTION void teno::monomial_gradients (const uint8_t r, const T xi, const T eta, T *d_xi, T *d_eta)
 Derivatives with respect to xi and eta of all monomials of degree 1..r at (xi, eta).
 
template<typename T >
KOKKOS_INLINE_FUNCTION void teno::monomials (const uint8_t r, const T xi, const T eta, const T zeta, T *phi)
 Evaluate all trivariate monomials of degree 1..r at (xi, eta, zeta).
 
template<typename T >
KOKKOS_INLINE_FUNCTION void teno::monomials (const uint8_t r, const T *x, T *phi)
 Monomials at a point x (N_DIM coordinates, already scaled).
 
KOKKOS_INLINE_FUNCTION void teno::eigenvectors (const rtype *W, const rtype *n, const rtype gamma, rtype L[N_CONSERVATIVE][N_CONSERVATIVE], rtype R[N_CONSERVATIVE][N_CONSERVATIVE])
 Left (L) and right (R) eigenvectors of the Euler flux Jacobian in direction n for conservative variables, at state W = [rho, u, p]. Characteristic order: u_n - a, u_n (entropy), u_n + a, then one u_n (shear) wave per tangent of tangent_basis(n).
 
KOKKOS_INLINE_FUNCTION void teno::primitive_eigenvectors (const rtype *W, const rtype a, const rtype *n, rtype L[N_CONSERVATIVE][N_CONSERVATIVE], rtype R[N_CONSERVATIVE][N_CONSERVATIVE])
 Left (L) and right (R) eigenvectors of the Euler equations in primitive variables W = [rho, u, p] in direction n, for sound speed a: valid for any equation of state. Same characteristic order as eigenvectors(): u_n - a, u_n (entropy, here the density at fixed p and u), u_n + a, then the shear waves.
 
KOKKOS_INLINE_FUNCTION rtype teno::adaptive_CT (const rtype sigma, const rtype sigma_L, const rtype sigma_U)
 Adaptive cutoff C_T from the troubled-cell measure sigma (Liang, Shyy & Fu 2025): 1e-10 near sigma_L, 1e-6 above sigma_U.
 

Variables

constexpr uint8_t teno::MAX_DEGREE = 5
 
constexpr uint8_t teno::MAX_NK = n_dof(MAX_DEGREE)
 
constexpr uint8_t teno::NK_SMALL = n_dof(2)
 
constexpr uint8_t teno::MAX_FACES = (N_DIM == 2) ? 4 : 6
 
constexpr uint8_t teno::MAX_FACE_QUAD = (N_DIM == 2) ? 4 : 9
 
constexpr uint8_t teno::SLICE_SHIFT
 log2 of the cells per slice of PackedStencils: 32 on GPUs, so that a warp reads consecutive words, and 1 on the host, where each cell's stencil is then contiguous.
 

Detailed Description

Device helpers for the TENO-E reconstruction.

Author
Matthew Bonanni (mbona.nosp@m.nni0.nosp@m.01@gm.nosp@m.ail..nosp@m.com)
Version
0.2
Date
2026-10-02