Documentation 6b54b78464
Loading...
Searching...
No Matches
General FVM algorithms

Common algorithms used in FVM implementations. More...

Classes

struct  CLimiterDetails< LimiterKind >
 A traits class for limiters, see notes for "computeLimiters_impl()". More...
 
struct  LimiterHelpers< Type >
 Common small functions used by limiters. More...
 
struct  CLimiterDetails< LIMITER::BARTH_JESPERSEN >
 Barth-Jespersen specialization. More...
 
struct  CLimiterDetails< LIMITER::VENKATAKRISHNAN >
 Venkatakrishnan specialization. More...
 
struct  CLimiterDetails< LIMITER::NISHIKAWA_R3 >
 Nishikawa's R3 limiter specialization. More...
 
struct  CLimiterDetails< LIMITER::NISHIKAWA_R4 >
 Nishikawa's R4 limiter specialization. More...
 
struct  CLimiterDetails< LIMITER::NISHIKAWA_R5 >
 Nishikawa's R5 limiter specialization. More...
 
struct  CLimiterDetails< LIMITER::VENKATAKRISHNAN_WANG >
 Venkatakrishnan-Wang specialization. More...
 
struct  CLimiterDetails< LIMITER::SHARP_EDGES >
 Venkatakrishnan with sharp edge modification. More...
 
struct  CLimiterDetails< LIMITER::WALL_DISTANCE >
 Venkatakrishnan with wall distance modification. More...
 

Functions

template<size_t nDim, class FieldType , class GradientType >
void detail::computeGradientsGreenGauss (CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry &geometry, const CConfig &config, const FieldType &field, const size_t varBegin, const size_t varEnd, const int idxVel, GradientType &gradient)
 Compute the gradient of a field using the Green-Gauss theorem.
 
template<class FieldType , class GradientType >
void computeGradientsGreenGauss (CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry &geometry, const CConfig &config, const FieldType &field, const size_t varBegin, const size_t varEnd, const int idxVel, GradientType &gradient)
 Instantiations for 2D and 3D.
 
void detail::computeSmatrix (su2double r11, su2double r12, su2double r13, su2double r22, su2double r23, su2double r33, su2double detR2, su2double Smatrix[][2])
 Prepare Smatrix for 2D.
 
void detail::computeSmatrix (su2double r11, su2double r12, su2double r13, su2double r22, su2double r23, su2double r33, su2double detR2, su2double Smatrix[][3])
 Prepare Smatrix for 3D.
 
template<size_t nDim, bool periodic, class GradientType , class RMatrixType >
void detail::solveLeastSquares (size_t iPoint, size_t varBegin, size_t varEnd, const RMatrixType &Rmatrix, GradientType &gradient)
 Solve the least-squares problem for one point.
 
template<size_t nDim, class FieldType , class GradientType , class RMatrixType >
void detail::computeGradientsLeastSquares (CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry &geometry, const CConfig &config, bool weighted, const FieldType &field, const size_t varBegin, const size_t varEnd, const int idxVel, GradientType &gradient, RMatrixType &Rmatrix)
 Compute the gradient of a field using inverse-distance-weighted or unweighted Least-Squares approximation.
 
template<class FieldType , class GradientType , class RMatrixType >
void computeGradientsLeastSquares (CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm, CGeometry &geometry, const CConfig &config, bool weighted, const FieldType &field, const size_t varBegin, const size_t varEnd, const int idxVel, GradientType &gradient, RMatrixType &Rmatrix)
 Instantiations for 2D and 3D.
 
template<size_t nDim, class Matrix , class Scalar >
void detail::correctGradient (const size_t varBegin, const size_t varEnd, const int idxVel, const Scalar *n, Matrix &&gradients)
 Correct the gradient on a symmetry plane.
 
template<size_t nDim, class GradientType >
void correctGradientsSymmetry (CGeometry &geometry, const CConfig &config, const size_t varBegin, const size_t varEnd, const int idxVel, GradientType &gradient)
 Correct gradients on symmetry and Euler (slip) markers to respect the conditions:
 
template<class FieldType , class GradientType >
void computeLimiters (LIMITER LimiterKind, CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm1, PERIODIC_QUANTITIES kindPeriodicComm2, CGeometry &geometry, const CConfig &config, size_t varBegin, size_t varEnd, su2double umusclKappa, const FieldType &field, const GradientType &gradient, FieldType &fieldMin, FieldType &fieldMax, FieldType &limiter)
 A wrapper funtion that calls specialized implementations depending on "LimiterKind". Those implementations are generated by instantiating versions of "computeLimiters_impl" with appropriate specializations of "CLimiterDetails". See corresponding hpp files for further details.
 
template<size_t nDim, LIMITER LimiterKind, class FieldType , class GradientType >
void computeLimiters_impl (CSolver *solver, MPI_QUANTITIES kindMpiComm, PERIODIC_QUANTITIES kindPeriodicComm1, PERIODIC_QUANTITIES kindPeriodicComm2, CGeometry &geometry, const CConfig &config, size_t varBegin, size_t varEnd, su2double umusclKappa, const FieldType &field, const GradientType &gradient, FieldType &fieldMin, FieldType &fieldMax, FieldType &limiter)
 Generic limiter computation for methods based on one limiter value per point (as opposed to one per edge) and per variable.
 

Detailed Description

Common algorithms used in FVM implementations.

Function Documentation

◆ computeGradientsGreenGauss() [1/2]

template<size_t nDim, class FieldType , class GradientType >
void detail::computeGradientsGreenGauss ( CSolver *  solver,
MPI_QUANTITIES  kindMpiComm,
PERIODIC_QUANTITIES  kindPeriodicComm,
CGeometry &  geometry,
const CConfig &  config,
const FieldType &  field,
const size_t  varBegin,
const size_t  varEnd,
const int  idxVel,
GradientType &  gradient 
)

Compute the gradient of a field using the Green-Gauss theorem.

Note
Template nDim to allow efficient unrolling of inner loops.
Gradients can be computed only for a contiguous range of variables, defined by [varBegin, varEnd[ (e.g. 0,1 computes the gradient of the 1st variable). This can be used, for example, to compute only velocity gradients.
The function uses an optional solver object to perform communications, if none (nullptr) is provided the function does not fail (the objective of this is to improve test-ability).
Parameters
[in]solver- Optional, solver associated with the field (used only for MPI).
[in]kindMpiComm- Type of MPI communication required.
[in]kindPeriodicComm- Type of periodic communication required.
[in]geometry- Geometric grid properties.
[in]config- Configuration of the problem, used to identify types of boundaries.
[in]field- Generic object implementing operator (iPoint, iVar).
[in]varBegin- Index of first variable for which to compute the gradient.
[in]varEnd- Index of last variable for which to compute the gradient.
[in]idxVel- Index of velocity, or -1 if no velocity present.
[out]gradient- Generic object implementing operator (iPoint, iVar, iDim).

◆ computeGradientsGreenGauss() [2/2]

template<class FieldType , class GradientType >
void computeGradientsGreenGauss ( CSolver *  solver,
MPI_QUANTITIES  kindMpiComm,
PERIODIC_QUANTITIES  kindPeriodicComm,
CGeometry &  geometry,
const CConfig &  config,
const FieldType &  field,
const size_t  varBegin,
const size_t  varEnd,
const int  idxVel,
GradientType &  gradient 
)

Instantiations for 2D and 3D.

◆ computeGradientsLeastSquares() [1/2]

template<size_t nDim, class FieldType , class GradientType , class RMatrixType >
void detail::computeGradientsLeastSquares ( CSolver *  solver,
MPI_QUANTITIES  kindMpiComm,
PERIODIC_QUANTITIES  kindPeriodicComm,
CGeometry &  geometry,
const CConfig &  config,
bool  weighted,
const FieldType &  field,
const size_t  varBegin,
const size_t  varEnd,
const int  idxVel,
GradientType &  gradient,
RMatrixType &  Rmatrix 
)

Compute the gradient of a field using inverse-distance-weighted or unweighted Least-Squares approximation.

Note
See notes from computeGradientsGreenGauss.hpp.
Parameters
[in]solver- Optional, solver associated with the field (used only for MPI).
[in]kindMpiComm- Type of MPI communication required.
[in]kindPeriodicComm- Type of periodic communication required.
[in]geometry- Geometric grid properties.
[in]weighted- Use inverse-distance weights.
[in]config- Configuration of the problem, used to identify types of boundaries.
[in]field- Generic object implementing operator (iPoint, iVar).
[in]varBegin- Index of first variable for which to compute the gradient.
[in]varEnd- Index of last variable for which to compute the gradient.
[in]idxVel- Index to velocity, -1 if no velocity is present in the solver.
[out]gradient- Generic object implementing operator (iPoint, iVar, iDim).
[out]Rmatrix- Generic object implementing operator (iPoint, iDim, iDim).

◆ computeGradientsLeastSquares() [2/2]

template<class FieldType , class GradientType , class RMatrixType >
void computeGradientsLeastSquares ( CSolver *  solver,
MPI_QUANTITIES  kindMpiComm,
PERIODIC_QUANTITIES  kindPeriodicComm,
CGeometry &  geometry,
const CConfig &  config,
bool  weighted,
const FieldType &  field,
const size_t  varBegin,
const size_t  varEnd,
const int  idxVel,
GradientType &  gradient,
RMatrixType &  Rmatrix 
)

Instantiations for 2D and 3D.

◆ computeLimiters()

template<class FieldType , class GradientType >
void computeLimiters ( LIMITER  LimiterKind,
CSolver *  solver,
MPI_QUANTITIES  kindMpiComm,
PERIODIC_QUANTITIES  kindPeriodicComm1,
PERIODIC_QUANTITIES  kindPeriodicComm2,
CGeometry &  geometry,
const CConfig &  config,
size_t  varBegin,
size_t  varEnd,
su2double  umusclKappa,
const FieldType &  field,
const GradientType &  gradient,
FieldType &  fieldMin,
FieldType &  fieldMax,
FieldType &  limiter 
)

A wrapper funtion that calls specialized implementations depending on "LimiterKind". Those implementations are generated by instantiating versions of "computeLimiters_impl" with appropriate specializations of "CLimiterDetails". See corresponding hpp files for further details.

◆ computeLimiters_impl()

template<size_t nDim, LIMITER LimiterKind, class FieldType , class GradientType >
void computeLimiters_impl ( CSolver *  solver,
MPI_QUANTITIES  kindMpiComm,
PERIODIC_QUANTITIES  kindPeriodicComm1,
PERIODIC_QUANTITIES  kindPeriodicComm2,
CGeometry &  geometry,
const CConfig &  config,
size_t  varBegin,
size_t  varEnd,
su2double  umusclKappa,
const FieldType &  field,
const GradientType &  gradient,
FieldType &  fieldMin,
FieldType &  fieldMax,
FieldType &  limiter 
)

Generic limiter computation for methods based on one limiter value per point (as opposed to one per edge) and per variable.

Note
This implementation can be used to derive most common methods by specializing the limiter functions (e.g. Venkatakrishnan) and the geometric modifications (e.g. sharp edges), this is done via specialization of "CLimiterDetails" (all its methods). Then, a call to this function with the specialized "LimiterKind" should be added to the body of "computeLimiters()". See also the notes in computeGradientsGreenGauss.hpp

Arguments:

Parameters
[in]solver- Optional, solver associated with the field (used only for MPI).
[in]kindMpiComm- Type of MPI communication required.
[in]kindPeriodicComm1- Type of periodic comm. to determine min/max.
[in]kindPeriodicComm2- Type of periodic comm. to adjust limiters.
[in]geometry- Geometric grid properties.
[in]config- Configuration of the problem.
[in]varBegin- First variable index for which to compute limiters.
[in]varEnd- End of computation range (nVar = end-begin).
[in]umusclKappa- Blending parameter for U-MUSCL reconstruction.
[in]field- Variable field.
[in]gradient- Gradient of the field.
[out]fieldMin- Minimum field values over direct neighbors of each point.
[out]fieldMax- As above but maximum values.
[out]limiter- Reconstruction limiter for the field.

Template parameters:

Parameters
nDim- Number of dimensions.
LimiterKind- Used to instantiate the right details class.
FieldType- Generic object with operator (iPoint,iVar).
GradientType- Generic object with operator (iPoint,iVar,iDim).

◆ computeSmatrix() [1/2]

void detail::computeSmatrix ( su2double  r11,
su2double  r12,
su2double  r13,
su2double  r22,
su2double  r23,
su2double  r33,
su2double  detR2,
su2double  Smatrix[][2] 
)
inline

Prepare Smatrix for 2D.

◆ computeSmatrix() [2/2]

void detail::computeSmatrix ( su2double  r11,
su2double  r12,
su2double  r13,
su2double  r22,
su2double  r23,
su2double  r33,
su2double  detR2,
su2double  Smatrix[][3] 
)
inline

Prepare Smatrix for 3D.

◆ correctGradient()

template<size_t nDim, class Matrix , class Scalar >
void detail::correctGradient ( const size_t  varBegin,
const size_t  varEnd,
const int  idxVel,
const Scalar *  n,
Matrix &&  gradients 
)
inline

Correct the gradient on a symmetry plane.

Parameters
[in]varBegin- Start of the variables.
[in]varEnd- End of the variables.
[in]idxVel- Variable index where velocity gradients start (-1 if all variables are scalars).
[in]n- Normal direction.
[in,out]gradients- The gradients to be modified.

◆ correctGradientsSymmetry()

template<size_t nDim, class GradientType >
void correctGradientsSymmetry ( CGeometry &  geometry,
const CConfig &  config,
const size_t  varBegin,
const size_t  varEnd,
const int  idxVel,
GradientType &  gradient 
)

Correct gradients on symmetry and Euler (slip) markers to respect the conditions:

  1. n.grad(phi) = 0
  2. n.grad(v.t) = 0
  3. t.grad(v.n) = 0
    Note
    See Blazek eq. 8.40.
    Parameters
    [in]geometry- Geometric grid properties.
    [in]config- Configuration of the problem, used to identify types of boundaries.
    [in]varBegin- Index of first variable for which to compute the gradient.
    [in]varEnd- Index of last variable for which to compute the gradient.
    [in]idxVel- Index to velocity, -1 if no velocity is present in the solver.
    [in,out]gradient- Generic object implementing operator (iPoint, iVar, iDim).

◆ solveLeastSquares()

template<size_t nDim, bool periodic, class GradientType , class RMatrixType >
void detail::solveLeastSquares ( size_t  iPoint,
size_t  varBegin,
size_t  varEnd,
const RMatrixType &  Rmatrix,
GradientType &  gradient 
)
inline

Solve the least-squares problem for one point.

Note
See detail::computeGradientsLeastSquares for the purpose of template "nDim" and "periodic".