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) 2011-2016 OpenFOAM Foundation
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 
39 #include "gradScheme.H"
41 #include "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 
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
85  gaussGrad(const fvMesh& mesh)
86  :
87  gradScheme<Type>(mesh),
88  tinterpScheme_(new linear<Type>(mesh))
89  {}
90 
91  //- Construct from mesh and Istream
92  gaussGrad(const fvMesh& mesh, Istream& is)
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  > gradf
126  (
128  const word& name
129  );
130 
131  //- Return the gradient of the given field to the gradScheme::grad
132  // for optional caching
133  virtual tmp
134  <
136  <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
137  > calcGrad
138  (
140  const word& name
141  ) const;
142 
143  //- Correct the boundary values of the gradient using the patchField
144  // snGrad functions
145  static void correctBoundaryConditions
146  (
149  <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>&
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 "gaussGrad.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:339
Central-differencing interpolation scheme class.
Definition: linear.H:50
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
static tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > gradf(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const word &name)
Return the gradient of the given field.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:90
Basic second-order gradient scheme using face-interpolation and Gauss&#39; theorem.
Definition: gaussGrad.H:57
Generic GeometricField class.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad.
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:53
const fvMesh & mesh() const
Return mesh reference.
Definition: gradScheme.H:122
A class for handling words, derived from string.
Definition: word.H:59
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
labelList fv(nPoints)
static void correctBoundaryConditions(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > &)
Correct the boundary values of the gradient using the patchField.
Definition: gaussGrad.C:145
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Abstract base class for gradient schemes.
Definition: gradScheme.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("Gauss")
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:54
Namespace for OpenFOAM.