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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::gaussGrad
29 
30 Group
31  grpFvGradSchemes
32 
33 Description
34  Basic second-order gradient scheme using face-interpolation
35  and Gauss' theorem.
36 
37 SourceFiles
38  gaussGrad.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef gaussGrad_H
43 #define gaussGrad_H
44 
45 #include "gradScheme.H"
47 #include "linear.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace fv
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class gaussGrad Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class Type>
64 class gaussGrad
65 :
66  public fv::gradScheme<Type>
67 {
68  // Private Data
69 
70  //- Interpolation scheme
72 
73 
74  // Private Member Functions
75 
76  //- No copy construct
77  gaussGrad(const gaussGrad&) = delete;
78 
79  //- No copy assignment
80  void operator=(const gaussGrad&) = delete;
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("Gauss");
87 
88 
89  // Constructors
90 
91  //- Construct from mesh
92  gaussGrad(const fvMesh& mesh)
93  :
94  gradScheme<Type>(mesh),
95  tinterpScheme_(new linear<Type>(mesh))
96  {}
97 
98  //- Construct from mesh and Istream
99  gaussGrad(const fvMesh& mesh, Istream& is)
100  :
101  gradScheme<Type>(mesh),
102  tinterpScheme_(nullptr)
103  {
104  if (is.eof())
105  {
106  tinterpScheme_ =
108  (
109  new linear<Type>(mesh)
110  );
111  }
112  else
113  {
114  tinterpScheme_ =
116  (
118  );
119  }
120  }
121 
122 
123  // Member Functions
124 
125  //- Return the gradient of the given field
126  //- calculated using Gauss' theorem on the given surface field
127  static
128  tmp
129  <
132  > gradf
133  (
135  const word& name
136  );
137 
138  //- Return the gradient of the given field to the gradScheme::grad
139  //- for optional caching
140  virtual tmp
141  <
144  > calcGrad
145  (
147  const word& name
148  ) const;
149 
150  //- Correct the boundary values of the gradient using the patchField
151  //- snGrad functions
152  static void correctBoundaryConditions
153  (
157  );
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace fv
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #ifdef NoRepository
172  #include "gaussGrad.C"
173 #endif
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::fv::gaussGrad::TypeName
TypeName("Gauss")
Runtime type information.
Foam::surfaceInterpolationScheme::New
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: surfaceInterpolationScheme.C:40
gaussGrad.C
Foam::fv::gaussGrad::gradf
static tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > gradf(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const word &name)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fv::gaussGrad::calcGrad
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
Foam::volMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:51
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::fv::gaussGrad
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussGrad.H:63
Foam::fv::gaussGrad::gaussGrad
gaussGrad(const fvMesh &mesh)
Construct from mesh.
Definition: gaussGrad.H:91
Foam::fv::gaussGrad::gaussGrad
gaussGrad(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
Definition: gaussGrad.H:98
Foam::fv::gaussGrad::correctBoundaryConditions
static void correctBoundaryConditions(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > &)
Definition: gaussGrad.C:145
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::IOstream::eof
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:239
Foam::fv::gradScheme::mesh
const fvMesh & mesh() const
Return const reference to mesh.
Definition: gradScheme.H:126
gradScheme.H
Foam::fv::gradScheme
Abstract base class for gradient schemes.
Definition: gradScheme.H:63
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::linear
Central-differencing interpolation scheme class.
Definition: linear.H:55
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
surfaceInterpolationScheme.H