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

gaussGrad.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::gaussGrad
00026 
00027 Description
00028     Basic second-order gradient scheme using face-interpolation
00029     and Gauss' theorem.
00030 
00031 SourceFiles
00032     gaussGrad.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef gaussGrad_H
00037 #define gaussGrad_H
00038 
00039 #include <finiteVolume/gradScheme.H>
00040 #include <finiteVolume/surfaceInterpolationScheme.H>
00041 #include <finiteVolume/linear.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace fv
00051 {
00052 
00053 /*---------------------------------------------------------------------------*\
00054                        Class gaussGrad Declaration
00055 \*---------------------------------------------------------------------------*/
00056 
00057 template<class Type>
00058 class gaussGrad
00059 :
00060     public fv::gradScheme<Type>
00061 {
00062     // Private data
00063 
00064         tmp<surfaceInterpolationScheme<Type> > tinterpScheme_;
00065 
00066 
00067     // Private Member Functions
00068 
00069         //- Disallow default bitwise copy construct
00070         gaussGrad(const gaussGrad&);
00071 
00072         //- Disallow default bitwise assignment
00073         void operator=(const gaussGrad&);
00074 
00075 
00076 public:
00077 
00078     //- Runtime type information
00079     TypeName("Gauss");
00080 
00081 
00082     // Constructors
00083 
00084         //- Construct from mesh
00085         gaussGrad(const fvMesh& mesh)
00086         :
00087             gradScheme<Type>(mesh),
00088             tinterpScheme_(new linear<Type>(mesh))
00089         {}
00090 
00091         //- Construct from Istream
00092         gaussGrad(const fvMesh& mesh, Istream& is)
00093         :
00094             gradScheme<Type>(mesh),
00095             tinterpScheme_(NULL)
00096         {
00097             if (is.eof())
00098             {
00099                 tinterpScheme_ =
00100                     tmp<surfaceInterpolationScheme<Type> >
00101                     (
00102                         new linear<Type>(mesh)
00103                     );
00104             }
00105             else
00106             {
00107                 tinterpScheme_ =
00108                     tmp<surfaceInterpolationScheme<Type> >
00109                     (
00110                         surfaceInterpolationScheme<Type>::New(mesh, is)
00111                     );
00112             }
00113         }
00114 
00115 
00116     // Member Functions
00117 
00118         //- Return the gradient of the given field 
00119         //  calculated using Gauss' theorem on the given surface field
00120         static
00121         tmp
00122         <
00123             GeometricField
00124             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
00125         > grad
00126         (
00127             const GeometricField<Type, fvsPatchField, surfaceMesh>&
00128         );
00129 
00130 
00131         //- Return the gradient of the given field calculated
00132         //  using Gauss' theorem on the interpolated field
00133         tmp
00134         <
00135             GeometricField
00136             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
00137         > grad
00138         (
00139             const GeometricField<Type, fvPatchField, volMesh>&
00140         ) const;
00141 
00142 
00143         //- Correct the boundary values of the gradient using the patchField
00144         // snGrad functions
00145         static void correctBoundaryConditions
00146         (
00147             const GeometricField<Type, fvPatchField, volMesh>&,
00148             GeometricField
00149             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>&
00150         );
00151 };
00152 
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 } // End namespace fv
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 } // End namespace Foam
00161 
00162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00163 
00164 #ifdef NoRepository
00165 #   include <finiteVolume/gaussGrad.C>
00166 #endif
00167 
00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00169 
00170 #endif
00171 
00172 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines