gaussFaGrad.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2023 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::fa::gaussGrad
29 
30 Description
31  Basic second-order gradient scheme using face-interpolation
32  and Gauss' theorem.
33 
34 SourceFiles
35  gaussFaGrad.C
36  gaussFaGrads.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef gaussFaGrad_H
41 #define gaussFaGrad_H
42 
43 #include "faGradScheme.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace fa
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class gaussGrad Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
62 class gaussGrad
63 :
64  public fa::gradScheme<Type>
65 {
66  // Private Data
67 
68  //- Interpolation scheme
69  tmp<edgeInterpolationScheme<Type>> tinterpScheme_;
70 
71 
72  // Private Member Functions
73 
74  //- No copy construct
75  gaussGrad(const gaussGrad&) = delete;
76 
77  //- No copy assignment
78  void operator=(const gaussGrad&) = delete;
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("Gauss");
85 
86 
87  // Constructors
88 
89  //- Construct from mesh
90  gaussGrad(const faMesh& mesh)
91  :
93  tinterpScheme_(new linearEdgeInterpolation<Type>(mesh))
94  {}
95 
96  //- Construct from Istream
97  gaussGrad(const faMesh& mesh, Istream& is)
98  :
99  gradScheme<Type>(mesh),
100  tinterpScheme_(nullptr)
101  {
102  if (is.eof())
103  {
104  tinterpScheme_ =
106  (
108  );
109  }
110  else
111  {
112  tinterpScheme_ =
114  (
116  );
117  }
118  }
119 
120 
121  // Member Functions
122 
123  //- Return the gradient of the given field
124  //- calculated using Gauss' theorem on the given surface field
125  static
126  tmp
127  <
128  GeometricField
129  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>
130  > gradf
131  (
132  const GeometricField<Type, faePatchField, edgeMesh>&,
133  const word& name
134  );
135 
136  //- Return the gradient of the given field to the
137  //- gradScheme::grad for optional caching
138  virtual tmp
139  <
140  GeometricField
141  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>
142  > calcGrad
143  (
144  const GeometricField<Type, faPatchField, areaMesh>& vsf,
145  const word& name
146  ) const;
147 
148 
149  //- Correct the boundary values of the gradient using the patchField
150  // snGrad functions
151  static void correctBoundaryConditions
152  (
153  const GeometricField<Type, faPatchField, areaMesh>&,
154  GeometricField
155  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>&
156  );
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace fa
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #ifdef NoRepository
171  #include "gaussFaGrad.C"
172 #endif
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:87
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:130
Basic second-order gradient scheme using face-interpolation and Gauss&#39; theorem.
Definition: gaussFaGrad.H:57
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
TypeName("Gauss")
Runtime type information.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:118
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > calcGrad(const GeometricField< Type, faPatchField, areaMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:60
Central-differencing interpolation scheme class.
static tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > gradf(const GeometricField< Type, faePatchField, edgeMesh > &, const word &name)
Return the gradient of the given field calculated using Gauss&#39; theorem on the given surface field...
static void correctBoundaryConditions(const GeometricField< Type, faPatchField, areaMesh > &, GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > &)
Correct the boundary values of the gradient using the patchField.
Definition: gaussFaGrad.C:110
A class for managing temporary objects.
Definition: HashPtrTable.H:50
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:289
Namespace for OpenFOAM.