LimitedScheme.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-2016 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::LimitedScheme
28 
29 Group
30  grpFvLimitedSurfaceInterpolationSchemes
31 
32 Description
33  Class to create NVD/TVD limited weighting-factors.
34 
35  The particular differencing scheme class is supplied as a template
36  argument, the weight function of which is called by the weight function
37  of this class for the internal faces as well as faces of coupled
38  patches (e.g. processor-processor patches). The weight function is
39  supplied the central-differencing weighting factor, the face-flux, the
40  cell and face gradients (from which the normalised variable
41  distribution may be created) and the cell centre distance.
42 
43  This code organisation is both neat and efficient, allowing for
44  convenient implementation of new schemes to run on parallelised cases.
45 
46 SourceFiles
47  LimitedScheme.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef LimitedScheme_H
52 #define LimitedScheme_H
53 
55 #include "LimitFuncs.H"
56 #include "NVDTVD.H"
57 #include "NVDVTVDV.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class LimitedScheme Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class Type, class Limiter, template<class> class LimitFunc>
69 class LimitedScheme
70 :
72  public Limiter
73 {
74  // Private Member Functions
75 
76  //- Calculate the limiter
77  void calcLimiter
78  (
80  surfaceScalarField& limiterField
81  ) const;
82 
83  //- No copy construct
84  LimitedScheme(const LimitedScheme&) = delete;
85 
86  //- No copy assignment
87  void operator=(const LimitedScheme&) = delete;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("LimitedScheme");
94 
95  typedef Limiter LimiterType;
96 
97  // Constructors
98 
99  //- Construct from mesh and faceFlux and limiter scheme
101  (
102  const fvMesh& mesh,
103  const surfaceScalarField& faceFlux,
104  const Limiter& weight
105  )
106  :
107  limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
108  Limiter(weight)
109  {}
110 
111  //- Construct from mesh and Istream.
112  // The name of the flux field is read from the Istream and looked-up
113  // from the mesh objectRegistry
115  (
116  const fvMesh& mesh,
117  Istream& is
118  )
119  :
121  Limiter(is)
122  {}
123 
124  //- Construct from mesh, faceFlux and Istream
126  (
127  const fvMesh& mesh,
128  const surfaceScalarField& faceFlux,
129  Istream& is
130  )
131  :
132  limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
133  Limiter(is)
134  {}
135 
136 
137  // Member Functions
138 
139  //- Return the interpolation weighting factors
141  (
143  ) const;
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 // Add the patch constructor functions to the hash tables
154 
155 #define makeLimitedSurfaceInterpolationTypeScheme\
156 ( \
157  SS, \
158  LIMITER, \
159  NVDTVD, \
160  LIMFUNC, \
161  TYPE \
162 ) \
163  \
164 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> \
165  LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_; \
166 defineTemplateTypeNameAndDebugWithName \
167  (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
168  \
169 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
170 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
171  add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
172  \
173 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
174 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
175  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
176  \
177 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
178 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
179  add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
180  \
181 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
182 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
183  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
184 
185 
186 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER) \
187  \
188 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar) \
189 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector) \
190 makeLimitedSurfaceInterpolationTypeScheme \
191 ( \
192  SS, \
193  LIMITER, \
194  NVDTVD, \
195  magSqr, \
196  sphericalTensor \
197 ) \
198 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
199 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
200 
201 
202 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER) \
203 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
204 
205 
206 #define makeLLimitedSurfaceInterpolationTypeScheme\
207 ( \
208  SS, \
209  LLIMITER, \
210  LIMITER, \
211  NVDTVD, \
212  LIMFUNC, \
213  TYPE \
214 ) \
215  \
216 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC> \
217  LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_; \
218 defineTemplateTypeNameAndDebugWithName \
219  (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
220  \
221 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
222 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
223  add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
224  \
225 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
226 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
227  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
228  \
229 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
230 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
231  add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
232  \
233 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
234 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
235  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #ifdef NoRepository
241  #include "LimitedScheme.C"
242 #endif
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #endif
247 
248 // ************************************************************************* //
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::LimitedScheme::TypeName
TypeName("LimitedScheme")
Runtime type information.
Foam::LimitedScheme::limiter
virtual tmp< surfaceScalarField > limiter(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: LimitedScheme.C:144
Foam::LimitedScheme
Class to create NVD/TVD limited weighting-factors.
Definition: LimitedScheme.H:68
NVDVTVDV.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::LimitedScheme::LimiterType
Limiter LimiterType
Definition: LimitedScheme.H:94
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::limitedSurfaceInterpolationScheme
Abstract base class for limited surface interpolation schemes.
Definition: limitedSurfaceInterpolationScheme.H:54
limitedSurfaceInterpolationScheme.H
LimitFuncs.H
Foam::surfaceInterpolationScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: surfaceInterpolationScheme.H:144
NVDTVD.H
Foam::GeometricField< Type, fvPatchField, volMesh >
LimitedScheme.C