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

laplacianScheme.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::fv::laplacianScheme
00027 
00028 Description
00029     Abstract base class for laplacian schemes.
00030 
00031 SourceFiles
00032     laplacianScheme.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef laplacianScheme_H
00037 #define laplacianScheme_H
00038 
00039 #include "tmp.H"
00040 #include "volFieldsFwd.H"
00041 #include "surfaceFieldsFwd.H"
00042 #include "linear.H"
00043 #include "correctedSnGrad.H"
00044 #include "typeInfo.H"
00045 #include "runTimeSelectionTables.H"
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 template<class Type>
00053 class fvMatrix;
00054 
00055 class fvMesh;
00056 
00057 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00058 
00059 namespace fv
00060 {
00061 
00062 /*---------------------------------------------------------------------------*\
00063                            Class laplacianScheme Declaration
00064 \*---------------------------------------------------------------------------*/
00065 
00066 template<class Type, class GType>
00067 class laplacianScheme
00068 :
00069     public refCount
00070 {
00071 
00072 protected:
00073 
00074     // Protected data
00075 
00076         const fvMesh& mesh_;
00077         tmp<surfaceInterpolationScheme<GType> > tinterpGammaScheme_;
00078         tmp<snGradScheme<Type> > tsnGradScheme_;
00079 
00080 
00081     // Private Member Functions
00082 
00083         //- Disallow copy construct
00084         laplacianScheme(const laplacianScheme&);
00085 
00086         //- Disallow default bitwise assignment
00087         void operator=(const laplacianScheme&);
00088 
00089 
00090 public:
00091 
00092     //- Runtime type information
00093     virtual const word& type() const = 0;
00094 
00095 
00096     // Declare run-time constructor selection tables
00097 
00098         declareRunTimeSelectionTable
00099         (
00100             tmp,
00101             laplacianScheme,
00102             Istream,
00103             (const fvMesh& mesh, Istream& schemeData),
00104             (mesh, schemeData)
00105         );
00106 
00107 
00108     // Constructors
00109 
00110         //- Construct from mesh
00111         laplacianScheme(const fvMesh& mesh)
00112         :
00113             mesh_(mesh),
00114             tinterpGammaScheme_(new linear<GType>(mesh)),
00115             tsnGradScheme_(new correctedSnGrad<Type>(mesh))
00116         {}
00117 
00118         //- Construct from mesh and Istream
00119         laplacianScheme(const fvMesh& mesh, Istream& is)
00120         :
00121             mesh_(mesh),
00122             tinterpGammaScheme_(NULL),
00123             tsnGradScheme_(NULL)
00124         {
00125             tinterpGammaScheme_ = tmp<surfaceInterpolationScheme<GType> >
00126             (
00127                 surfaceInterpolationScheme<GType>::New(mesh, is)
00128             );
00129 
00130             tsnGradScheme_ = tmp<snGradScheme<Type> >
00131             (
00132                 snGradScheme<Type>::New(mesh, is)
00133             );
00134         }
00135 
00136         //- Construct from mesh, interpolation and snGradScheme schemes
00137         laplacianScheme
00138         (
00139             const fvMesh& mesh,
00140             const tmp<surfaceInterpolationScheme<GType> >& igs,
00141             const tmp<snGradScheme<Type> >& sngs
00142         )
00143         :
00144             mesh_(mesh),
00145             tinterpGammaScheme_(igs),
00146             tsnGradScheme_(sngs)
00147         {}
00148 
00149 
00150     // Selectors
00151 
00152         //- Return a pointer to a new laplacianScheme created on freestore
00153         static tmp<laplacianScheme<Type, GType> > New
00154         (
00155             const fvMesh& mesh,
00156             Istream& schemeData
00157         );
00158 
00159 
00160     // Destructor
00161 
00162         virtual ~laplacianScheme();
00163 
00164 
00165     // Member Functions
00166 
00167         //- Return mesh reference
00168         const fvMesh& mesh() const
00169         {
00170             return mesh_;
00171         }
00172 
00173         virtual tmp<fvMatrix<Type> > fvmLaplacian
00174         (
00175             const GeometricField<GType, fvsPatchField, surfaceMesh>&,
00176             GeometricField<Type, fvPatchField, volMesh>&
00177         ) = 0;
00178 
00179         virtual tmp<fvMatrix<Type> > fvmLaplacian
00180         (
00181             const GeometricField<GType, fvPatchField, volMesh>&,
00182             GeometricField<Type, fvPatchField, volMesh>&
00183         );
00184 
00185         virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian
00186         (
00187             const GeometricField<Type, fvPatchField, volMesh>&
00188         ) = 0;
00189 
00190         virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian
00191         (
00192             const GeometricField<GType, fvsPatchField, surfaceMesh>&,
00193             const GeometricField<Type, fvPatchField, volMesh>&
00194         ) = 0;
00195 
00196         virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian
00197         (
00198             const GeometricField<GType, fvPatchField, volMesh>&,
00199             const GeometricField<Type, fvPatchField, volMesh>&
00200         );
00201 };
00202 
00203 
00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00205 
00206 } // End namespace fv
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 } // End namespace Foam
00211 
00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00213 
00214 // Add the patch constructor functions to the hash tables
00215 
00216 #define makeFvLaplacianTypeScheme(SS, Type, GType)                             \
00217                                                                                \
00218     typedef SS<Type, GType> SS##Type##GType;                                   \
00219     defineNamedTemplateTypeNameAndDebug(SS##Type##GType, 0);                   \
00220                                                                                \
00221     laplacianScheme<Type, GType>::                                             \
00222         addIstreamConstructorToTable<SS<Type, GType> >                         \
00223     add##SS##Type##GType##IstreamConstructorToTable_;
00224 
00225 
00226 #define makeFvLaplacianScheme(SS)                                              \
00227                                                                                \
00228 makeFvLaplacianTypeScheme(SS, scalar, scalar)                                  \
00229 makeFvLaplacianTypeScheme(SS, scalar, symmTensor)                              \
00230 makeFvLaplacianTypeScheme(SS, scalar, tensor)                                  \
00231 makeFvLaplacianTypeScheme(SS, vector, scalar)                                  \
00232 makeFvLaplacianTypeScheme(SS, sphericalTensor, scalar)                         \
00233 makeFvLaplacianTypeScheme(SS, symmTensor, scalar)                              \
00234 makeFvLaplacianTypeScheme(SS, tensor, scalar)                                  \
00235 
00236 
00237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00238 
00239 #ifdef NoRepository
00240 #   include "laplacianScheme.C"
00241 #endif
00242 
00243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00244 
00245 #endif
00246 
00247 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd