All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QUICK.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::QUICKLimiter
26 
27 Description
28  Class with limiter function which returns the limiter for the
29  quadratic-upwind differencing scheme.
30 
31  Note that the weighting factors are not bounded between upwind and
32  central-differencing, some downwind contribution is possible although
33  the interpolate is limited to be between the upwind and downwind cell
34  values.
35 
36  Used in conjunction with the template class LimitedScheme.
37 
38 SourceFiles
39  QUICK.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef QUICK_H
44 #define QUICK_H
45 
46 #include "vector.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class QUICKLimiter Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class LimiterFunc>
58 class QUICKLimiter
59 :
60  public LimiterFunc
61 {
62 
63 public:
64 
66  {}
67 
68  scalar limiter
69  (
70  const scalar cdWeight,
71  const scalar faceFlux,
72  const typename LimiterFunc::phiType& phiP,
73  const typename LimiterFunc::phiType& phiN,
74  const typename LimiterFunc::gradPhiType& gradcP,
75  const typename LimiterFunc::gradPhiType& gradcN,
76  const vector& d
77  ) const
78  {
79  scalar phiCD = cdWeight*phiP + (1 - cdWeight)*phiN;
80 
81  scalar phiU, phif;
82 
83  if (faceFlux > 0)
84  {
85  phiU = phiP;
86  phif = 0.5*(phiCD + phiP + (1 - cdWeight)*(d & gradcP));
87  }
88  else
89  {
90  phiU = phiN;
91  phif = 0.5*(phiCD + phiN - cdWeight*(d & gradcN));
92  }
93 
94  // Calculate the effective limiter for the QUICK interpolation
95  scalar QLimiter = (phif - phiU)/stabilise(phiCD - phiU, small);
96 
97  // Limit the limiter between upwind and downwind
98  return max(min(QLimiter, 2), 0);
99  }
100 };
101 
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 } // End namespace Foam
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 #endif
110 
111 // ************************************************************************* //
QUICKLimiter(Istream &)
Definition: QUICK.H:64
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< DimensionedField< scalar, GeoMesh > > stabilise(const DimensionedField< scalar, GeoMesh > &dsf, const dimensioned< scalar > &ds)
scalar limiter(const scalar cdWeight, const scalar faceFlux, const typename LimiterFunc::phiType &phiP, const typename LimiterFunc::phiType &phiN, const typename LimiterFunc::gradPhiType &gradcP, const typename LimiterFunc::gradPhiType &gradcN, const vector &d) const
Definition: QUICK.H:68
Class with limiter function which returns the limiter for the quadratic-upwind differencing scheme...
Definition: QUICK.H:57
Namespace for OpenFOAM.