limitedLnGrad.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-------------------------------------------------------------------------------
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::fa::limitedLnGrad
28
29Description
30 Central-difference lnGrad scheme with limited non-orthogonal correction.
31
32 The limiter is controlled by a coefficient with a value between 0 and 1
33 which when 0 switches the correction off and the scheme behaves as
34 uncorrectedSnGrad, when set to 1 the full correction is applied and the
35 scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
36 calculated such that the non-orthogonal contribution does not exceed the
37 orthogonal part.
38
39Author
40 Hrvoje Jasak, Wikki Ltd.
41
42SourceFiles
43 limitedLnGrad.C
44
45\*---------------------------------------------------------------------------*/
46
47#ifndef limitedLnGrad_H
48#define limitedLnGrad_H
49
50#include "lnGradScheme.H"
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace Foam
55{
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace fa
60{
61
62/*---------------------------------------------------------------------------*\
63 Class limitedLnGrad Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class Type>
67class limitedLnGrad
68:
69 public lnGradScheme<Type>
70{
71 // Private data
72
73 //- Limiter. 0 = no limiting, 1 = full limiting
74 scalar limitCoeff_;
75
76
77 // Private Member Functions
78
79 //- No copy assignment
80 void operator=(const limitedLnGrad&) = delete;
81
82
83public:
84
85 //- Runtime type information
86 TypeName("limited");
87
88
89 // Constructors
90
91 //- Construct from mesh
93 :
94 lnGradScheme<Type>(mesh)
95 {}
96
97
98 //- Construct from mesh and data stream
99 limitedLnGrad(const faMesh& mesh, Istream& is)
100 :
101 lnGradScheme<Type>(mesh),
102 limitCoeff_(readScalar(is))
103 {
104 if (limitCoeff_ < 0 || limitCoeff_ > 1)
105 {
107 << "limitCoeff is specified as " << limitCoeff_
108 << " but should be >= 0 && <= 1"
109 << exit(FatalIOError);
110 }
111 }
112
113
114 // Destructor
115
116 virtual ~limitedLnGrad();
117
118
119 // Member Functions
120
121 //- Return the interpolation weighting factors for the given field
123 (
125 ) const
126 {
127 return this->mesh().deltaCoeffs();
128 }
129
130 //- Return true if this scheme uses an explicit correction
131 virtual bool corrected() const
132 {
133 return !this->mesh().orthogonal();
134 }
135
136 //- Return the explicit correction to the limitedLnGrad
137 // for the given field
140};
141
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145} // End namespace fv
146
147// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149} // End namespace Foam
150
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153#ifdef NoRepository
154 #include "limitedLnGrad.C"
155#endif
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159#endif
160
161// ************************************************************************* //
Generic GeometricField class.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
const edgeScalarField & deltaCoeffs() const
Return reference to difference factors array.
bool orthogonal() const
Return whether mesh is orthogonal or not.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
Central-difference lnGrad scheme with limited non-orthogonal correction.
Definition: limitedLnGrad.H:69
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the limitedLnGrad.
Definition: limitedLnGrad.C:56
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
limitedLnGrad(const faMesh &mesh)
Construct from mesh.
Definition: limitedLnGrad.H:91
limitedLnGrad(const faMesh &mesh, Istream &is)
Construct from mesh and data stream.
Definition: limitedLnGrad.H:98
TypeName("limited")
Runtime type information.
virtual tmp< edgeScalarField > deltaCoeffs(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the interpolation weighting factors for the given field.
Abstract base class for lnGrad schemes.
Definition: lnGradScheme.H:65
const faMesh & mesh() const
Return mesh reference.
Definition: lnGradScheme.H:118
A class for managing temporary objects.
Definition: tmp.H:65
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Namespace for OpenFOAM.
IOerror FatalIOError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73