QUICKV.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::QUICKVLimiter
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  QUICKV.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef QUICKV_H
44 #define QUICKV_H
45 
46 #include "vector.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class QUICKVLimiter Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class LimiterFunc>
58 class QUICKVLimiter
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  vector gradfV = phiN - phiP;
80 
81  scalar phiCD = gradfV & (cdWeight*phiP + (1 - cdWeight)*phiN);
82 
83  scalar phiU, phif;
84 
85  if (faceFlux > 0)
86  {
87  phiU = gradfV & phiP;
88  phif = 0.5*(phiCD + phiU + (1 - cdWeight)*(gradfV & (d & gradcP)));
89  }
90  else
91  {
92  phiU = gradfV & phiN;
93  phif = 0.5*(phiCD + phiU - cdWeight*(gradfV & (d & gradcN)));
94  }
95 
96  // Calculate the effective limiter for the QUICK interpolation
97  scalar QLimiter = (phif - phiU)/stabilise(phiCD - phiU, small);
98 
99  // Limit the limiter between upwind and downwind
100  return max(min(QLimiter, 2), 0);
101  }
102 };
103 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace Foam
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 #endif
112 
113 // ************************************************************************* //
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: QUICKV.H:68
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
QUICKVLimiter(Istream &)
Definition: QUICKV.H:64
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< DimensionedField< scalar, GeoMesh > > stabilise(const DimensionedField< scalar, GeoMesh > &dsf, const dimensioned< scalar > &ds)
Class with limiter function which returns the limiter for the quadratic-upwind differencing scheme...
Definition: QUICKV.H:57
Namespace for OpenFOAM.