initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / finiteVolume / gradSchemes / gaussGrad / gaussGrad.H
blob8ddfe1bf7cc5fc14204775719487233097346271
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::fv::gaussGrad
28 Description
29     Basic second-order gradient scheme using face-interpolation
30     and Gauss' theorem.
32 SourceFiles
33     gaussGrad.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef gaussGrad_H
38 #define gaussGrad_H
40 #include "gradScheme.H"
41 #include "surfaceInterpolationScheme.H"
42 #include "linear.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace fv
54 /*---------------------------------------------------------------------------*\
55                        Class gaussGrad Declaration
56 \*---------------------------------------------------------------------------*/
58 template<class Type>
59 class gaussGrad
61     public fv::gradScheme<Type>
63     // Private data
65         tmp<surfaceInterpolationScheme<Type> > tinterpScheme_;
68     // Private Member Functions
70         //- Disallow default bitwise copy construct
71         gaussGrad(const gaussGrad&);
73         //- Disallow default bitwise assignment
74         void operator=(const gaussGrad&);
77 public:
79     //- Runtime type information
80     TypeName("Gauss");
83     // Constructors
85         //- Construct from mesh
86         gaussGrad(const fvMesh& mesh)
87         :
88             gradScheme<Type>(mesh),
89             tinterpScheme_(new linear<Type>(mesh))
90         {}
92         //- Construct from Istream
93         gaussGrad(const fvMesh& mesh, Istream& is)
94         :
95             gradScheme<Type>(mesh),
96             tinterpScheme_(NULL)
97         {
98             if (is.eof())
99             {
100                 tinterpScheme_ =
101                     tmp<surfaceInterpolationScheme<Type> >
102                     (
103                         new linear<Type>(mesh)
104                     );
105             }
106             else
107             {
108                 tinterpScheme_ =
109                     tmp<surfaceInterpolationScheme<Type> >
110                     (
111                         surfaceInterpolationScheme<Type>::New(mesh, is)
112                     );
113             }
114         }
117     // Member Functions
119         //- Return the gradient of the given field 
120         //  calculated using Gauss' theorem on the given surface field
121         static
122         tmp
123         <
124             GeometricField
125             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
126         > grad
127         (
128             const GeometricField<Type, fvsPatchField, surfaceMesh>&
129         );
132         //- Return the gradient of the given field calculated
133         //  using Gauss' theorem on the interpolated field
134         tmp
135         <
136             GeometricField
137             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
138         > grad
139         (
140             const GeometricField<Type, fvPatchField, volMesh>&
141         ) const;
144         //- Correct the boundary values of the gradient using the patchField
145         // snGrad functions
146         static void correctBoundaryConditions
147         (
148             const GeometricField<Type, fvPatchField, volMesh>&,
149             GeometricField
150             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>&
151         );
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 } // End namespace fv
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 } // End namespace Foam
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 #ifdef NoRepository
166 #   include "gaussGrad.C"
167 #endif
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 #endif
173 // ************************************************************************* //