Loading...
Searching...
No Matches
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 Copyright (C) 2023 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::fa::edgeLimitedGrad
29
30Description
31 edgeLimitedGrad gradient scheme applied to a runTime selected base gradient
32 scheme.
33
34 The scalar limiter based on limiting the extrapolated edge values
35 between the edge-neighbour cell values and is applied to all components
36 of the gradient.
37
38SourceFiles
39 edgeLimitedFaGrads.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef edgeLimitedFaGrad_H
44#define edgeLimitedFaGrad_H
45
46#include "faGradScheme.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace fa
56{
57
58/*---------------------------------------------------------------------------*\
59 Class edgeLimitedGrad Declaration
60\*---------------------------------------------------------------------------*/
61
62template<class Type>
64:
65 public fa::gradScheme<Type>
66{
67 // Private Data
68
69 //- Basic gradient scheme
70 tmp<fa::gradScheme<Type>> basicGradScheme_;
71
72 //- Limiter coefficient
73 scalar k_;
74
75
76 // Private Member Functions
77
78 inline void limitEdge
79 (
80 scalar& limiter,
81 const scalar maxDelta,
82 const scalar minDelta,
83 const scalar extrapolate
84 ) const;
85
86
87public:
88
89 //- RunTime type information
90 TypeName("edgeLimited");
92
93 // Generated Methods
94
95 //- No copy construct
96 edgeLimitedGrad(const edgeLimitedGrad&) = delete;
97
98 //- No copy assignment
99 void operator=(const edgeLimitedGrad&) = delete;
100
101
102 // Constructors
103
104 //- Construct from mesh and schemeData
105 edgeLimitedGrad(const faMesh& mesh, Istream& schemeData)
106 :
107 gradScheme<Type>(mesh),
108 basicGradScheme_(fa::gradScheme<Type>::New(mesh, schemeData)),
109 k_(readScalar(schemeData))
110 {
111 if (k_ < 0 || k_ > 1)
113 FatalIOErrorInFunction(schemeData)
114 << "coefficient = " << k_
115 << " should be >= 0 and <= 1"
116 << exit(FatalIOError);
117 }
118 }
119
120
121 // Member Functions
122
123 //- Return the gradient of the given field to the
124 //- gradScheme::grad for optional caching
125 virtual tmp
126 <
129 > calcGrad
130 (
132 const word& name
133 ) const;
134};
135
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139} // End namespace fa
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143} // End namespace Foam
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147#endif
148
149// ************************************************************************* //
Generic GeometricField class.
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 Area discretisation.
Definition areaFaMesh.H:50
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
TypeName("edgeLimited")
RunTime type information.
edgeLimitedGrad(const faMesh &mesh, Istream &schemeData)
Construct from mesh and schemeData.
edgeLimitedGrad(const edgeLimitedGrad &)=delete
No copy construct.
void operator=(const edgeLimitedGrad &)=delete
No copy assignment.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > calcGrad(const GeometricField< Type, faPatchField, areaMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
Abstract base class for finite area calculus gradient schemes.
const faMesh & mesh() const noexcept
Return mesh reference.
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
gradScheme(const gradScheme &)=delete
No copy construct.
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
A class for handling words, derived from Foam::string.
Definition word.H:66
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition error.H:629
Namespace for finite-area.
Definition limitHeight.C:30
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
tmp< areaScalarField > limiter(const areaScalarField &phi)
Definition faNVDscheme.C:31
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68