PLUTO  4.4-patch2
Data Structures | Functions
plm_coeffs.h File Reference

Reconstruction coefficients header file. More...

Go to the source code of this file.

Data Structures

struct  PLM_Coeffs
 

Macros

Limiter macros.

The following macros define a few limiter functions that can be used for piecewise linear reconstruction. Each limiter has the form SET_XX_LIMITER(dv, dvp, dvm, cp, cm) where dvp and dvm are the geometrically weighted forward and backward slopes ( $\Delta Q^{F}$ and $\Delta Q^{B}$ in Eq. [29]), cp and cm are weight coefficients depending on the distance between the cell interfaces and the centroid of volume (Eq. [33] in the reference paper). The limited slope (used in Eq. [30]) is returned in dv.

Usually cp and cm are used only for a few limiters and when the grid is either non-uniform or the geometry is not Cartesian. For this reason, the OSPRE (OS), van Leer (VL) and monotonized central (MC) are

#define SET_FL_LIMITER(dv, dvp, dvm, cp, cm)   dv = 0.0
 
#define SET_MM_LIMITER(dv, dvp, dvm, cp, cm)   dv = ( (dvp)*(dvm) > 0.0 ? ABS_MIN((dvp), (dvm)): 0.0)
 
#define SET_VA_LIMITER(dv, dvp, dvm, cp, cm)
 
#define SET_UM_LIMITER(dv, dvp, dvm, cp, cm)
 
#define SET_GM_LIMITER(dv, dvp, dvm, cp, cm)
 
#define SET_OS_LIMITER(dv, dvp, dvm, cp, cm)
 
#define SET_VL_LIMITER(dv, dvp, dvm, cp, cm)   dv = ( (dvp)*(dvm) > 0.0 ? 2.0*(dvp)*(dvm)/((dvp) + (dvm)) :0.0)
 
#define SET_MC_LIMITER(dv, dvp, dvm, cp, cm)
 
#define SET_LIMITER   SET_VL_LIMITER
 

Functions

void PLM_CoefficientsSet (Grid *grid)
 
void PLM_CoefficientsGet (PLM_Coeffs *, int)
 

Detailed Description

Define some useful macros for the computation of slope limiters in the piecewise linear method.

The macro ::UNIFORM_CARTESIAN_GRID can be set to YES to enable faster computation when the grid is uniform and Cartesian. In the general case (non-uniform and/or non-Cartesian), set it to NO.

Authors
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
Date
Jan 7, 2019

References

Macro Definition Documentation

◆ SET_FL_LIMITER

#define SET_FL_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)    dv = 0.0

Set flat (zero slope) reconstruction (also non-uniform).

◆ SET_GM_LIMITER

#define SET_GM_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)
Value:
if (dvp*dvm > 0.0) { \
double _qc = 0.5*(dvm + dvp), _scrh = ABS_MIN((dvp)*(cp), (dvm)*(cm)); \
dv = ABS_MIN(_qc, _scrh); \
}else dv = 0.0;
#define ABS_MIN(a, b)
Definition: macros.h:147

Generalised minmod limiter

◆ SET_MC_LIMITER

#define SET_MC_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)
Value:
if ( (dvp)*(dvm) > 0.0) { \
double _qc = 0.5*( (dvm) + (dvp) ), _scrh = 2.0*ABS_MIN( (dvp), (dvm) ); \
dv = ABS_MIN(_qc, _scrh); \
}else dv = 0.0;
#define ABS_MIN(a, b)
Definition: macros.h:147

Monotonized central limiter (uniform cart. grid). Here cp and cm are useless.

◆ SET_MM_LIMITER

#define SET_MM_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)    dv = ( (dvp)*(dvm) > 0.0 ? ABS_MIN((dvp), (dvm)): 0.0)

Set Minmod limiter.

◆ SET_OS_LIMITER

#define SET_OS_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)
Value:
dv = ( (dvp)*(dvm) > 0.0? \
dv = 1.5*(dvp)*(dvm)*((dvm) + (dvp))/((dvp)*(dvp) + (dvm)*(dvm) + (dvp)*(dvm)): 0.0);

OSPRE limiter (uniform Cart. grid)

◆ SET_UM_LIMITER

#define SET_UM_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)
Value:
if ( (dvp)*(dvm) > 0.0){ \
double _ddp = 0.25*( (dvp) + 3.0*(dvm)), _ddm = 0.25*((dvm) + 3.0*(dvp)); \
double _d2 = 2.0*ABS_MIN( (dvp), (dvm) );\
_d2 = ABS_MIN(_d2, _ddp);\
dv = ABS_MIN(_d2, _ddm);\
}else dv = 0.0;
#define ABS_MIN(a, b)
Definition: macros.h:147

Umist limiter

◆ SET_VA_LIMITER

#define SET_VA_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)
Value:
if ((dvp)*(dvm) > 0.0) { \
double _dpp= (dvp)*(dvp), _dmm = (dvm)*(dvm); \
dv = ( (dvp)*(_dmm + 1.e-18) + (dvm)*(_dpp + 1.e-18))/(_dpp + _dmm + 1.e-18); \
}else dv = 0.0;

Van Albada limiter

◆ SET_VL_LIMITER

#define SET_VL_LIMITER (   dv,
  dvp,
  dvm,
  cp,
  cm 
)    dv = ( (dvp)*(dvm) > 0.0 ? 2.0*(dvp)*(dvm)/((dvp) + (dvm)) :0.0)

Van Leer limiter (uniform Cartesian grid)

Function Documentation

◆ PLM_CoefficientsGet()

void PLM_CoefficientsGet ( PLM_Coeffs plm_coeffs,
int  dir 
)

Retrieve reconstruction coefficients in the PLM_Coeffs structure. This function can be called only if the previous one has been completed already.

Parameters
[out]plm_coeffsa pointer to a PLM_Coeffs structure containing the 1D coefficients needed for reconstruction
[in]dirthe desired direction

◆ PLM_CoefficientsSet()

void PLM_CoefficientsSet ( Grid grid)

Compute interpolation coefficients for linear reconstruction.

Parameters
[in]gridpointer to Grid structure
Returns
This function has no return value