1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Class to create NVD/TVD limited weighting-factors.
31 The particular differencing scheme class is supplied as a template
32 argument, the weight function of which is called by the weight function
33 of this class for the internal faces as well as faces of coupled
34 patches (e.g. processor-processor patches). The weight function is
35 supplied the central-differencing weighting factor, the face-flux, the
36 cell and face gradients (from which the normalised variable
37 distribution may be created) and the cell centre distance.
39 This code organisation is both neat and efficient, allowing for
40 convenient implementation of new schemes to run on parallelised cases.
45 \*---------------------------------------------------------------------------*/
47 #ifndef LimitedScheme_H
48 #define LimitedScheme_H
50 #include "limitedSurfaceInterpolationScheme.H"
51 #include "LimitFuncs.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 /*---------------------------------------------------------------------------*\
61 Class LimitedScheme Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class Type, class Limiter, template<class> class LimitFunc>
67 public limitedSurfaceInterpolationScheme<Type>,
70 // Private Member Functions
72 //- Disallow default bitwise copy construct
73 LimitedScheme(const LimitedScheme&);
75 //- Disallow default bitwise assignment
76 void operator=(const LimitedScheme&);
81 //- Runtime type information
82 TypeName("LimitedScheme");
84 typedef Limiter LimiterType;
88 //- Construct from mesh and faceFlux and limiter scheme
92 const surfaceScalarField& faceFlux,
96 limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
100 //- Construct from mesh and Istream.
101 // The name of the flux field is read from the Istream and looked-up
102 // from the mesh objectRegistry
109 limitedSurfaceInterpolationScheme<Type>(mesh, is),
113 //- Construct from mesh, faceFlux and Istream
117 const surfaceScalarField& faceFlux,
121 limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
128 //- Return the interpolation weighting factors
129 virtual tmp<surfaceScalarField> limiter
131 const GeometricField<Type, fvPatchField, volMesh>&
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 } // End namespace Foam
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 // Add the patch constructor functions to the hash tables
144 #define makeLimitedSurfaceInterpolationTypeScheme(SS, LIMITER, NVDTVD, LIMFUNC, TYPE) \
146 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> \
147 LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_; \
148 defineTemplateTypeNameAndDebugWithName \
149 (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
151 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
152 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
153 add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
155 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
156 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
157 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
159 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
160 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
161 add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
163 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
164 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> > \
165 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
168 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER) \
170 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar) \
171 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector) \
172 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,sphericalTensor) \
173 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
174 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
177 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER) \
178 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
181 #define makeLLimitedSurfaceInterpolationTypeScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC, TYPE) \
183 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> \
184 LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_; \
185 defineTemplateTypeNameAndDebugWithName \
186 (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0); \
188 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
189 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
190 add##SS##LIMFUNC##TYPE##MeshConstructorToTable_; \
192 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
193 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
194 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_; \
196 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
197 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
198 add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_; \
200 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
201 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
202 add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 # include "LimitedScheme.C"
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 // ************************************************************************* //