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-2023 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 
63 protected:
64 
65  // Protected Data
66 
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("Gauss");
74 
75 
76  // Constructors
77 
78  //- Construct from mesh
79  gaussGrad(const fvMesh& mesh)
80  :
81  gradScheme<Type>(mesh),
82  tinterpScheme_(new linear<Type>(mesh))
83  {}
84 
85  //- Construct from mesh and Istream
86  gaussGrad(const fvMesh& mesh, Istream& is)
87  :
88  gradScheme<Type>(mesh),
89  tinterpScheme_(nullptr)
90  {
91  if (is.eof())
92  {
95  (
96  new linear<Type>(mesh)
97  );
98  }
99  else
100  {
103  (
105  );
106  }
107  }
108 
109  //- Disallow default bitwise copy construction
110  gaussGrad(const gaussGrad&) = delete;
111 
112 
113  // Member Functions
114 
115  //- Return the gradient of the given field
116  // calculated using Gauss' theorem on the given surface field
118  gradf
119  (
120  const SurfaceField<Type>&,
121  const word& name
122  );
123 
124  //- Return the gradient of the given field to the gradScheme::grad
125  // for optional caching
127  calcGrad
128  (
129  const VolField<Type>& vsf,
130  const word& name
131  ) const;
132 
133  //- Correct the boundary values of the gradient using the patchField
134  // snGrad functions
135  static void correctBoundaryConditions
136  (
137  const VolField<Type>&,
139  );
140 
141 
142  // Member Operators
143 
144  //- Disallow default bitwise assignment
145  void operator=(const gaussGrad&) = delete;
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace fv
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "gaussGrad.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
Generic GeometricField class.
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:336
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussGrad.H:60
static tmp< VolField< typename outerProduct< vector, Type >::type > > gradf(const SurfaceField< Type > &, const word &name)
Return the gradient of the given field.
tmp< surfaceInterpolationScheme< Type > > tinterpScheme_
Definition: gaussGrad.H:66
void operator=(const gaussGrad &)=delete
Disallow default bitwise assignment.
TypeName("Gauss")
Runtime type information.
gaussGrad(const fvMesh &mesh)
Construct from mesh.
Definition: gaussGrad.H:78
virtual tmp< VolField< typename outerProduct< vector, Type >::type > > calcGrad(const VolField< Type > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad.
static void correctBoundaryConditions(const VolField< Type > &, VolField< typename outerProduct< vector, Type >::type > &)
Correct the boundary values of the gradient using the patchField.
Definition: gaussGrad.C:126
Abstract base class for gradient schemes.
Definition: gradScheme.H:63
const fvMesh & mesh() const
Return mesh reference.
Definition: gradScheme.H:122
Centred interpolation interpolation scheme class.
Definition: linear.H:53
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:90
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
labelList fv(nPoints)