https://mooseframework.inl.gov
VanLeerLimiter.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "Limiter.h"
13 #include "MathFVUtils.h"
14 
15 namespace Moose
16 {
17 namespace FV
18 {
30 template <typename T>
31 class VanLeerLimiter : public Limiter<T>
32 {
33 public:
43  T limit(const T & phi_upwind,
44  const T & phi_downwind,
45  const VectorValue<T> * grad_phi_upwind,
46  const VectorValue<T> * grad_phi_downwind,
47  const RealVectorValue & dCD,
48  const Real & /* max_value */,
49  const Real & /* min_value */,
50  const FaceInfo * /* fi */,
51  const bool & /* fi_elem_is_upwind */) const override final
52  {
53  mooseAssert(grad_phi_upwind, "Van Leer limiter requires the upwind gradient");
54 
55  // Compute gradient ratio coefficient
56  T r_f;
57  if (grad_phi_downwind) // compute full slope-reconstruction limiter
58  r_f = this->rf_grad(grad_phi_upwind, grad_phi_downwind, dCD);
59  else // compute upwind slope reconstruction limiter
60  r_f = Moose::FV::rF(phi_upwind, phi_downwind, *grad_phi_upwind, dCD);
61 
62  // Return limiter value
63  return (r_f + std::abs(r_f)) / (1.0 + std::abs(r_f));
64  }
65 
66  bool constant() const override final { return false; }
67 
68  InterpMethod interpMethod() const override final { return InterpMethod::VanLeer; }
69 
70  VanLeerLimiter() = default;
71 };
72 }
73 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
Base class for defining slope limiters for finite volume or potentially reconstructed Discontinuous-G...
Definition: Limiter.h:62
T limit(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 &, const Real &, const FaceInfo *, const bool &) const override final
This method overrides the pure virtual limit method in the base Limiter class.
Scalar rF(const Scalar &phiC, const Scalar &phiD, const Vector &gradC, const RealVectorValue &dCD)
From Moukalled 12.30.
Definition: MathFVUtils.h:445
InterpMethod interpMethod() const override final
The Van Leer limiter limiter function $(r_f)$ is defined as:
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
bool constant() const override final
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
InterpMethod
This codifies a set of available ways to interpolate with elem+neighbor solution information to calcu...
Definition: MathFVUtils.h:35
T rf_grad(const VectorValue< T > *grad_phi_upwind, const VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD) const
Definition: Limiter.h:169