FreeFOAM The Cross-Platform CFD Toolkit
gaussGrad.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fv::gaussGrad
26 
27 Description
28  Basic second-order gradient scheme using face-interpolation
29  and Gauss' theorem.
30 
31 SourceFiles
32  gaussGrad.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef gaussGrad_H
37 #define gaussGrad_H
38 
41 #include <finiteVolume/linear.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace fv
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class gaussGrad Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
58 class gaussGrad
59 :
60  public fv::gradScheme<Type>
61 {
62  // Private data
63 
64  tmp<surfaceInterpolationScheme<Type> > tinterpScheme_;
65 
66 
67  // Private Member Functions
68 
69  //- Disallow default bitwise copy construct
70  gaussGrad(const gaussGrad&);
71 
72  //- Disallow default bitwise assignment
73  void operator=(const gaussGrad&);
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("Gauss");
80 
81 
82  // Constructors
83 
84  //- Construct from mesh
86  :
87  gradScheme<Type>(mesh),
88  tinterpScheme_(new linear<Type>(mesh))
89  {}
90 
91  //- Construct from Istream
93  :
94  gradScheme<Type>(mesh),
95  tinterpScheme_(NULL)
96  {
97  if (is.eof())
98  {
99  tinterpScheme_ =
101  (
102  new linear<Type>(mesh)
103  );
104  }
105  else
106  {
107  tinterpScheme_ =
109  (
111  );
112  }
113  }
114 
115 
116  // Member Functions
117 
118  //- Return the gradient of the given field
119  // calculated using Gauss' theorem on the given surface field
120  static
121  tmp
122  <
125  > grad
126  (
128  );
129 
130 
131  //- Return the gradient of the given field calculated
132  // using Gauss' theorem on the interpolated field
133  tmp
134  <
137  > grad
138  (
140  ) const;
141 
142 
143  //- Correct the boundary values of the gradient using the patchField
144  // snGrad functions
145  static void correctBoundaryConditions
146  (
150  );
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace fv
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
165 # include <finiteVolume/gaussGrad.C>
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************ vim: set sw=4 sts=4 et: ************************ //