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 Foam_gaussFaGrad_H
41 #define Foam_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 public:
73 
74  //- Runtime type information
75  TypeName("Gauss");
76 
77 
78  // Generated Methods
79 
80  //- No copy construct
81  gaussGrad(const gaussGrad&) = delete;
82 
83  //- No copy assignment
84  void operator=(const gaussGrad&) = delete;
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  {
101  if (is.eof())
102  {
103  tinterpScheme_.reset
104  (
106  );
107  }
108  else
109  {
110  tinterpScheme_.reset
111  (
113  );
114  }
115  }
116 
117 
118  // Member Functions
119 
120  //- Return the gradient of the given field
121  //- calculated using Gauss' theorem on the given surface field
122  static
123  tmp
124  <
125  GeometricField
126  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>
127  > gradf
128  (
129  const GeometricField<Type, faePatchField, edgeMesh>&,
130  const word& name
131  );
132 
133  //- Return the gradient of the given field to the
134  //- gradScheme::grad for optional caching
135  virtual tmp
136  <
137  GeometricField
138  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>
139  > calcGrad
140  (
141  const GeometricField<Type, faPatchField, areaMesh>& vsf,
142  const word& name
143  ) const;
144 
145 
146  //- Correct the boundary values of the gradient using the patchField
147  // snGrad functions
148  static void correctBoundaryConditions
149  (
150  const GeometricField<Type, faPatchField, areaMesh>&,
151  GeometricField
152  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>&
153  );
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace fa
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #ifdef NoRepository
168  #include "gaussFaGrad.C"
169 #endif
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
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
Abstract base class for edge interpolation schemes.
TypeName("Gauss")
Runtime type information.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:118
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
gaussGrad(const gaussGrad &)=delete
No copy construct.
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:58
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:108
const faMesh & mesh() const noexcept
Return mesh reference.
Definition: faGradScheme.H:131
A class for managing temporary objects.
Definition: HashPtrTable.H:50
void operator=(const gaussGrad &)=delete
No copy assignment.
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:289
void reset(tmp< T > &&other) noexcept
Clear existing and transfer ownership.
Definition: tmpI.H:338
Namespace for OpenFOAM.