OpenFOAM logo
Open Source CFD Toolkit

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