OpenFOAM logo
Open Source CFD Toolkit

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-2005 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     LimitedScheme
00027 
00028 Description
00029 
00030     Class to create NVD/TVD limited weighting-factors.
00031     The particular differencing scheme class is supplied as a template argument,
00032     the weight function of which is called by the weight function of this class
00033     for the internal faces as well as faces of coupled patches
00034     (e.g. processor-processor patches). The weight function is supplied the
00035     central-differencing weighting factor, the face-flux, the cell and face
00036     gradients (from which the normalised variable distribution may be created)
00037     and the cell centre distance.
00038 
00039     This code organisation is both neat and efficient, allowing for convenient
00040     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,tensor)
00173 
00174 
00175 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER)                    \
00176 makeLimitedSurfaceInterpolationTypeScheme(SS##V,LIMITER,NVDVTVDV,null,vector)
00177 
00178 
00179 #define makeLLimitedSurfaceInterpolationTypeScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC, TYPE) \
00180                                                                                \
00181 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC>   \
00182     LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_;                \
00183 defineTemplateTypeNameAndDebugWithName                                         \
00184     (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);      \
00185                                                                                \
00186 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                    \
00187 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >        \
00188     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                           \
00189                                                                                \
00190 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable                \
00191 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >        \
00192     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                       \
00193                                                                                \
00194 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable             \
00195 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >        \
00196     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                    \
00197                                                                                \
00198 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable         \
00199 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >        \
00200     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
00201 
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 #ifdef NoRepository
00206 #   include "LimitedScheme.C"
00207 #endif
00208 
00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00210 
00211 #endif
00212 
00213 // ************************************************************************* //
For further information go to www.openfoam.org