1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Class to create NVD/TVD limited weighting-factors.
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.
38 This code organisation is both neat and efficient, allowing for
39 convenient implementation of new schemes to run on parallelised cases.
44 \*---------------------------------------------------------------------------*/
46 #ifndef LimitedScheme_H
47 #define LimitedScheme_H
49 #include "limitedSurfaceInterpolationScheme.H"
50 #include "LimitFuncs.H"
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 /*---------------------------------------------------------------------------*\
60 Class LimitedScheme Declaration
61 \*---------------------------------------------------------------------------*/
63 template<class Type, class Limiter, template<class> class LimitFunc>
66 public limitedSurfaceInterpolationScheme<Type>,
69 // Private Member Functions
71 //- Disallow default bitwise copy construct
72 LimitedScheme(const LimitedScheme&);
74 //- Disallow default bitwise assignment
75 void operator=(const LimitedScheme&);
80 //- Runtime type information
81 TypeName("LimitedScheme");
83 typedef Limiter LimiterType;
87 //- Construct from mesh and faceFlux and limiter scheme
91 const surfaceScalarField& faceFlux,
95 limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
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
108 limitedSurfaceInterpolationScheme<Type>(mesh, is),
112 //- Construct from mesh, faceFlux and Istream
116 const surfaceScalarField& faceFlux,
120 limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
127 //- Return the interpolation weighting factors
128 virtual tmp<surfaceScalarField> limiter
130 const GeometricField<Type, fvPatchField, volMesh>&
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 // Add the patch constructor functions to the hash tables
143 #define makeLimitedSurfaceInterpolationTypeScheme\
152 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> \
153 LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_; \
154 defineTemplateTypeNameAndDebugWithName \
155 (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
157 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
158 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
159 add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
161 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
162 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
163 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
165 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
166 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
167 add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
169 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
170 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
171 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
174 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER) \
176 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar) \
177 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector) \
178 makeLimitedSurfaceInterpolationTypeScheme \
186 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
187 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
190 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER) \
191 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
194 #define makeLLimitedSurfaceInterpolationTypeScheme\
204 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> \
205 LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_; \
206 defineTemplateTypeNameAndDebugWithName \
207 (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
209 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
210 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
211 add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
213 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
214 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
215 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
217 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
218 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
219 add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
221 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
222 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
223 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 # include "LimitedScheme.C"
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 // ************************************************************************* //