BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / limitedSchemes / LimitedScheme / LimitedScheme.H
blob718a2e6a77fdb3a8619702896e5a1672e02a1aa8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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/>.
24 Class
25     Foam::LimitedScheme
27 Description
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.
41 SourceFiles
42     LimitedScheme.C
44 \*---------------------------------------------------------------------------*/
46 #ifndef LimitedScheme_H
47 #define LimitedScheme_H
49 #include "limitedSurfaceInterpolationScheme.H"
50 #include "LimitFuncs.H"
51 #include "NVDTVD.H"
52 #include "NVDVTVDV.H"
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 namespace Foam
59 /*---------------------------------------------------------------------------*\
60                            Class LimitedScheme Declaration
61 \*---------------------------------------------------------------------------*/
63 template<class Type, class Limiter, template<class> class LimitFunc>
64 class LimitedScheme
66     public limitedSurfaceInterpolationScheme<Type>,
67     public Limiter
69     // Private Member Functions
71         //- Disallow default bitwise copy construct
72         LimitedScheme(const LimitedScheme&);
74         //- Disallow default bitwise assignment
75         void operator=(const LimitedScheme&);
78 public:
80     //- Runtime type information
81     TypeName("LimitedScheme");
83     typedef Limiter LimiterType;
85     // Constructors
87         //- Construct from mesh and faceFlux and limiter scheme
88         LimitedScheme
89         (
90             const fvMesh& mesh,
91             const surfaceScalarField& faceFlux,
92             const Limiter& weight
93         )
94         :
95             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
96             Limiter(weight)
97         {}
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
102         LimitedScheme
103         (
104             const fvMesh& mesh,
105             Istream& is
106         )
107         :
108             limitedSurfaceInterpolationScheme<Type>(mesh, is),
109             Limiter(is)
110         {}
112         //- Construct from mesh, faceFlux and Istream
113         LimitedScheme
114         (
115             const fvMesh& mesh,
116             const surfaceScalarField& faceFlux,
117             Istream& is
118         )
119         :
120             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
121             Limiter(is)
122         {}
125     // Member Functions
127         //- Return the interpolation weighting factors
128         virtual tmp<surfaceScalarField> limiter
129         (
130             const GeometricField<Type, fvPatchField, volMesh>&
131         ) const;
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 // Add the patch constructor functions to the hash tables
143 #define makeLimitedSurfaceInterpolationTypeScheme\
144 (                                                                             \
145     SS,                                                                       \
146     LIMITER,                                                                  \
147     NVDTVD,                                                                   \
148     LIMFUNC,                                                                  \
149     TYPE                                                                      \
150 )                                                                             \
151                                                                               \
152 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>             \
153     LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_;                         \
154 defineTemplateTypeNameAndDebugWithName                                        \
155     (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);               \
156                                                                               \
157 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
158 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
159     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
160                                                                               \
161 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
162 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
163     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
164                                                                               \
165 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
166 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
167     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
168                                                                               \
169 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
170 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
171     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
174 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER)                    \
175                                                                               \
176 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar)    \
177 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector)    \
178 makeLimitedSurfaceInterpolationTypeScheme                                     \
179 (                                                                             \
180     SS,                                                                       \
181     LIMITER,                                                                  \
182     NVDTVD,                                                                   \
183     magSqr,                                                                   \
184     sphericalTensor                                                           \
185 )                                                                             \
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\
195 (                                                                             \
196     SS,                                                                       \
197     LLIMITER,                                                                 \
198     LIMITER,                                                                  \
199     NVDTVD,                                                                   \
200     LIMFUNC,                                                                  \
201     TYPE                                                                      \
202 )                                                                             \
203                                                                               \
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);     \
208                                                                               \
209 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
210 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
211     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
212                                                                               \
213 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
214 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
215     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
216                                                                               \
217 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
218 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
219     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
220                                                                               \
221 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
222 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
223     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 #ifdef NoRepository
229 #   include "LimitedScheme.C"
230 #endif
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 #endif
236 // ************************************************************************* //