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  :
90  gradScheme<Type>(mesh),
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  <
127  > grad
128  (
130  ) const;
131 
132  //- Correct the boundary values of the gradient using the patchField
133  // snGrad functions
134  static void correctBoundaryConditions
135  (
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 // ************************************************************************* //
edgeInterpolationScheme.H
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
Foam::fa::gaussGrad
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussFaGrad.H:60
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::fa::gradScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:121
faGradScheme.H
Foam::fa::gaussGrad::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the gradient of the given field calculated.
Foam::fa::gaussGrad::TypeName
TypeName("Gauss")
Runtime type information.
gaussFaGrad.C
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::areaMesh
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:53
Foam::fa::gradScheme
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:63
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fa::gaussGrad::gaussGrad
gaussGrad(const faMesh &mesh)
Construct from mesh.
Definition: gaussFaGrad.H:87
Foam::fa::gaussGrad::correctBoundaryConditions
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:82
linearEdgeInterpolation.H
Foam::linearEdgeInterpolation
Central-differencing interpolation scheme class.
Definition: linearEdgeInterpolation.H:52
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::fa::gaussGrad::gaussGrad
gaussGrad(const faMesh &mesh, Istream &is)
Construct from Istream.
Definition: gaussFaGrad.H:94
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::edgeInterpolationScheme::New
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: edgeInterpolationScheme.C:41