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  :
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
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 // ************************************************************************* //
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::fa::faceLimitedGrad::TypeName
TypeName("faceLimited")
RunTime type information.
Foam::fa::faceLimitedGrad::limitEdge
static void limitEdge(Type &limiter, const Type &maxDelta, const Type &minDelta, const Type &extrapolate)
Foam::FatalIOError
IOerror FatalIOError
Foam::fa::gradScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:121
Foam::fa::faceLimitedGrad
faceLimitedGrad gradient scheme applied to a runTime selected base gradient scheme.
Definition: faceLimitedFaGrad.H:64
faGradScheme.H
Foam::fa::faceLimitedGrad::grad
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.
Foam::fa::faceLimitedGrad::faceLimitedGrad
faceLimitedGrad(const faMesh &mesh, Istream &schemeData)
Construct from mesh and schemeData.
Definition: faceLimitedFaGrad.H:94
Foam::fa::gradScheme::New
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: faGradScheme.C:46
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::areaMesh
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:52
Foam::fa::gradScheme
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:63
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:77
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::limiter
tmp< areaScalarField > limiter(const areaScalarField &phi)
Definition: faNVDscheme.C:37