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

High-order TENO-E reconstruction on unstructured meshes (Liang, Shyy & Fu, J. Sci. Comput. 104:1, 2025; see docs/numerics/teno_e.md). More...

#include <face_reconstruction.h>

Inheritance diagram for TENO:
FaceReconstruction

Classes

struct  Stencils
 Stencil cells and mirror faces of every reconstructed cell, row by row (host copy, for diagnostics). More...
 

Public Member Functions

 TENO ()
 
 ~TENO ()
 
void init (const toml::value &input) override
 Initialize the face reconstruction.
 
logging::Items summary () const override
 Display lines for the run log.
 
uint8_t n_face_quadrature_points () const override
 Get the number of quadrature points per face.
 
void calc_face_values (Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution) override
 Reconstruct the face values.
 
std::vector< uint32_t > cells_independent_of_halo (uint32_t n_owned) const override
 Cells below n_owned whose reconstruction reads no cell at or above n_owned, so that calc_cell_face_values can reconstruct them before the halo is filled. Empty if this reconstruction cannot be split by cells.
 
void calc_cell_face_values (const Kokkos::DefaultExecutionSpace &exec, Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution, Kokkos::View< uint32_t * > cells) override
 Reconstruct the listed cells' sides of their faces, on the given execution space instance, as far as each cell can on its own (see cells_independent_of_halo()). Once every reconstructed cell went through this and those instances are fenced, finish_cell_face_values() completes the face values.
 
void finish_cell_face_values (Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution) override
 Complete the face values after calc_cell_face_values().
 
bool cell_gradients (Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype *[N_CONSERVATIVE][N_DIM]> gradients, uint32_t n_cells) override
 Gradients of W = [rho, u, p] at the centroids of the first n_cells cells from the reconstruction polynomials, if the scheme has higher-order ones than least squares on face neighbors.
 
void axisymmetric_source (Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype *, Kokkos::LayoutStride > mu, Kokkos::View< rtype * > source, uint32_t n_cells) override
 Axisymmetric runs: for each of the first n_cells cells whose reconstruction has a smooth polynomial, replace source(c) by int (p - tau_thetatheta) dA over the planar cell, with p and the velocity of the polynomial at cell quadrature points and the cell viscosity mu(c) (inviscid if mu is empty). Other cells keep their source, which the caller set from cell values.
 
Stencils large_stencils () const
 
std::vector< uint8_t > stencil_cells () const
 Local cells that some stencil (central or sector) of a reconstructed cell reads.
 
std::array< double, 9 > stencil_metric (uint32_t i) const
 Metric (3 x 3, row-major) in which the stencil candidates of cell i are ranked by distance (3D): the identity unless the mesh spacing around the cell is markedly anisotropic.
 
void save_cache (uint8_t halo_layers=0)
 Write the precomputed data to the cache file, unless init() loaded it from there. A distributed run calls this once its halo is final, with its halo layers.
 
void rebuild_cells (const std::vector< uint32_t > &cells)
 Recompute the tables of the given reconstructed cells and keep every other cell's, after the mesh geometry changed (node coordinates moved, geometry recomputed and on the device). Each cell's tables are a function of the mesh alone, so with the cells of cells_within_reach() the result is bitwise that of a full setup.
 
std::vector< uint32_t > cells_within_reach (const std::vector< uint32_t > &changed) const
 Reconstructed cells whose stencil searches reach any of the given cells (within their gather_depth vertex-neighbor layers), i.e. whose tables depend on those cells' geometry.
 
void set_mixture (Kokkos::View< rtype *, Kokkos::LayoutStride > gamma, Kokkos::View< rtype * > molar_mass)
 Switch to the mixture variant with these per-cell views (filled every stage).
 
- Public Member Functions inherited from FaceReconstruction
 FaceReconstruction ()
 Construct a new Face Reconstruction object.
 
virtual ~FaceReconstruction ()
 Destroy the Face Reconstruction object.
 
void set_mesh (std::shared_ptr< Mesh > mesh)
 Set the mesh.
 
void set_boundaries (const BoundaryData &boundaries)
 Set the boundary data used for ghost states.
 
FaceReconstructionType get_type () const
 Get the face reconstruction type.
 
void init_face_quadrature_3d (uint8_t degree)
 Set up per-face quadrature (3D): Dunavant rules on triangles and Gauss rules mapped bilinearly onto quadrilaterals, exact for polynomials of the given degree on planar faces (degree <= 1 uses the face centroid). Also maps each quadrature point of a transmissive boundary face to the matching point of its image face (BoundaryData::face_image_quad).
 
void init_face_quadrature_2d_curved ()
 Curved meshes in 2D: per-face quadrature points, weights and normals for quadrature_face's Gauss rule on every face, the curved faces' mapped onto their curves (nothing otherwise).
 

Static Public Member Functions

static uint8_t cached_halo_layers (const toml::value &input)
 Halo layers recorded in this rank's cache file (0 if there is none, or it was made with other TENO options or rank count), so a distributed run can build its halo at that depth at once.
 

Public Attributes

uint8_t degree = 4
 
uint8_t n_dof_large = 0
 
uint16_t n_stencil_large = 0
 
uint16_t n_stencil_small = 10
 
rtype stencil_factor = 2.0
 
rtype sigma_threshold = 1.0e-3_r
 
rtype sigma_upper = 1.0e-2_r
 
rtype C_T = -1.0
 
bool characteristic = true
 
bool bound_preserving = false
 
bool curved_mirrors = false
 
uint8_t curved_wall_degree = 3
 
rtype max_condition = 1.0e8
 
uint8_t slice_shift = teno::SLICE_SHIFT
 
bool single_tables = false
 
Kokkos::View< rtype * > scale
 
Kokkos::View< rtype ** > basis_mean
 
Kokkos::View< uint16_t * > stencil_large_size
 
teno::PackedStencils stencil_large
 
Kokkos::View< uint16_t ** > stencil_small_size
 
teno::PackedStencils stencil_small
 
Kokkos::View< rtype ** > si_matrix
 
teno::Moments moments
 
teno::SmoothnessTerms si_terms
 
Kokkos::View< rtype * > troubled
 
Kokkos::View< rtype *** > troubled_coeffs
 
Kokkos::View< rtype **** > troubled_small_coeffs
 
rtype troubled_capacity = N_DIM == 3 ? 0.5 : 1.0
 
Kokkos::View< uint32_t * > troubled_cells
 
Kokkos::View< uint32_t > n_troubled
 
std::vector< uint8_t > gather_depth
 
Kokkos::View< rtype *[3]> cell_rule
 
std::vector< std::shared_ptr< GrowingBuffer > > table_memory
 
bool setup_on_host = false
 
uint32_t setup_batch_cells = 0
 
bool primitive = false
 
Kokkos::View< rtype *, Kokkos::LayoutStride > cell_gamma
 
Kokkos::View< rtype * > cell_molar_mass
 
Kokkos::View< uint8_t ** > selection
 
- Public Attributes inherited from FaceReconstruction
Quadrature quadrature_face
 
Kokkos::View< rtype *** > face_quad_points
 
Kokkos::View< rtype ** > face_quad_weights
 
Kokkos::View< rtype *** > face_quad_normals
 

Static Public Attributes

static constexpr uint8_t SELECT_LARGE = 0xFF
 

Additional Inherited Members

- Protected Attributes inherited from FaceReconstruction
FaceReconstructionType type
 
std::shared_ptr< Mesh > mesh
 
BoundaryData boundaries
 

Detailed Description

High-order TENO-E reconstruction on unstructured meshes (Liang, Shyy & Fu, J. Sci. Comput. 104:1, 2025; see docs/numerics/teno_e.md).

Each cell carries one large central stencil (degree r) and one small degree-2 sector stencil per face. Cells flagged smooth by a density-based indicator use the large-stencil polynomial directly on the conservative variables; troubled cells perform TENO stencil selection on characteristic variables per face. Works on triangles and quadrilaterals.

Constructor & Destructor Documentation

◆ TENO()

TENO::TENO ( )

◆ ~TENO()

TENO::~TENO ( )

Member Function Documentation

◆ axisymmetric_source()

void TENO::axisymmetric_source ( Kokkos::View< rtype *[N_CONSERVATIVE]>  ,
Kokkos::View< rtype *, Kokkos::LayoutStride >  ,
Kokkos::View< rtype * >  ,
uint32_t   
)
overridevirtual

Axisymmetric runs: for each of the first n_cells cells whose reconstruction has a smooth polynomial, replace source(c) by int (p - tau_thetatheta) dA over the planar cell, with p and the velocity of the polynomial at cell quadrature points and the cell viscosity mu(c) (inviscid if mu is empty). Other cells keep their source, which the caller set from cell values.

Reimplemented from FaceReconstruction.

◆ cached_halo_layers()

uint8_t TENO::cached_halo_layers ( const toml::value &  input)
static

Halo layers recorded in this rank's cache file (0 if there is none, or it was made with other TENO options or rank count), so a distributed run can build its halo at that depth at once.

◆ calc_cell_face_values()

void TENO::calc_cell_face_values ( const Kokkos::DefaultExecutionSpace &  exec,
Kokkos::View< rtype *[N_CONSERVATIVE]>  solution,
Kokkos::View< rtype **[2][N_CONSERVATIVE]>  face_solution,
Kokkos::View< uint32_t * >  cells 
)
overridevirtual

Reconstruct the listed cells' sides of their faces, on the given execution space instance, as far as each cell can on its own (see cells_independent_of_halo()). Once every reconstructed cell went through this and those instances are fenced, finish_cell_face_values() completes the face values.

Parameters
execExecution space instance to launch on.
solutionCell states W = [rho, u_x, u_y, p].
face_solutionFace states W, as in calc_face_values.
cellsLocal cells to reconstruct (not empty).

Reimplemented from FaceReconstruction.

◆ calc_face_values()

void TENO::calc_face_values ( Kokkos::View< rtype *[N_CONSERVATIVE]>  solution,
Kokkos::View< rtype **[2][N_CONSERVATIVE]>  face_solution 
)
overridevirtual

Reconstruct the face values.

Parameters
solutionCell states W = [rho, u_x, u_y, p].
face_solutionFace states W, indexed (face, quadrature point, side, variable). Side 1 of boundary faces is left untouched.

Implements FaceReconstruction.

◆ cell_gradients()

bool TENO::cell_gradients ( Kokkos::View< rtype *[N_CONSERVATIVE]>  ,
Kokkos::View< rtype *[N_CONSERVATIVE][N_DIM]>  ,
uint32_t   
)
overridevirtual

Gradients of W = [rho, u, p] at the centroids of the first n_cells cells from the reconstruction polynomials, if the scheme has higher-order ones than least squares on face neighbors.

Returns
Whether gradients were written.

Reimplemented from FaceReconstruction.

◆ cells_independent_of_halo()

std::vector< uint32_t > TENO::cells_independent_of_halo ( uint32_t  n_owned) const
overridevirtual

Cells below n_owned whose reconstruction reads no cell at or above n_owned, so that calc_cell_face_values can reconstruct them before the halo is filled. Empty if this reconstruction cannot be split by cells.

Reimplemented from FaceReconstruction.

◆ cells_within_reach()

std::vector< uint32_t > TENO::cells_within_reach ( const std::vector< uint32_t > &  changed) const

Reconstructed cells whose stencil searches reach any of the given cells (within their gather_depth vertex-neighbor layers), i.e. whose tables depend on those cells' geometry.

◆ finish_cell_face_values()

void TENO::finish_cell_face_values ( Kokkos::View< rtype *[N_CONSERVATIVE]>  solution,
Kokkos::View< rtype **[2][N_CONSERVATIVE]>  face_solution 
)
overridevirtual

Complete the face values after calc_cell_face_values().

Reimplemented from FaceReconstruction.

◆ init()

void TENO::init ( const toml::value &  input)
overridevirtual

Initialize the face reconstruction.

Implements FaceReconstruction.

◆ large_stencils()

TENO::Stencils TENO::large_stencils ( ) const

◆ n_face_quadrature_points()

uint8_t TENO::n_face_quadrature_points ( ) const
overridevirtual

Get the number of quadrature points per face.

Returns
Number of quadrature points per face.

Implements FaceReconstruction.

◆ rebuild_cells()

void TENO::rebuild_cells ( const std::vector< uint32_t > &  cells)

Recompute the tables of the given reconstructed cells and keep every other cell's, after the mesh geometry changed (node coordinates moved, geometry recomputed and on the device). Each cell's tables are a function of the mesh alone, so with the cells of cells_within_reach() the result is bitwise that of a full setup.

◆ save_cache()

void TENO::save_cache ( uint8_t  halo_layers = 0)

Write the precomputed data to the cache file, unless init() loaded it from there. A distributed run calls this once its halo is final, with its halo layers.

◆ set_mixture()

void TENO::set_mixture ( Kokkos::View< rtype *, Kokkos::LayoutStride >  gamma,
Kokkos::View< rtype * >  molar_mass 
)

Switch to the mixture variant with these per-cell views (filled every stage).

◆ stencil_cells()

std::vector< uint8_t > TENO::stencil_cells ( ) const

Local cells that some stencil (central or sector) of a reconstructed cell reads.

◆ stencil_metric()

std::array< double, 9 > TENO::stencil_metric ( uint32_t  i) const

Metric (3 x 3, row-major) in which the stencil candidates of cell i are ranked by distance (3D): the identity unless the mesh spacing around the cell is markedly anisotropic.

◆ summary()

logging::Items TENO::summary ( ) const
overridevirtual

Display lines for the run log.

Reimplemented from FaceReconstruction.

Member Data Documentation

◆ basis_mean

Kokkos::View<rtype **> TENO::basis_mean

◆ bound_preserving

bool TENO::bound_preserving = false

◆ C_T

rtype TENO::C_T = -1.0

◆ cell_gamma

Kokkos::View<rtype *, Kokkos::LayoutStride> TENO::cell_gamma

◆ cell_molar_mass

Kokkos::View<rtype *> TENO::cell_molar_mass

◆ cell_rule

Kokkos::View<rtype *[3]> TENO::cell_rule

◆ characteristic

bool TENO::characteristic = true

◆ curved_mirrors

bool TENO::curved_mirrors = false

◆ curved_wall_degree

uint8_t TENO::curved_wall_degree = 3

◆ degree

uint8_t TENO::degree = 4

◆ gather_depth

std::vector<uint8_t> TENO::gather_depth

◆ max_condition

rtype TENO::max_condition = 1.0e8

◆ moments

teno::Moments TENO::moments

◆ n_dof_large

uint8_t TENO::n_dof_large = 0

◆ n_stencil_large

uint16_t TENO::n_stencil_large = 0

◆ n_stencil_small

uint16_t TENO::n_stencil_small = 10

◆ n_troubled

Kokkos::View<uint32_t> TENO::n_troubled

◆ primitive

bool TENO::primitive = false

◆ scale

Kokkos::View<rtype *> TENO::scale

◆ SELECT_LARGE

constexpr uint8_t TENO::SELECT_LARGE = 0xFF
staticconstexpr

◆ selection

Kokkos::View<uint8_t **> TENO::selection

◆ setup_batch_cells

uint32_t TENO::setup_batch_cells = 0

◆ setup_on_host

bool TENO::setup_on_host = false

◆ si_matrix

Kokkos::View<rtype **> TENO::si_matrix

◆ si_terms

teno::SmoothnessTerms TENO::si_terms

◆ sigma_threshold

rtype TENO::sigma_threshold = 1.0e-3_r

◆ sigma_upper

rtype TENO::sigma_upper = 1.0e-2_r

◆ single_tables

bool TENO::single_tables = false

◆ slice_shift

uint8_t TENO::slice_shift = teno::SLICE_SHIFT

◆ stencil_factor

rtype TENO::stencil_factor = 2.0

◆ stencil_large

teno::PackedStencils TENO::stencil_large

◆ stencil_large_size

Kokkos::View<uint16_t *> TENO::stencil_large_size

◆ stencil_small

teno::PackedStencils TENO::stencil_small

◆ stencil_small_size

Kokkos::View<uint16_t **> TENO::stencil_small_size

◆ table_memory

std::vector<std::shared_ptr<GrowingBuffer> > TENO::table_memory

◆ troubled

Kokkos::View<rtype *> TENO::troubled

◆ troubled_capacity

rtype TENO::troubled_capacity = N_DIM == 3 ? 0.5 : 1.0

◆ troubled_cells

Kokkos::View<uint32_t *> TENO::troubled_cells

◆ troubled_coeffs

Kokkos::View<rtype ***> TENO::troubled_coeffs

◆ troubled_small_coeffs

Kokkos::View<rtype ****> TENO::troubled_small_coeffs

The documentation for this class was generated from the following files: