faceLimitedFaGrad.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::faceLimitedGrad
28
29Description
30 faceLimitedGrad gradient scheme applied to a runTime selected base gradient
31 scheme.
32
33 The scalar limiter based on limiting the extrapolated face values
34 between the maximum and minimum cell and cell neighbour values and is
35 applied to all components of the gradient.
36
37Author
38 Hrvoje Jasak, Wikki Ltd.
39
40SourceFiles
41 faceLimitedFaGrads.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef faceLimitedFaGrad_H
46#define faceLimitedFaGrad_H
47
48#include "faGradScheme.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace fa
58{
59
60/*---------------------------------------------------------------------------*\
61 Class faceLimitedGrad Declaration
62\*---------------------------------------------------------------------------*/
63
64template<class Type>
66:
67 public fa::gradScheme<Type>
68{
69 // Private Data
70
71 tmp<fa::gradScheme<Type>> basicGradScheme_;
72
73 //- Limiter coefficient
74 scalar k_;
75
76
77 // Private Member Functions
78
79 //- No copy construct
80 faceLimitedGrad(const faceLimitedGrad&) = delete;
81
82 //- No copy assignment
83 void operator=(const faceLimitedGrad&) = delete;
84
85
86public:
87
88 //- RunTime type information
89 TypeName("faceLimited");
90
91
92 // Constructors
93
94 //- Construct from mesh and schemeData
95 faceLimitedGrad(const faMesh& mesh, Istream& schemeData)
96 :
97 gradScheme<Type>(mesh),
98 basicGradScheme_(fa::gradScheme<Type>::New(mesh, schemeData)),
99 k_(readScalar(schemeData))
100 {
101 if (k_ < 0 || k_ > 1)
102 {
103 FatalIOErrorInFunction(schemeData)
104 << "coefficient = " << k_
105 << " should be >= 0 and <= 1"
106 << exit(FatalIOError);
107 }
108 }
109
110
111 // Member Functions
113 static inline void limitEdge
114 (
115 Type& limiter,
116 const Type& maxDelta,
117 const Type& minDelta,
118 const Type& extrapolate
119 );
120
121
122 tmp
123 <
126 > grad
127 (
129 ) const;
130};
131
132
133// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134
135} // End namespace fa
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139} // End namespace Foam
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143#endif
144
145// ************************************************************************* //
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
faceLimitedGrad gradient scheme applied to a runTime selected base gradient scheme.
TypeName("faceLimited")
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.
static void limitEdge(Type &limiter, const Type &maxDelta, const Type &minDelta, const Type &extrapolate)
faceLimitedGrad(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