faceMDLimitedGrad.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) 2011-2016 OpenFOAM Foundation
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::fv::faceMDLimitedGrad
28 
29 Group
30  grpFvGradSchemes
31 
32 Description
33  faceMDLimitedGrad gradient scheme applied to a runTime selected
34  base gradient scheme.
35 
36  The scalar limiter based on limiting the extrapolated face values
37  between the face-neighbour cell values and is applied to the gradient
38  in each face direction separately.
39 
40 SourceFiles
41  faceMDLimitedGrad.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef faceMDLimitedGrad_H
46 #define faceMDLimitedGrad_H
47 
48 #include "gradScheme.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace fv
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class faceMDLimitedGrad Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
66 :
67  public fv::gradScheme<Type>
68 {
69  // Private Data
70 
71  tmp<fv::gradScheme<Type>> basicGradScheme_;
72 
73  //- Limiter coefficient
74  const scalar k_;
75 
76 
77  // Private Member Functions
78 
79  inline void limitFace
80  (
81  scalar& limiter,
82  const scalar maxDelta,
83  const scalar minDelta,
84  const scalar extrapolate
85  ) const;
86 
87 
88  //- No copy construct
89  faceMDLimitedGrad(const faceMDLimitedGrad&) = delete;
90 
91  //- No copy assignment
92  void operator=(const faceMDLimitedGrad&) = delete;
93 
94 
95 public:
96 
97  //- RunTime type information
98  TypeName("faceMDLimited");
99 
100 
101  // Constructors
102 
103  //- Construct from mesh and schemeData
104  faceMDLimitedGrad(const fvMesh& mesh, Istream& schemeData)
105  :
106  gradScheme<Type>(mesh),
107  basicGradScheme_(fv::gradScheme<Type>::New(mesh, schemeData)),
108  k_(readScalar(schemeData))
109  {
110  if (k_ < 0 || k_ > 1)
111  {
112  FatalIOErrorInFunction(schemeData)
113  << "coefficient = " << k_
114  << " should be >= 0 and <= 1"
115  << exit(FatalIOError);
116  }
117  }
118 
119 
120  // Member Functions
121 
122  //- Return the gradient of the given field to the gradScheme::grad
123  // for optional caching
124  virtual tmp
125  <
128  > calcGrad
129  (
131  const word& name
132  ) const;
133 };
134 
135 
136 // * * * * * * * * Template Member Function Specialisations * * * * * * * * //
137 
138 template<>
140 (
141  const volScalarField& vsf,
142  const word& name
143 ) const;
144 
145 
146 template<>
148 (
149  const volVectorField& vsf,
150  const word& name
151 ) const;
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace fv
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::volMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:50
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::FatalIOError
IOerror FatalIOError
Foam::fv::faceMDLimitedGrad
faceMDLimitedGrad gradient scheme applied to a runTime selected base gradient scheme.
Definition: faceMDLimitedGrad.H:64
Foam::fv::gradScheme::New
static tmp< gradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: gradScheme.C:37
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fv::gradScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: gradScheme.H:124
gradScheme.H
Foam::fv::gradScheme
Abstract base class for gradient schemes.
Definition: gradScheme.H:62
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
fv
labelList fv(nPoints)
Foam::fv::faceMDLimitedGrad::calcGrad
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad.
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::fv::faceMDLimitedGrad::faceMDLimitedGrad
faceMDLimitedGrad(const fvMesh &mesh, Istream &schemeData)
Construct from mesh and schemeData.
Definition: faceMDLimitedGrad.H:103
Foam::limiter
tmp< areaScalarField > limiter(const areaScalarField &phi)
Definition: faNVDscheme.C:37
Foam::fv::faceMDLimitedGrad::TypeName
TypeName("faceMDLimited")
RunTime type information.