gaussGrad.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 public:
68 
69  //- Runtime type information
70  TypeName("Gauss");
71 
72 
73  // Constructors
74 
75  //- Construct from mesh
76  gaussGrad(const fvMesh& mesh)
77  :
78  gradScheme<Type>(mesh),
79  tinterpScheme_(new linear<Type>(mesh))
80  {}
81 
82  //- Construct from mesh and Istream
83  gaussGrad(const fvMesh& mesh, Istream& is)
84  :
85  gradScheme<Type>(mesh),
86  tinterpScheme_(nullptr)
87  {
88  if (is.eof())
89  {
90  tinterpScheme_ =
92  (
93  new linear<Type>(mesh)
94  );
95  }
96  else
97  {
98  tinterpScheme_ =
100  (
102  );
103  }
104  }
105 
106  //- Disallow default bitwise copy construction
107  gaussGrad(const gaussGrad&) = delete;
108 
109 
110  // Member Functions
111 
112  //- Return the gradient of the given field
113  // calculated using Gauss' theorem on the given surface field
114  static
115  tmp
116  <
119  > gradf
120  (
122  const word& name
123  );
124 
125  //- Return the gradient of the given field to the gradScheme::grad
126  // for optional caching
127  virtual tmp
128  <
130  <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
131  > calcGrad
132  (
134  const word& name
135  ) const;
136 
137  //- Correct the boundary values of the gradient using the patchField
138  // snGrad functions
139  static void correctBoundaryConditions
140  (
143  <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>&
144  );
145 
146 
147  // Member Operators
148 
149  //- Disallow default bitwise assignment
150  void operator=(const gaussGrad&) = delete;
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 // ************************************************************************* //
Centred interpolation 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:66
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.
void operator=(const gaussGrad &)=delete
Disallow default bitwise assignment.
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
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)
gaussGrad(const fvMesh &mesh)
Construct from mesh.
Definition: gaussGrad.H:75
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:336
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:138
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:95
TypeName("Gauss")
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:53
const fvMesh & mesh() const
Return mesh reference.
Definition: gradScheme.H:122
Namespace for OpenFOAM.