FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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>
65 :
67  public Limiter
68 {
69  // Private Member Functions
70 
71  //- Disallow default bitwise copy construct
73 
74  //- Disallow default bitwise assignment
75  void operator=(const LimitedScheme&);
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("LimitedScheme");
82 
83  typedef Limiter LimiterType;
84 
85  // Constructors
86 
87  //- Construct from mesh and faceFlux and limiter scheme
89  (
90  const fvMesh& mesh,
91  const surfaceScalarField& faceFlux,
92  const Limiter& weight
93  )
94  :
96  Limiter(weight)
97  {}
98 
99  //- Construct from mesh and Istream.
100  // The name of the flux field is read from the Istream and looked-up
101  // from the mesh objectRegistry
103  (
104  const fvMesh& mesh,
105  Istream& is
106  )
107  :
109  Limiter(is)
110  {}
111 
112  //- Construct from mesh, faceFlux and Istream
114  (
115  const fvMesh& mesh,
116  const surfaceScalarField& faceFlux,
117  Istream& is
118  )
119  :
121  Limiter(is)
122  {}
123 
124 
125  // Member Functions
126 
127  //- Return the interpolation weighting factors
129  (
131  ) const;
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 // Add the patch constructor functions to the hash tables
142 
143 #define makeLimitedSurfaceInterpolationTypeScheme(SS, LIMITER, NVDTVD, LIMFUNC, TYPE) \
144  \
145 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> \
146  LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_; \
147 defineTemplateTypeNameAndDebugWithName \
148  (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
149  \
150 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
151 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
152  add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
153  \
154 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
155 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
156  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
157  \
158 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
159 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
160  add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
161  \
162 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
163 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
164  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
165 
166 
167 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER) \
168  \
169 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar) \
170 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector) \
171 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,sphericalTensor) \
172 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
173 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
174 
175 
176 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER) \
177 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
178 
179 
180 #define makeLLimitedSurfaceInterpolationTypeScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC, TYPE) \
181  \
182 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> \
183  LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_; \
184 defineTemplateTypeNameAndDebugWithName \
185  (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
186  \
187 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
188 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
189  add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
190  \
191 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
192 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
193  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
194  \
195 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
196 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
197  add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
198  \
199 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
200 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
201  add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
207 # include "LimitedScheme.C"
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************ vim: set sw=4 sts=4 et: ************************ //