edgeLimitedFaGrad.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::edgeLimitedGrad
28
29Description
30 edgeLimitedGrad gradient scheme applied to a runTime selected base gradient
31 scheme.
32
33 The scalar limiter based on limiting the extrapolated edge values
34 between the edge-neighbour cell values and is applied to all components
35 of the gradient.
36
37SourceFiles
38 edgeLimitedFaGrads.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef edgeLimitedFaGrad_H
43#define edgeLimitedFaGrad_H
44
45#include "faGradScheme.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace fa
55{
56
57/*---------------------------------------------------------------------------*\
58 Class edgeLimitedGrad Declaration
59\*---------------------------------------------------------------------------*/
60
61template<class Type>
63:
64 public fa::gradScheme<Type>
65{
66 // Private Data
67
68 tmp<fa::gradScheme<Type>> basicGradScheme_;
69
70 //- Limiter coefficient
71 scalar k_;
72
73
74 // Private Member Functions
75
76 inline void limitEdge
77 (
78 scalar& limiter,
79 const scalar maxDelta,
80 const scalar minDelta,
81 const scalar extrapolate
82 ) const;
83
84
85 //- No copy construct
86 edgeLimitedGrad(const edgeLimitedGrad&) = delete;
87
88 //- No copy assignment
89 void operator=(const edgeLimitedGrad&) = delete;
90
91
92public:
93
94 //- RunTime type information
95 TypeName("edgeLimited");
96
97
98 // Constructors
99
100 //- Construct from mesh and schemeData
101 edgeLimitedGrad(const faMesh& mesh, Istream& schemeData)
102 :
103 gradScheme<Type>(mesh),
104 basicGradScheme_(fa::gradScheme<Type>::New(mesh, schemeData)),
105 k_(readScalar(schemeData))
106 {
107 if (k_ < 0 || k_ > 1)
108 {
109 FatalIOErrorInFunction(schemeData)
110 << "coefficient = " << k_
111 << " should be >= 0 and <= 1"
112 << exit(FatalIOError);
113 }
114 }
115
116
117 // Member Functions
118
119 tmp
120 <
123 > grad
124 (
126 ) const;
127};
128
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132} // End namespace fa
133
134// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136} // End namespace Foam
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140#endif
141
142// ************************************************************************* //
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 Area discretisation.
Definition: areaFaMesh.H:56
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: faPatchField.H:82
edgeLimitedGrad gradient scheme applied to a runTime selected base gradient scheme.
TypeName("edgeLimited")
RunTime type information.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faPatchField, areaMesh > &) const
Calculate and return the grad of the given field.
edgeLimitedGrad(const faMesh &mesh, Istream &schemeData)
Construct from mesh and schemeData.
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:66
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: faGradScheme.C:46
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:121
A class for managing temporary objects.
Definition: tmp.H:65
type
Volume classification types.
Definition: volumeType.H:66
#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
tmp< areaScalarField > limiter(const areaScalarField &phi)
Definition: faNVDscheme.C:38
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73