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