initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / limitedSchemes / LimitedScheme / LimitedScheme.H
blob1df875cf7ed55e3d2a21dcaf8ae69ef75b067ed5
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::LimitedScheme
28 Description
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.
42 SourceFiles
43     LimitedScheme.C
45 \*---------------------------------------------------------------------------*/
47 #ifndef LimitedScheme_H
48 #define LimitedScheme_H
50 #include "limitedSurfaceInterpolationScheme.H"
51 #include "LimitFuncs.H"
52 #include "NVDTVD.H"
53 #include "NVDVTVDV.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 namespace Foam
60 /*---------------------------------------------------------------------------*\
61                            Class LimitedScheme Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class Type, class Limiter, template<class> class LimitFunc>
65 class LimitedScheme
67     public limitedSurfaceInterpolationScheme<Type>,
68     public Limiter
70     // Private Member Functions
72         //- Disallow default bitwise copy construct
73         LimitedScheme(const LimitedScheme&);
75         //- Disallow default bitwise assignment
76         void operator=(const LimitedScheme&);
79 public:
81     //- Runtime type information
82     TypeName("LimitedScheme");
84     typedef Limiter LimiterType;
86     // Constructors
88         //- Construct from mesh and faceFlux and limiter scheme
89         LimitedScheme
90         (
91             const fvMesh& mesh,
92             const surfaceScalarField& faceFlux,
93             const Limiter& weight
94         )
95         :
96             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
97             Limiter(weight)
98         {}
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
103         LimitedScheme
104         (
105             const fvMesh& mesh,
106             Istream& is
107         )
108         :
109             limitedSurfaceInterpolationScheme<Type>(mesh, is),
110             Limiter(is)
111         {}
113         //- Construct from mesh, faceFlux and Istream
114         LimitedScheme
115         (
116             const fvMesh& mesh,
117             const surfaceScalarField& faceFlux,
118             Istream& is
119         )
120         :
121             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
122             Limiter(is)
123         {}
126     // Member Functions
128         //- Return the interpolation weighting factors
129         virtual tmp<surfaceScalarField> limiter
130         (
131             const GeometricField<Type, fvPatchField, volMesh>&
132         ) const;
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 } // End namespace Foam
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 // Add the patch constructor functions to the hash tables
144 #define makeLimitedSurfaceInterpolationTypeScheme(SS, LIMITER, NVDTVD, LIMFUNC, TYPE) \
145                                                                               \
146 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>             \
147     LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_;                         \
148 defineTemplateTypeNameAndDebugWithName                                        \
149     (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);               \
150                                                                               \
151 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
152 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
153     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
154                                                                               \
155 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
156 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
157     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
158                                                                               \
159 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
160 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
161     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
162                                                                               \
163 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
164 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
165     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
168 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER)                    \
169                                                                               \
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) \
182                                                                               \
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);     \
187                                                                               \
188 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
189 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
190     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
191                                                                               \
192 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
193 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
194     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
195                                                                               \
196 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
197 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
198     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
199                                                                               \
200 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
201 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
202     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 #ifdef NoRepository
208 #   include "LimitedScheme.C"
209 #endif
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 #endif
215 // ************************************************************************* //