iterativeGaussGrad.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) 2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::fv::iterativeGaussGrad
28
29Description
30 A second-order gradient scheme using face-interpolation,
31 Gauss' theorem and iterative skew correction.
32
33Usage
34 Minimal example by using \c system/fvSchemes:
35 \verbatim
36 gradSchemes
37 {
38 grad(<term>) iterativeGauss <interpolation scheme> <number of iters>;
39 }
40 \endverbatim
41
42 and by using \c system/fvSolution:
43 \verbatim
44 relaxationFactors
45 {
46 fields
47 {
48 grad(<term>) <relaxation factor>;
49 }
50 }
51 \endverbatim
52
53SourceFiles
54 iterativeGaussGrad.C
55
56\*---------------------------------------------------------------------------*/
57
58#ifndef iterativeGaussGrad_H
59#define iterativeGaussGrad_H
60
61#include "gaussGrad.H"
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65namespace Foam
66{
67
68// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69
70namespace fv
71{
72
73/*---------------------------------------------------------------------------*\
74 Class iterativeGaussGrad Declaration
75\*---------------------------------------------------------------------------*/
76
77template<class Type>
79:
80 public fv::gaussGrad<Type>
81{
82 // Private Data
83
84 //- Number of skew-correction iterations
85 label nIter_;
86
87
88 // Private Member Functions
89
90 //- No copy construct
92
93 //- No copy assignment
94 void operator=(const iterativeGaussGrad&) = delete;
95
96
97public:
98
99 //- Runtime type information
100 TypeName("iterativeGauss");
101
102
103 // Constructors
104
105 //- Construct from mesh
107 :
108 gaussGrad<Type>(mesh),
109 nIter_(1)
110 {}
111
112 //- Construct from mesh and Istream
113 iterativeGaussGrad(const fvMesh& mesh, Istream& schemeData)
114 :
115 gaussGrad<Type>(mesh, schemeData),
116 nIter_(readLabel(schemeData))
117 {
118 if (nIter_ <= 0)
119 {
120 FatalIOErrorInFunction(schemeData)
121 << "nIter = " << nIter_
122 << " should be > 0"
123 << exit(FatalIOError);
124 }
125 }
126
127
128 // Member Functions
129
130 //- Return the gradient of the given field
131 //- to the gradScheme::grad for optional caching
132 virtual tmp
133 <
135 <
138 volMesh
139 >
140 > calcGrad
141 (
143 const word& name
144 ) const;
145};
146
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150} // End namespace fv
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154} // End namespace Foam
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158#ifdef NoRepository
159 #include "iterativeGaussGrad.C"
160#endif
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164#endif
165
166// ************************************************************************* //
Generic GeometricField class.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussGrad.H:66
const fvMesh & mesh() const
Return const reference to mesh.
Definition: gradScheme.H:126
A second-order gradient scheme using face-interpolation, Gauss' theorem and iterative skew correction...
iterativeGaussGrad(const fvMesh &mesh)
Construct from mesh.
TypeName("iterativeGauss")
Runtime type information.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
iterativeGaussGrad(const fvMesh &mesh, Istream &schemeData)
Construct from mesh and Istream.
A class for managing temporary objects.
Definition: tmp.H:65
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:54
type
Volume classification types.
Definition: volumeType.H:66
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Namespace for OpenFOAM.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:66
IOerror FatalIOError
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
labelList fv(nPoints)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73