Loading...
Searching...
No Matches
fusedGaussGrad.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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fv::fusedGaussGrad
29
30Group
31 grpFvGradSchemes
32
33Description
34 Basic second-order gradient scheme using face-interpolation
35 and Gauss' theorem.
36
37SourceFiles
38 fusedGaussGrad.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_fusedGaussGrad_H
43#define Foam_fusedGaussGrad_H
44
45#include "gradScheme.H"
47#include "linear.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55
56namespace fv
57{
58
59/*---------------------------------------------------------------------------*\
60 Class fusedGaussGrad Declaration
61\*---------------------------------------------------------------------------*/
62
63template<class Type>
64class fusedGaussGrad
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 fusedGaussGrad(const fusedGaussGrad&) = delete;
78
79 //- No copy assignment
80 void operator=(const fusedGaussGrad&) = delete;
81
82
83public:
84
85 //- Runtime type information
86 TypeName("fusedGauss");
87
88
89 // Constructors
90
91 //- Construct from mesh
92 fusedGaussGrad(const fvMesh& mesh)
93 :
94 gradScheme<Type>(mesh),
95 tinterpScheme_(new linear<Type>(mesh))
96 {}
98 //- Construct from mesh and Istream
99 fusedGaussGrad(const fvMesh& mesh, Istream& is)
100 :
101 gradScheme<Type>(mesh),
102 tinterpScheme_(nullptr)
103 {
104 if (is.eof())
105 {
106 tinterpScheme_.reset
107 (
108 new linear<Type>(mesh)
109 );
110 }
111 else
112 {
113 tinterpScheme_.reset
114 (
115 surfaceInterpolationScheme<Type>::New(mesh, is)
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 <
130 > gradf
131 (
133 const word& name
134 );
135
136 //- Return the gradient of the given field to the gradScheme::grad
137 //- for optional caching
138 virtual tmp
139 <
142 > calcGrad
143 (
145 const word& name
146 ) const;
147
148 //- Calculate the grad of the given field into supplied field
149 virtual void calcGrad
150 (
154 ) const;
155
156 //- Correct the boundary values of the gradient using the patchField
157 //- snGrad functions
158 template<class GradType>
159 static void correctBoundaryConditions
160 (
163 );
164};
165
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169} // End namespace fv
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173} // End namespace Foam
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177#ifdef NoRepository
178 #include "fusedGaussGrad.C"
179#endif
180
181// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183#endif
184
185// ************************************************************************* //
Generic GeometricField class.
bool eof() const noexcept
True if end of input seen.
Definition IOstream.H:289
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
fusedGaussGrad(const fvMesh &mesh)
Construct from mesh.
fusedGaussGrad(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
static tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > gradf(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const word &name)
Return the gradient of the given field calculated using Gauss' theorem on the given surface field.
TypeName("fusedGauss")
Runtime type information.
Abstract base class for gradient schemes.
Definition gradScheme.H:62
const fvMesh & mesh() const
Return const reference to mesh.
Definition gradScheme.H:138
Central-differencing interpolation scheme class.
Definition linear.H:54
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
Definition products.H:118
A class for managing temporary objects.
Definition tmp.H:75
Mesh data needed to do the Finite Volume discretisation.
Definition volMesh.H:47
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for finite-volume.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
cellMask correctBoundaryConditions()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68