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 -------------------------------------------------------------------------------
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::faceLimitedGrad
28 
29 Description
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 
37 Author
38  Hrvoje Jasak, Wikki Ltd.
39 
40 SourceFiles
41  faceLimitedFaGrads.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef faceLimitedFaGrad_H
46 #define faceLimitedFaGrad_H
47 
48 #include "faGradScheme.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace fa
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class faceLimitedGrad Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
65 class faceLimitedGrad
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 
86 public:
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  :
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
112 
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 // ************************************************************************* //
faceLimitedGrad gradient scheme applied to a runTime selected base gradient scheme.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
TypeName("faceLimited")
RunTime type information.
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:129
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
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
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
static void limitEdge(Type &limiter, const Type &maxDelta, const Type &minDelta, const Type &extrapolate)
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...