FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::LimitedScheme
00026 
00027 Description
00028     Class to create NVD/TVD limited weighting-factors.
00029 
00030     The particular differencing scheme class is supplied as a template
00031     argument, the weight function of which is called by the weight function
00032     of this class for the internal faces as well as faces of coupled
00033     patches (e.g. processor-processor patches). The weight function is
00034     supplied the central-differencing weighting factor, the face-flux, the
00035     cell and face gradients (from which the normalised variable
00036     distribution may be created) and the cell centre distance.
00037 
00038     This code organisation is both neat and efficient, allowing for
00039     convenient implementation of new schemes to run on parallelised cases.
00040 
00041 SourceFiles
00042     LimitedScheme.C
00043 
00044 \*---------------------------------------------------------------------------*/
00045 
00046 #ifndef LimitedScheme_H
00047 #define LimitedScheme_H
00048 
00049 #include <finiteVolume/limitedSurfaceInterpolationScheme.H>
00050 #include "LimitFuncs.H"
00051 #include "NVDTVD.H"
00052 #include "NVDVTVDV.H"
00053 
00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00055 
00056 namespace Foam
00057 {
00058 
00059 /*---------------------------------------------------------------------------*\
00060                            Class LimitedScheme Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class Type, class Limiter, template<class> class LimitFunc>
00064 class LimitedScheme
00065 :
00066     public limitedSurfaceInterpolationScheme<Type>,
00067     public Limiter
00068 {
00069     // Private Member Functions
00070 
00071         //- Disallow default bitwise copy construct
00072         LimitedScheme(const LimitedScheme&);
00073 
00074         //- Disallow default bitwise assignment
00075         void operator=(const LimitedScheme&);
00076 
00077 
00078 public:
00079 
00080     //- Runtime type information
00081     TypeName("LimitedScheme");
00082 
00083     typedef Limiter LimiterType;
00084 
00085     // Constructors
00086 
00087         //- Construct from mesh and faceFlux and limiter scheme
00088         LimitedScheme
00089         (
00090             const fvMesh& mesh,
00091             const surfaceScalarField& faceFlux,
00092             const Limiter& weight
00093         )
00094         :
00095             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
00096             Limiter(weight)
00097         {}
00098 
00099         //- Construct from mesh and Istream. 
00100         //  The name of the flux field is read from the Istream and looked-up
00101         //  from the mesh objectRegistry
00102         LimitedScheme
00103         (
00104             const fvMesh& mesh,
00105             Istream& is
00106         )
00107         :
00108             limitedSurfaceInterpolationScheme<Type>(mesh, is),
00109             Limiter(is)
00110         {}
00111 
00112         //- Construct from mesh, faceFlux and Istream
00113         LimitedScheme
00114         (
00115             const fvMesh& mesh,
00116             const surfaceScalarField& faceFlux,
00117             Istream& is
00118         )
00119         :
00120             limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
00121             Limiter(is)
00122         {}
00123 
00124 
00125     // Member Functions
00126 
00127         //- Return the interpolation weighting factors
00128         virtual tmp<surfaceScalarField> limiter
00129         (
00130             const GeometricField<Type, fvPatchField, volMesh>&
00131         ) const;
00132 };
00133 
00134 
00135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00136 
00137 } // End namespace Foam
00138 
00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00140 
00141 // Add the patch constructor functions to the hash tables
00142 
00143 #define makeLimitedSurfaceInterpolationTypeScheme(SS, LIMITER, NVDTVD, LIMFUNC, TYPE) \
00144                                                                               \
00145 typedef LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC>             \
00146     LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_;                         \
00147 defineTemplateTypeNameAndDebugWithName                                        \
00148     (LimitedScheme##TYPE##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);               \
00149                                                                               \
00150 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
00151 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00152     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
00153                                                                               \
00154 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
00155 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00156     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
00157                                                                               \
00158 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
00159 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00160     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
00161                                                                               \
00162 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
00163 <LimitedScheme<TYPE, LIMITER<NVDTVD>, limitFuncs::LIMFUNC> >                  \
00164     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
00165 
00166 
00167 #define makeLimitedSurfaceInterpolationScheme(SS, LIMITER)                    \
00168                                                                               \
00169 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,scalar)    \
00170 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,vector)    \
00171 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,sphericalTensor) \
00172 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,symmTensor)\
00173 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDTVD,magSqr,tensor)
00174 
00175 
00176 #define makeLimitedVSurfaceInterpolationScheme(SS, LIMITER)                   \
00177 makeLimitedSurfaceInterpolationTypeScheme(SS,LIMITER,NVDVTVDV,null,vector)
00178 
00179 
00180 #define makeLLimitedSurfaceInterpolationTypeScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC, TYPE) \
00181                                                                               \
00182 typedef LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC>  \
00183     LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_;               \
00184 defineTemplateTypeNameAndDebugWithName                                        \
00185     (LimitedScheme##TYPE##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);     \
00186                                                                               \
00187 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable                   \
00188 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00189     add##SS##LIMFUNC##TYPE##MeshConstructorToTable_;                          \
00190                                                                               \
00191 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable               \
00192 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00193     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToTable_;                      \
00194                                                                               \
00195 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable            \
00196 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00197     add##SS##LIMFUNC##TYPE##MeshConstructorToLimitedTable_;                   \
00198                                                                               \
00199 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable        \
00200 <LimitedScheme<TYPE, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> >       \
00201     add##SS##LIMFUNC##TYPE##MeshFluxConstructorToLimitedTable_;
00202 
00203 
00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00205 
00206 #ifdef NoRepository
00207 #   include "LimitedScheme.C"
00208 #endif
00209 
00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00211 
00212 #endif
00213 
00214 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines