https://mooseframework.inl.gov
QUICKLimiter.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 {
38 template <typename T>
39 class QUICKLimiter : public Limiter<T>
40 {
41 public:
53  T limit(const T & phi_upwind,
54  const T & phi_downwind,
55  const VectorValue<T> * grad_phi_upwind,
56  const VectorValue<T> * grad_phi_downwind,
57  const RealVectorValue & dCD,
58  const Real & /* max_value */,
59  const Real & /* min_value */,
60  const FaceInfo * /* fi */,
61  const bool & /* fi_elem_is_upwind */) const override final
62  {
63  mooseAssert(grad_phi_upwind, "QUICK limiter requires a gradient");
64 
65  // Compute gradient ratio coefficient
66  T limiter;
67  if (grad_phi_downwind) // compute full slope-reconstruction limiter for weakly-compressible flow
68  {
69  const auto & r_f = this->rf_grad(grad_phi_upwind, grad_phi_downwind, dCD);
70  const auto & beta = T(1.0); // Ensures TVD compliance
71  limiter =
72  0 * r_f +
73  std::min(beta,
74  std::max(std::min(std::min((1 + 3.0 * r_f) / 4.0, 2.0 * r_f), T(2.0)), T(0.0)));
75  }
76  else // compute upwind slope reconstruction limiter for compressible flow
77  {
78  const auto & r_f = Moose::FV::rF(phi_upwind, phi_downwind, *grad_phi_upwind, dCD);
79  limiter = (3.0 * r_f) / 4.0;
80  }
81 
82  // Return limiter value
83  return limiter;
84  }
85 
86  bool constant() const override final { return false; }
87 
88  InterpMethod interpMethod() const override final { return InterpMethod::QUICK; }
89 
90  QUICKLimiter() = default;
91 };
92 }
93 }
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.
Definition: QUICKLimiter.h:53
The QUICK (Quadratic Upstream Interpolation for Convective Kinematics) limiter function is derived fr...
Definition: QUICKLimiter.h:39
Scalar rF(const Scalar &phiC, const Scalar &phiD, const Vector &gradC, const RealVectorValue &dCD)
From Moukalled 12.30.
Definition: MathFVUtils.h:445
auto max(const L &left, const R &right)
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
Definition: QUICKLimiter.h:86
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
InterpMethod interpMethod() const override final
Definition: QUICKLimiter.h:88
InterpMethod
This codifies a set of available ways to interpolate with elem+neighbor solution information to calcu...
Definition: MathFVUtils.h:35
auto min(const L &left, const R &right)
T rf_grad(const VectorValue< T > *grad_phi_upwind, const VectorValue< T > *grad_phi_downwind, const RealVectorValue &dCD) const
Definition: Limiter.h:169