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

snGradScheme.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::fv::snGradScheme
00026 
00027 Description
00028     Abstract base class for snGrad schemes.
00029 
00030 SourceFiles
00031     snGradScheme.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef snGradScheme_H
00036 #define snGradScheme_H
00037 
00038 #include <OpenFOAM/tmp.H>
00039 #include <finiteVolume/volFieldsFwd.H>
00040 #include <finiteVolume/surfaceFieldsFwd.H>
00041 #include <OpenFOAM/typeInfo.H>
00042 #include <OpenFOAM/runTimeSelectionTables.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 class fvMesh;
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace fv
00054 {
00055 
00056 /*---------------------------------------------------------------------------*\
00057                  Class snGradScheme Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 template<class Type>
00061 class snGradScheme
00062 :
00063     public refCount
00064 {
00065     // Private data
00066 
00067         //- Hold reference to mesh
00068         const fvMesh& mesh_;
00069 
00070 
00071     // Private Member Functions
00072 
00073         //- Disallow default bitwise assignment
00074         void operator=(const snGradScheme&);
00075 
00076 
00077 public:
00078 
00079     //- Runtime type information
00080     virtual const word& type() const = 0;
00081 
00082 
00083     // Declare run-time constructor selection tables
00084 
00085         declareRunTimeSelectionTable
00086         (
00087             tmp,
00088             snGradScheme,
00089             Mesh,
00090             (const fvMesh& mesh, Istream& schemeData),
00091             (mesh, schemeData)
00092         );
00093 
00094 
00095     // Constructors
00096 
00097         //- Construct from mesh
00098         snGradScheme(const fvMesh& mesh)
00099         :
00100             mesh_(mesh)
00101         {}
00102 
00103 
00104     // Selectors
00105 
00106         //- Return new tmp interpolation scheme
00107         static tmp<snGradScheme<Type> > New
00108         (
00109             const fvMesh& mesh,
00110             Istream& schemeData
00111         );
00112 
00113 
00114     // Destructor
00115 
00116         virtual ~snGradScheme();
00117 
00118 
00119     // Member Functions
00120 
00121         //- Return mesh reference
00122         const fvMesh& mesh() const
00123         {
00124             return mesh_;
00125         }
00126 
00127 
00128         //- Return the snGrad of the given cell field with the given deltaCoeffs
00129         static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00130         snGrad
00131         (
00132             const GeometricField<Type, fvPatchField, volMesh>&,
00133             const tmp<surfaceScalarField>&,
00134             const word& snGradName = "snGrad"
00135         );
00136 
00137         //- Return the interpolation weighting factors for the given field
00138         virtual tmp<surfaceScalarField> deltaCoeffs
00139         (
00140             const GeometricField<Type, fvPatchField, volMesh>&
00141         ) const = 0;
00142 
00143         //- Return true if this scheme uses an explicit correction
00144         virtual bool corrected() const
00145         {
00146             return false;
00147         }
00148 
00149         //- Return the explicit correction to the snGrad
00150         //  for the given field
00151         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00152         correction(const GeometricField<Type, fvPatchField, volMesh>&) const
00153         {
00154             return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
00155         }
00156 
00157         //- Return the snGrad of the given cell field
00158         //  with explicit correction
00159         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00160         snGrad(const GeometricField<Type, fvPatchField, volMesh>&) const;
00161 
00162         //- Return the snGrad of the given tmp cell field
00163         //  with explicit correction
00164         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00165         snGrad
00166         (
00167             const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00168         ) const;
00169 };
00170 
00171 
00172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00173 
00174 } // End namespace fv
00175 
00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00177 
00178 } // End namespace Foam
00179 
00180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00181 
00182 // Add the patch constructor functions to the hash tables
00183 
00184 #define makeSnGradTypeScheme(SS, Type)                                         \
00185                                                                                \
00186 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00187                                                                                \
00188 snGradScheme<Type>::addMeshConstructorToTable<SS<Type> >                       \
00189     add##SS##Type##MeshConstructorToTable_;
00190 
00191 #define makeSnGradScheme(SS)                                                   \
00192                                                                                \
00193 makeSnGradTypeScheme(SS, scalar)                                               \
00194 makeSnGradTypeScheme(SS, vector)                                               \
00195 makeSnGradTypeScheme(SS, sphericalTensor)                                      \
00196 makeSnGradTypeScheme(SS, symmTensor)                                           \
00197 makeSnGradTypeScheme(SS, tensor)
00198 
00199 
00200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00201 
00202 #ifdef NoRepository
00203 #   include <finiteVolume/snGradScheme.C>
00204 #endif
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 #endif
00209 
00210 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines