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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fa::gaussGrad
28 
29 Description
30  Basic second-order gradient scheme using face-interpolation
31  and Gauss' theorem.
32 
33 SourceFiles
34  gaussFaGrad.C
35  gaussFaGrads.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef gaussFaGrad_H
40 #define gaussFaGrad_H
41 
42 #include "faGradScheme.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace fa
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class gaussGrad Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Type>
61 class gaussGrad
62 :
63  public fa::gradScheme<Type>
64 {
65  // Private data
66 
67  tmp<edgeInterpolationScheme<Type>> tinterpScheme_;
68 
69 
70  // Private Member Functions
71 
72  //- No copy construct
73  gaussGrad(const gaussGrad&) = delete;
74 
75  //- No copy assignment
76  void operator=(const gaussGrad&) = delete;
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("Gauss");
83 
84 
85  // Constructors
86 
87  //- Construct from mesh
88  gaussGrad(const faMesh& mesh)
89  :
91  tinterpScheme_(new linearEdgeInterpolation<Type>(mesh))
92  {}
93 
94  //- Construct from Istream
95  gaussGrad(const faMesh& mesh, Istream& is)
96  :
97  gradScheme<Type>(mesh),
98  tinterpScheme_(nullptr)
99  {
100  if (is.eof())
101  {
102  tinterpScheme_ =
104  (
106  );
107  }
108  else
109  {
110  tinterpScheme_ =
112  (
114  );
115  }
116  }
117 
118 
119  // Member Functions
120 
121  //- Return the gradient of the given field calculated
122  // using Gauss' theorem on the interpolated field
123  tmp
124  <
125  GeometricField
126  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>
127  > grad
128  (
129  const GeometricField<Type, faPatchField, areaMesh>&
130  ) const;
131 
132  //- Correct the boundary values of the gradient using the patchField
133  // snGrad functions
134  static void correctBoundaryConditions
135  (
136  const GeometricField<Type, faPatchField, areaMesh>&,
137  GeometricField
138  <typename outerProduct<vector, Type>::type, faPatchField, areaMesh>&
139  );
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace fa
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #ifdef NoRepository
154  #include "gaussFaGrad.C"
155 #endif
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:129
Basic second-order gradient scheme using face-interpolation and Gauss&#39; theorem.
Definition: gaussFaGrad.H:56
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.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the gradient of the given field calculated.
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:59
Central-differencing interpolation scheme class.
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:75
A class for managing temporary objects.
Definition: HashPtrTable.H:50
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:282
Namespace for OpenFOAM.