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