12#ifndef FACE_RECONSTRUCTION_H
13#define FACE_RECONSTRUCTION_H
17#include <unordered_map>
36static const std::unordered_map<std::string, FaceReconstructionType> FACE_RECONSTRUCTION_TYPES = {
42static const std::unordered_map<FaceReconstructionType, std::string> FACE_RECONSTRUCTION_NAMES = {
68 virtual void init(
const toml::value & input) = 0;
130 Kokkos::View<uint32_t *>
cells);
157 Kokkos::View<rtype *, Kokkos::LayoutStride> ,
158 Kokkos::View<rtype *> ,
uint32_t ) {}
206 void init(
const toml::value & input)
override;
232static const std::unordered_map<std::string, LimiterType> LIMITER_TYPES = {
238static const std::unordered_map<LimiterType, std::string> LIMITER_NAMES = {
252 void init(
const toml::value & input)
override;
261 Kokkos::View<uint32_t *>
cells)
override;
286 void init(
const toml::value & input)
override;
295 Kokkos::View<uint32_t *>
cells)
override;
301 Kokkos::View<rtype *, Kokkos::LayoutStride> mu, Kokkos::View<rtype *> source,
422 void set_mixture(Kokkos::View<rtype *, Kokkos::LayoutStride> gamma, Kokkos::View<rtype *> molar_mass);
425 template <u
int8_t DEG,
bool PRIM,
typename TABLE>
426 void launch_source(Kokkos::View<
rtype *[
N_CONSERVATIVE]> solution, Kokkos::View<rtype *, Kokkos::LayoutStride> mu,
427 Kokkos::View<rtype *> source,
uint32_t n_cells);
428 template <u
int8_t DEG,
bool PRIM,
typename TABLE>
431 template <u
int8_t DEG,
bool PRIM,
typename TABLE>
432 void launch_reconstruction(
const Kokkos::DefaultExecutionSpace &
exec,
440 void read_options(
const toml::value & input);
441 void compute_stencils_and_matrices(
const std::vector<uint32_t> *
subset =
nullptr);
442 void compute_stencils_and_matrices_3d(
const std::vector<uint32_t> *
subset);
443 void allocate_scratch();
447 void round_to_single();
449 std::string cache_file;
450 bool cache_single =
false;
451 bool cache_loaded =
false;
454 int64_t n_sector_unavailable = -1;
455 std::string cache_status;
456 std::string setup_status;
457 std::string setup_producer =
"host";
Definition face_reconstruction.h:53
Kokkos::View< rtype *** > face_quad_points
Definition face_reconstruction.h:181
virtual 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)
Reconstruct the listed cells' sides of their faces, on the given execution space instance,...
Definition face_reconstruction.cpp:46
virtual ~FaceReconstruction()
Destroy the Face Reconstruction object.
Definition face_reconstruction.cpp:34
virtual std::vector< uint32_t > cells_independent_of_halo(uint32_t n_owned) const
Cells below n_owned whose reconstruction reads no cell at or above n_owned, so that calc_cell_face_va...
Definition face_reconstruction.cpp:42
Quadrature quadrature_face
Definition face_reconstruction.h:178
void init_face_quadrature_3d(uint8_t degree)
Set up per-face quadrature (3D): Dunavant rules on triangles and Gauss rules mapped bilinearly onto q...
Definition face_reconstruction.cpp:68
std::shared_ptr< Mesh > mesh
Definition face_reconstruction.h:186
FaceReconstructionType get_type() const
Get the face reconstruction type.
Definition face_reconstruction.h:91
virtual logging::Items summary() const
Display lines for the run log.
Definition face_reconstruction.cpp:38
FaceReconstructionType type
Definition face_reconstruction.h:185
virtual void finish_cell_face_values(Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution)
Complete the face values after calc_cell_face_values().
Definition face_reconstruction.cpp:54
virtual bool cell_gradients(Kokkos::View< rtype *[N_CONSERVATIVE]>, Kokkos::View< rtype *[N_CONSERVATIVE][N_DIM]>, uint32_t)
Gradients of W = [rho, u, p] at the centroids of the first n_cells cells from the reconstruction poly...
Definition face_reconstruction.h:142
virtual void calc_face_values(Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution)=0
Reconstruct the face values.
Kokkos::View< rtype *** > face_quad_normals
Definition face_reconstruction.h:183
void set_mesh(std::shared_ptr< Mesh > mesh)
Set the mesh.
Definition face_reconstruction.cpp:60
void init_face_quadrature_2d_curved()
Curved meshes in 2D: per-face quadrature points, weights and normals for quadrature_face's Gauss rule...
Definition face_reconstruction.cpp:211
FaceReconstruction()
Construct a new Face Reconstruction object.
Definition face_reconstruction.cpp:30
virtual uint8_t n_face_quadrature_points() const =0
Get the number of quadrature points per face.
BoundaryData boundaries
Definition face_reconstruction.h:187
void set_boundaries(const BoundaryData &boundaries)
Set the boundary data used for ghost states.
Definition face_reconstruction.cpp:64
virtual void axisymmetric_source(Kokkos::View< rtype *[N_CONSERVATIVE]>, Kokkos::View< rtype *, Kokkos::LayoutStride >, Kokkos::View< rtype * >, uint32_t)
Axisymmetric runs: for each of the first n_cells cells whose reconstruction has a smooth polynomial,...
Definition face_reconstruction.h:156
virtual void init(const toml::value &input)=0
Initialize the face reconstruction.
Kokkos::View< rtype ** > face_quad_weights
Definition face_reconstruction.h:182
Definition face_reconstruction.h:191
void init(const toml::value &input) override
Initialize the first order face reconstruction.
Definition face_reconstruction.cpp:267
uint8_t n_face_quadrature_points() const override
Get the number of quadrature points per face.
Definition face_reconstruction.cpp:273
FirstOrder()
Construct a new First Order object.
Definition face_reconstruction.cpp:258
~FirstOrder()
Destroy the First Order object.
Definition face_reconstruction.cpp:263
void calc_face_values(Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution) override
Reconstruct the face values.
Definition face_reconstruction.cpp:313
Device memory at a fixed address whose backing grows as it fills: a reserved virtual address range wi...
Definition growing_buffer.h:26
Second-order MUSCL reconstruction of W = [rho, u_x, u_y, p] using least-squares gradients and a slope...
Definition face_reconstruction.h:248
void calc_face_values(Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution) override
Reconstruct the face values.
Definition face_reconstruction.cpp:575
logging::Items summary() const override
Display lines for the run log.
Definition face_reconstruction.cpp:343
Kokkos::View< rtype *[N_CONSERVATIVE][N_DIM]> gradients
Definition face_reconstruction.h:267
MUSCL()
Definition face_reconstruction.cpp:319
void init(const toml::value &input) override
Initialize the face reconstruction.
Definition face_reconstruction.cpp:328
~MUSCL()
Definition face_reconstruction.cpp:324
LSQVertexGradientFunctor gradient
Definition face_reconstruction.h:269
rtype venkat_K
Definition face_reconstruction.h:266
Kokkos::View< rtype *[N_CONSERVATIVE]> limiters
Definition face_reconstruction.h:268
uint8_t n_face_quadrature_points() const override
Get the number of quadrature points per face.
Definition face_reconstruction.cpp:349
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_va...
Definition face_reconstruction.cpp:536
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,...
Definition face_reconstruction.cpp:557
LimiterType limiter
Definition face_reconstruction.h:265
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().
Definition face_reconstruction.cpp:573
Definition quadrature.h:34
High-order TENO-E reconstruction on unstructured meshes (Liang, Shyy & Fu, J. Sci....
Definition face_reconstruction.h:282
Kokkos::View< rtype **** > troubled_small_coeffs
Definition face_reconstruction.h:338
Kokkos::View< rtype * > troubled
Definition face_reconstruction.h:336
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 poly...
Definition teno.cpp:2992
bool curved_mirrors
Definition face_reconstruction.h:316
rtype max_condition
Definition face_reconstruction.h:320
Kokkos::View< rtype *, Kokkos::LayoutStride > cell_gamma
Definition face_reconstruction.h:417
Kokkos::View< uint16_t ** > stencil_small_size
Definition face_reconstruction.h:331
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 c...
Definition teno.cpp:3409
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_va...
Definition teno.cpp:3026
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,...
Definition teno.cpp:3051
rtype troubled_capacity
Definition face_reconstruction.h:342
Kokkos::View< rtype ** > basis_mean
Definition face_reconstruction.h:328
bool primitive
Definition face_reconstruction.h:416
rtype C_T
Definition face_reconstruction.h:311
void calc_face_values(Kokkos::View< rtype *[N_CONSERVATIVE]> solution, Kokkos::View< rtype **[2][N_CONSERVATIVE]> face_solution) override
Reconstruct the face values.
Definition teno.cpp:3020
Kokkos::View< rtype * > cell_molar_mass
Definition face_reconstruction.h:418
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 op...
Definition teno.cpp:3396
uint8_t degree
Definition face_reconstruction.h:304
Stencils large_stencils() const
Definition teno.cpp:3311
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).
Definition teno.cpp:2984
std::vector< uint8_t > gather_depth
Definition face_reconstruction.h:347
bool setup_on_host
Definition face_reconstruction.h:406
Kokkos::View< rtype * > scale
Definition face_reconstruction.h:327
void rebuild_cells(const std::vector< uint32_t > &cells)
Recompute the tables of the given reconstructed cells and keep every other cell's,...
Definition teno.cpp:3262
uint16_t n_stencil_large
Definition face_reconstruction.h:306
uint16_t n_stencil_small
Definition face_reconstruction.h:307
TENO()
Definition teno.cpp:1167
~TENO()
Definition teno.cpp:1171
std::vector< std::shared_ptr< GrowingBuffer > > table_memory
Definition face_reconstruction.h:351
teno::PackedStencils stencil_large
Definition face_reconstruction.h:330
rtype sigma_upper
Definition face_reconstruction.h:310
logging::Items summary() const override
Display lines for the run log.
Definition teno.cpp:1249
bool characteristic
Definition face_reconstruction.h:312
uint8_t n_face_quadrature_points() const override
Get the number of quadrature points per face.
Definition teno.cpp:1270
std::vector< uint8_t > stencil_cells() const
Local cells that some stencil (central or sector) of a reconstructed cell reads.
Definition teno.cpp:3330
Kokkos::View< uint32_t * > troubled_cells
Definition face_reconstruction.h:343
Kokkos::View< uint8_t ** > selection
Definition face_reconstruction.h:419
uint8_t slice_shift
Definition face_reconstruction.h:321
rtype stencil_factor
Definition face_reconstruction.h:308
teno::PackedStencils stencil_small
Definition face_reconstruction.h:332
Kokkos::View< uint16_t * > stencil_large_size
Definition face_reconstruction.h:329
teno::Moments moments
Definition face_reconstruction.h:334
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,...
Definition teno.cpp:2967
Kokkos::View< rtype *[3]> cell_rule
Definition face_reconstruction.h:349
static constexpr uint8_t SELECT_LARGE
Definition face_reconstruction.h:415
bool bound_preserving
Definition face_reconstruction.h:313
bool single_tables
Definition face_reconstruction.h:324
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 ve...
Definition teno.cpp:3281
Kokkos::View< uint32_t > n_troubled
Definition face_reconstruction.h:344
Kokkos::View< rtype ** > si_matrix
Definition face_reconstruction.h:333
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 ...
Definition teno.cpp:3256
teno::SmoothnessTerms si_terms
Definition face_reconstruction.h:335
void init(const toml::value &input) override
Initialize the face reconstruction.
Definition teno.cpp:1215
Kokkos::View< rtype *** > troubled_coeffs
Definition face_reconstruction.h:337
uint8_t curved_wall_degree
Definition face_reconstruction.h:319
rtype sigma_threshold
Definition face_reconstruction.h:309
uint8_t n_dof_large
Definition face_reconstruction.h:305
uint32_t setup_batch_cells
Definition face_reconstruction.h:407
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().
Definition teno.cpp:3058
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
Typedefs for common types.
float rtype
Definition common_typedef.h:39
#define N_DIM
Definition common_typedef.h:28
#define N_CONSERVATIVE
Definition common_typedef.h:29
FaceReconstructionType
Definition face_reconstruction.h:30
LimiterType
Definition face_reconstruction.h:226
Cell gradient reconstruction.
Console output: rank-0 info lines, aligned sections and tables, warnings and errors on stderr,...
std::vector< std::pair< std::string, std::string > > Items
Key-value lines of a setup section, in display order.
Definition log.h:27
constexpr uint8_t SLICE_SHIFT
log2 of the cells per slice of PackedStencils: 32 on GPUs, so that a warp reads consecutive words,...
Definition teno.h:54
Kokkos::View< double **, Kokkos::LayoutRight > Moments
(cell, k): central moments of each cell, mean of ((x - x_c) / h_c)^a ... (3D).
Definition teno.h:118
Quadrature class declaration.
Device-side lookup from faces to boundary conditions.
Definition boundary.h:229
Gradient over all vertex neighbors plus the boundary ghost states of the cell's own boundary faces,...
Definition gradient.h:233
Stencil cells and mirror faces of every reconstructed cell, row by row (host copy,...
Definition face_reconstruction.h:357
std::vector< int32_t > faces
Definition face_reconstruction.h:360
std::vector< int32_t > cells
Definition face_reconstruction.h:359
std::vector< uint64_t > offsets
Definition face_reconstruction.h:358
Per-cell stencils of different sizes, stored without padding to the largest one in the mesh....
Definition teno.h:66
The terms of the smoothness-indicator matrix (3D): entry e (upper_index(l, m)) is sum_t weight(t) mom...
Definition teno.h:126
Device helpers for the TENO-E reconstruction.
Kokkos::View< uint32_t *, Space > cells
Definition teno_setup.cpp:682