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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::fa::edgeLimitedGrad
28 
29 Description
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 
37 SourceFiles
38  edgeLimitedFaGrads.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef edgeLimitedFaGrad_H
43 #define edgeLimitedFaGrad_H
44 
45 #include "faGradScheme.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace fa
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class edgeLimitedGrad Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
62 class edgeLimitedGrad
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 
92 public:
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  :
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 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:129
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
edgeLimitedGrad gradient scheme applied to a runTime selected base gradient scheme.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:118
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
tmp< areaScalarField > limiter(const areaScalarField &phi)
Definition: faNVDscheme.C:31
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.
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:59
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:607
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:47
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
TypeName("edgeLimited")
RunTime type information.