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

Cell gradient reconstruction. More...

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

Go to the source code of this file.

Classes

struct  LSQSystem
 Inverse-distance-squared weighted least-squares normal equations M g = b, with M stored as its upper triangle (row-major). More...
 
struct  LSQGradientFunctor
 Weighted least-squares gradient of W = [rho, u, p] over face neighbors, with boundary ghost states placed at the mirror image of the cell centroid across the boundary face. More...
 
struct  VertexGradientWeights
 Weights of LSQVertexGradientFunctor, aligned with cells_of_cell and faces_of_cell (zero for interior faces). More...
 
struct  LSQVertexGradientFunctor
 Gradient over all vertex neighbors plus the boundary ghost states of the cell's own boundary faces, as a fixed linear combination of the differences to the cell's state. More...
 

Functions

template<uint8_t N, typename T >
KOKKOS_INLINE_FUNCTION bool cholesky (const T A[N][N], T L[N][N])
 Cholesky factorization A = L L^T of a symmetric positive definite matrix given by its upper triangle. Returns false if a pivot falls below 1e-10 of its diagonal entry, i.e. the matrix is (nearly) singular.
 
template<uint8_t N, typename T >
KOKKOS_INLINE_FUNCTION void cholesky_solve (const T L[N][N], T *x)
 Solve L L^T x = b in place.
 
LSQGradientFunctor make_gradient (const Mesh &mesh, const BoundaryData &boundaries, Kokkos::View< rtype *[N_CONSERVATIVE]> W, Kokkos::View< rtype *[N_CONSERVATIVE][N_DIM]> gradients)
 LSQGradientFunctor of the states W into gradients over a mesh.
 
LSQVertexGradientFunctor make_vertex_gradient (const LSQGradientFunctor &faces, const Mesh &mesh, bool quadratic=true)
 LSQVertexGradientFunctor over the given gradient functor's mesh, boundaries, states and gradients, with its weights computed for a quadratic or a linear fit.
 

Detailed Description

Cell gradient reconstruction.

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

Function Documentation

◆ cholesky()

template<uint8_t N, typename T >
KOKKOS_INLINE_FUNCTION bool cholesky ( const T  A[N][N],
T  L[N][N] 
)

Cholesky factorization A = L L^T of a symmetric positive definite matrix given by its upper triangle. Returns false if a pivot falls below 1e-10 of its diagonal entry, i.e. the matrix is (nearly) singular.

◆ cholesky_solve()

template<uint8_t N, typename T >
KOKKOS_INLINE_FUNCTION void cholesky_solve ( const T  L[N][N],
T *  x 
)

Solve L L^T x = b in place.

◆ make_gradient()

LSQGradientFunctor make_gradient ( const Mesh &  mesh,
const BoundaryData &  boundaries,
Kokkos::View< rtype *[N_CONSERVATIVE]>  W,
Kokkos::View< rtype *[N_CONSERVATIVE][N_DIM]>  gradients 
)
inline

LSQGradientFunctor of the states W into gradients over a mesh.

◆ make_vertex_gradient()

LSQVertexGradientFunctor make_vertex_gradient ( const LSQGradientFunctor &  faces,
const Mesh &  mesh,
bool  quadratic = true 
)
inline

LSQVertexGradientFunctor over the given gradient functor's mesh, boundaries, states and gradients, with its weights computed for a quadratic or a linear fit.