OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

LimitedScheme.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::LimitedScheme
00027 
00028 Description
00029     Class to create NVD/TVD limited weighting-factors.
00030 
00031     The particular differencing scheme class is supplied as a template
00032     argument, the weight function of which is called by the weight function
00033     of this class for the internal faces as well as faces of coupled
00034     patches (e.g. processor-processor patches). The weight function is
00035     supplied the central-differencing weighting factor, the face-flux, the
00036     cell and face gradients (from which the normalised variable
00037     distribution may be created) and the cell centre distance.
00038 
00039     This code organisation is both neat and efficient, allowing for
00040     convenient implementation of new schemes to run on parallelised cases.
00041 
00042 SourceFiles
00043     LimitedScheme.C
00044 
00045 \*---------------------------------------------------------------------------*/
00046 
00047 #ifndef LimitedScheme_H
00048 #define LimitedScheme_H
00049 
00050 #include "limitedSurfaceInterpolationScheme.H"
00051 #include "LimitFuncs.H"
00052 #include "NVDTVD.H"
00053 #include "NVDVTVDV.H"
00054 
00055 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00056 
00057 namespace Foam
00058 {
00059 
00060 /*---------------------------------------------------------------------------*\
00061                            Class LimitedScheme Declaration
00062 \*---------------------------------------------------------------------------*/
00063 
00064 template<class Type, class Limiter, template<class> class LimitFunc>
00065 class LimitedScheme
00066 :
00067     public limitedSurfaceInterpolationScheme<Type>,
00068     public Limiter
00069 {
00070     // Private Member Functions
00071 
00072         //- Disallow default bitwise copy construct
00073         LimitedScheme(const LimitedScheme&);
00074 
00075         //- Disallow default bitwise assignment
00076         void operator=(const LimitedScheme&);
00077 
00078 
00079 public:
00080 
00081     //- Runtime type information
00082     TypeName("LimitedScheme");
00083 
00084     typedef Limiter LimiterType;
00085 
00086     // Constructors
00087 
00088         //- Construct from mesh and faceFlux and limiter scheme
00089         LimitedScheme
00090         (
00091             const fvMesh& mesh,
00092             const surfaceScalarField& faceFlux,
00093             const Limiter& weight
00094         )
00095         :
00096             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
00097             Limiter(weight)
00098         {}
00099 
00100         //- Construct from mesh and Istream. 
00101         //  The name of the flux field is read from the Istream and looked-up
00102         //  from the mesh objectRegistry
00103         LimitedScheme
00104         (
00105             const fvMesh& mesh,
00106             Istream& is
00107         )
00108         :
00109             limitedSurfaceInterpolationScheme<Type>(mesh, is),
00110             Limiter(is)
00111         {}
00112 
00113         //- Construct from mesh, faceFlux and Istream
00114         LimitedScheme
00115         (
00116             const fvMesh& mesh,
00117             const surfaceScalarField& faceFlux,
00118             Istream& is
00119         )
00120         :
00121             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
00122             Limiter(is)
00123         {}
00124 
00125 
00126     // Member Functions
00127 
00128         //- Return the interpolation weighting factors
00129         virtual tmp<surfaceScalarField> limiter
00130         (
00131             const GeometricField<Type, fvPatchField, volMesh>&
00132         ) const;
00133 };
00134 
00135 
00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00137 
00138 } // End namespace Foam
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 // Add the patch constructor functions to the hash tables
00143 
00144 #define makeLimitedSurfaceInterpolationTypeScheme(SS, LIMITER, NVDTVD, LIMFUNC, TYPE) \
00145                                                                               \
00146 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>             \
00147     LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_;                         \
00148 defineTemplateTypeNameAndDebugWithName                                        \
00149     (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);               \
00150                                                                               \
00151 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
00152 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00153     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
00154                                                                               \
00155 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
00156 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00157     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
00158                                                                               \
00159 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
00160 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00161     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
00162                                                                               \
00163 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
00164 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00165     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
00166 
00167 
00168 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER)                    \
00169                                                                               \
00170 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar)    \
00171 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector)    \
00172 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,sphericalTensor) \
00173 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
00174 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
00175 
00176 
00177 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER)                   \
00178 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
00179 
00180 
00181 #define makeLLimitedSurfaceInterpolationTypeScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC, TYPE) \
00182                                                                               \
00183 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC>  \
00184     LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_;               \
00185 defineTemplateTypeNameAndDebugWithName                                        \
00186     (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);     \
00187                                                                               \
00188 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
00189 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00190     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
00191                                                                               \
00192 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
00193 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00194     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
00195                                                                               \
00196 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
00197 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00198     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
00199                                                                               \
00200 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
00201 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00202     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
00203 
00204 
00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00206 
00207 #ifdef NoRepository
00208 #   include "LimitedScheme.C"
00209 #endif
00210 
00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00212 
00213 #endif
00214 
00215 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd