https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | List of all members
Moose::FV::Limiter< T > Class Template Referenceabstract

Base class for defining slope limiters for finite volume or potentially reconstructed Discontinuous-Galerkin applications. More...

#include <Limiter.h>

Inheritance diagram for Moose::FV::Limiter< T >:
[legend]

Public Member Functions

virtual T limit (const T &phi_upwind, const T &phi_downwind, const libMesh::VectorValue< T > *grad_phi_upwind, const libMesh::VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD, const Real &max_value, const Real &min_value, const FaceInfo *fi, const bool &fi_elem_is_upwind) const =0
 This method computes the flux limiting ratio based on the provided scalar values, gradient vectors, direction vector, maximum and minimum allowable values, and geometric information from the face and cell centroids. More...
 
virtual bool constant () const =0
 
virtual InterpMethod interpMethod () const =0
 
operator() (const T &phi_upwind, const T &phi_downwind, const libMesh::VectorValue< T > *grad_phi_upwind, const RealVectorValue &dCD) const
 
operator() (const T &phi_upwind, const T &phi_downwind, const VectorValue< T > *grad_phi_upwind, const VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD, const Real &max_value, const Real &min_value, const FaceInfo *fi, const bool &fi_elem_is_upwind) const
 
rf_grad (const VectorValue< T > *grad_phi_upwind, const VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD) const
 
rf_minmax (const T &phi_upwind, const VectorValue< T > *grad_phi_upwind, const Real &max_value, const Real &min_value, const FaceInfo *fi, const bool &fi_elem_is_upwind) const
 
 Limiter ()=default
 
virtual ~Limiter ()=default
 

Static Public Member Functions

static std::unique_ptr< Limiterbuild (LimiterType limiter)
 

Detailed Description

template<typename T>
class Moose::FV::Limiter< T >

Base class for defining slope limiters for finite volume or potentially reconstructed Discontinuous-Galerkin applications.

Definition at line 62 of file Limiter.h.

Constructor & Destructor Documentation

◆ Limiter()

template<typename T>
Moose::FV::Limiter< T >::Limiter ( )
default

◆ ~Limiter()

template<typename T>
virtual Moose::FV::Limiter< T >::~Limiter ( )
virtualdefault

Member Function Documentation

◆ build()

template<typename T >
template std::unique_ptr< Limiter< ADReal > > Moose::FV::Limiter< T >::build ( LimiterType  limiter)
static

Definition at line 32 of file Limiter.C.

Referenced by Moose::FV::containerInterpolate().

33 {
34  switch (limiter)
35  {
37  return std::make_unique<VanLeerLimiter<T>>();
38 
40  return std::make_unique<UpwindLimiter<T>>();
41 
43  return std::make_unique<CentralDifferenceLimiter<T>>();
44 
46  return std::make_unique<MinModLimiter<T>>();
47 
48  case LimiterType::SOU:
49  return std::make_unique<SOULimiter<T>>();
50 
51  case LimiterType::QUICK:
52  return std::make_unique<QUICKLimiter<T>>();
53 
55  return std::make_unique<VenkatakrishnanLimiter<T>>();
56 
57  default:
58  mooseError("Unrecognized limiter type ", unsigned(limiter));
59  }
60 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ constant()

template<typename T>
virtual bool Moose::FV::Limiter< T >::constant ( ) const
pure virtual

◆ interpMethod()

template<typename T>
virtual InterpMethod Moose::FV::Limiter< T >::interpMethod ( ) const
pure virtual

◆ limit()

template<typename T>
virtual T Moose::FV::Limiter< T >::limit ( const T &  phi_upwind,
const T &  phi_downwind,
const libMesh::VectorValue< T > *  grad_phi_upwind,
const libMesh::VectorValue< T > *  grad_phi_downwind,
const RealVectorValue dCD,
const Real max_value,
const Real min_value,
const FaceInfo fi,
const bool &  fi_elem_is_upwind 
) const
pure virtual

This method computes the flux limiting ratio based on the provided scalar values, gradient vectors, direction vector, maximum and minimum allowable values, and geometric information from the face and cell centroids.

It must be overridden by any derived class implementing a specific limiting strategy.

Template Parameters
TThe data type of the field values and the return type.
Parameters
phi_upwindThe field value at the upwind location.
phi_downwindThe field value at the downwind location.
grad_phi_upwindPointer to the gradient of the field at the upwind location.
grad_phi_downwindPointer to the gradient of the field at the downwind location.
dCDA constant direction vector representing the direction of the cell face.
max_valueThe maximum allowable value.
min_valueThe minimum allowable value.
fiFaceInfo object containing geometric details such as face centroid and cell centroids.
fi_elem_is_upwindBoolean indicating if the face info element is upwind.
Returns
The computed flux limiting ratio.

This pure virtual function is intended to be defined in derived classes, which will implement the specific limiting algorithm. Derived classes will provide the actual logic for computing the flux limiting ratio, ensuring that the result adheres to the constraints and properties required by the specific limiting method.

Referenced by Moose::FV::Limiter< T >::operator()().

◆ operator()() [1/2]

template<typename T>
T Moose::FV::Limiter< T >::operator() ( const T &  phi_upwind,
const T &  phi_downwind,
const libMesh::VectorValue< T > *  grad_phi_upwind,
const RealVectorValue dCD 
) const
inline
Template Parameters
TThe data type of the field values and the return type.
Parameters
phi_upwindThe field value at the upwind location.
phi_downwindThe field value at the downwind location.
grad_phi_upwindPointer to the gradient of the field value at the upwind location.
dCDA constant direction vector representing the direction of the cell face.
Returns
The computed limited value, ensuring it is within the range [0, 2].

Definition at line 109 of file Limiter.h.

113  {
114  return std::max(T(0),
115  std::min(T(2),
116  limit(phi_upwind,
117  phi_downwind,
118  grad_phi_upwind,
119  nullptr,
120  dCD,
121  T(0),
122  T(0),
123  nullptr,
124  false)));
125  }
virtual T limit(const T &phi_upwind, const T &phi_downwind, const libMesh::VectorValue< T > *grad_phi_upwind, const libMesh::VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD, const Real &max_value, const Real &min_value, const FaceInfo *fi, const bool &fi_elem_is_upwind) const =0
This method computes the flux limiting ratio based on the provided scalar values, gradient vectors...
auto max(const L &left, const R &right)
auto min(const L &left, const R &right)

◆ operator()() [2/2]

template<typename T>
T Moose::FV::Limiter< T >::operator() ( const T &  phi_upwind,
const T &  phi_downwind,
const VectorValue< T > *  grad_phi_upwind,
const VectorValue< T > *  grad_phi_downwind,
const RealVectorValue dCD,
const Real max_value,
const Real min_value,
const FaceInfo fi,
const bool &  fi_elem_is_upwind 
) const
inline
Template Parameters
TThe data type of the field values and the return type.
Parameters
phi_upwindThe field value at the upwind location.
phi_downwindThe field value at the downwind location.
grad_phi_upwindPointer to the gradient at the upwind location.
grad_phi_downwindPointer to the gradient at the downwind location.
dCDA constant direction vector representing the direction of the cell face.
max_valueThe maximum allowable value.
min_valueThe minimum allowable value.
fiFaceInfo object containing geometric details such as face centroid and cell centroids.
fi_elem_is_upwindBoolean indicating if the face info element is upwind.
Returns
The result of the limit function applied to the provided parameters.

Definition at line 141 of file Limiter.h.

150  {
151  return limit(phi_upwind,
152  phi_downwind,
153  grad_phi_upwind,
154  grad_phi_downwind,
155  dCD,
156  max_value,
157  min_value,
158  fi,
159  fi_elem_is_upwind);
160  }
virtual T limit(const T &phi_upwind, const T &phi_downwind, const libMesh::VectorValue< T > *grad_phi_upwind, const libMesh::VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD, const Real &max_value, const Real &min_value, const FaceInfo *fi, const bool &fi_elem_is_upwind) const =0
This method computes the flux limiting ratio based on the provided scalar values, gradient vectors...

◆ rf_grad()

template<typename T>
T Moose::FV::Limiter< T >::rf_grad ( const VectorValue< T > *  grad_phi_upwind,
const VectorValue< T > *  grad_phi_downwind,
const RealVectorValue dCD 
) const
inline
Template Parameters
TThe data type of the gradient values and the return type.
Parameters
grad_phi_upwindPointer to the gradient at the upwind location.
grad_phi_downwindPointer to the gradient at the downwind location.
dCDA constant direction vector representing the direction of the cell face.
Returns
The computed flux limiting ratio.

Definition at line 169 of file Limiter.h.

Referenced by Moose::FV::MinModLimiter< T >::limit(), Moose::FV::VanLeerLimiter< T >::limit(), and Moose::FV::QUICKLimiter< T >::limit().

172  {
173  const auto grad_elem = (*grad_phi_upwind) * dCD;
174  const auto grad_face = (*grad_phi_downwind) * dCD;
175  const auto grad_ratio = grad_elem / (grad_face + 1e-10);
176  return std::max(2.0 * grad_ratio - 1.0, 0.0);
177  };
auto max(const L &left, const R &right)

◆ rf_minmax()

template<typename T>
T Moose::FV::Limiter< T >::rf_minmax ( const T &  phi_upwind,
const VectorValue< T > *  grad_phi_upwind,
const Real max_value,
const Real min_value,
const FaceInfo fi,
const bool &  fi_elem_is_upwind 
) const
inline
Template Parameters
TThe data type of the field values and the return type.
Parameters
phi_upwindThe field value at the upwind location.
grad_phi_upwindPointer to the gradient at the upwind location.
max_valueThe maximum allowable value.
min_valueThe minimum allowable value.
fiFaceInfo object containing geometric details such as face centroid and cell centroids.
fi_elem_is_upwindBoolean indicating if the face info element is upwind.
Returns
The computed flux limiting ratio.

Definition at line 190 of file Limiter.h.

196  {
197  const auto face_centroid = fi->faceCentroid();
198  const auto cell_centroid = fi_elem_is_upwind ? fi->elemCentroid() : fi->neighborCentroid();
199 
200  const auto delta_face = (*grad_phi_upwind) * (face_centroid - cell_centroid);
201  const auto delta_max = max_value - phi_upwind + 1e-10;
202  const auto delta_min = min_value - phi_upwind + 1e-10;
203 
204  return delta_face >= 0 ? delta_face / delta_max : delta_face / delta_min;
205  };
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition: FaceInfo.h:71
const Point & neighborCentroid() const
Definition: FaceInfo.h:243
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face...
Definition: FaceInfo.h:95

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