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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::LimitedScheme
28
29Group
30 grpFvLimitedSurfaceInterpolationSchemes
31
32Description
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
46SourceFiles
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
61namespace Foam
62{
63
64/*---------------------------------------------------------------------------*\
65 Class LimitedScheme Declaration
66\*---------------------------------------------------------------------------*/
67
68template<class Type, class Limiter, template<class> class LimitFunc>
69class 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
90public:
91
92 //- Runtime type information
93 TypeName("LimitedScheme");
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 :
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 :
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
155#define makeLimitedSurfaceInterpolationTypeScheme\
156( \
157 SS, \
158 LIMITER, \
159 NVDTVD, \
160 LIMFUNC, \
161 TYPE \
162) \
163 \
164typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> \
165 LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_; \
166defineTemplateTypeNameAndDebugWithName \
167 (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
168 \
169surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
170<LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
171 add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
172 \
173surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
174<LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
175 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
176 \
177limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
178<LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
179 add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
180 \
181limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
182<LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>> \
183 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
184
186#define makeLimitedSurfaceInterpolationScheme(SS, LIMITER) \
187 \
188makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar) \
189makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector) \
190makeLimitedSurfaceInterpolationTypeScheme \
191( \
192 SS, \
193 LIMITER, \
194 NVDTVD, \
195 magSqr, \
196 sphericalTensor \
197) \
198makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
199makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
200
202#define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER) \
203makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
204
206#define makeLLimitedSurfaceInterpolationTypeScheme\
207( \
208 SS, \
209 LLIMITER, \
210 LIMITER, \
211 NVDTVD, \
212 LIMFUNC, \
213 TYPE \
214) \
215 \
216typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC> \
217 LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_; \
218defineTemplateTypeNameAndDebugWithName \
219 (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
220 \
221surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
222<LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
223 add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
224 \
225surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
226<LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
227 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
228 \
229limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
230<LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD>>, limitFuncs::LIMFUNC>> \
231 add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
232 \
233limitedSurfaceInterpolationScheme<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// ************************************************************************* //
surfaceScalarField & phi
Generic GeometricField class.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Class to create NVD/TVD limited weighting-factors.
Definition: LimitedScheme.H:72
LimitedScheme(const fvMesh &mesh, const surfaceScalarField &faceFlux, const Limiter &weight)
Construct from mesh and faceFlux and limiter scheme.
LimitedScheme(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &is)
Construct from mesh, faceFlux and Istream.
virtual tmp< surfaceScalarField > limiter(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
TypeName("LimitedScheme")
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Abstract base class for limited surface interpolation schemes.
const fvMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73