OpenFOAM logo
Open Source CFD Toolkit

gaussFaGrad.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     gaussGrad
00027 
00028 Description
00029     Basic second-order gradient scheme using face-interpolation
00030     and Gauss' theorem.
00031 
00032 SourceFiles
00033     gaussFaGrad.C
00034     gaussFaGrads.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef gaussFaGrad_H
00039 #define gaussFaGrad_H
00040 
00041 #include "faGradScheme.H"
00042 #include "edgeInterpolationScheme.H"
00043 #include "linearEdgeInterpolation.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace fa
00053 {
00054 
00055 /*---------------------------------------------------------------------------*\
00056                        Class gaussGrad Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 template<class Type>
00060 class gaussGrad
00061 :
00062     public fa::gradScheme<Type>
00063 {
00064     // Private data
00065 
00066         tmp<edgeInterpolationScheme<Type> > tinterpScheme_;
00067  
00068 
00069     // Private Member Functions
00070 
00071         //- Disallow default bitwise copy construct
00072         gaussGrad(const gaussGrad&);
00073 
00074         //- Disallow default bitwise assignment
00075         void operator=(const gaussGrad&);
00076 
00077 
00078 public:
00079 
00080     //- Runtime type information
00081     TypeName("Gauss");
00082 
00083 
00084     // Constructors
00085 
00086         //- Construct from mesh
00087         gaussGrad(const faMesh& mesh)
00088         :
00089             gradScheme<Type>(mesh),
00090             tinterpScheme_(new linearEdgeInterpolation<Type>(mesh))
00091         {}
00092 
00093         //- Construct from Istream
00094         gaussGrad(const faMesh& mesh, Istream& is)
00095         :
00096             gradScheme<Type>(mesh),
00097             tinterpScheme_(NULL)
00098         {
00099             if (is.eof())
00100             {
00101                 tinterpScheme_ =
00102                     tmp<edgeInterpolationScheme<Type> >
00103                     (
00104                         new linearEdgeInterpolation<Type>(mesh)
00105                     );
00106             }
00107             else
00108             {
00109                 tinterpScheme_ =
00110                     tmp<edgeInterpolationScheme<Type> >
00111                     (
00112                         edgeInterpolationScheme<Type>::New(mesh, is)
00113                     );
00114             }
00115         }
00116 
00117 
00118     // Member Functions
00119 
00120         tmp
00121         <
00122             GeometricField
00123             <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>
00124         > grad
00125         (
00126             const GeometricField<Type, faPatchField, areaMesh>&
00127         );
00128 };
00129 
00130 
00131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00132 
00133 } // End namespace fa
00134 
00135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00136 
00137 } // End namespace Foam
00138 
00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00140 
00141 #ifdef NoRepository
00142 #   include "gaussFaGrad.C"
00143 #endif
00144 
00145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00146 
00147 #endif
00148 
00149 // ************************************************************************* //
For further information go to www.openfoam.org