linearUpwind.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 | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::linearUpwind
26 
27 Description
28  linearUpwind interpolation scheme class derived from upwind and returns
29  upwind weighting factors and also applies a gradient-based explicit
30  correction.
31 
32 SourceFiles
33  linearUpwind.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef linearUpwind_H
38 #define linearUpwind_H
39 
40 #include "upwind.H"
41 #include "gaussGrad.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class linearUpwind Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
53 class linearUpwind
54 :
55  public upwind<Type>
56 {
57  // Private Data
58 
59  word gradSchemeName_;
60  tmp<fv::gradScheme<Type>> gradScheme_;
61 
62 
63  // Private Member Functions
64 
65  //- Disallow default bitwise copy construct
66  linearUpwind(const linearUpwind&);
67 
68  //- Disallow default bitwise assignment
69  void operator=(const linearUpwind&);
70 
71 
72 public:
73 
74  //- Runtime type information
75  TypeName("linearUpwind");
76 
77 
78  // Constructors
79 
80  //- Construct from faceFlux
82  (
83  const fvMesh& mesh,
84  const surfaceScalarField& faceFlux
85  )
86  :
87  upwind<Type>(mesh, faceFlux),
88  gradSchemeName_("grad"),
89  gradScheme_
90  (
91  new fv::gaussGrad<Type>(mesh)
92  )
93  {}
94 
95  //- Construct from Istream.
96  // The name of the flux field is read from the Istream and looked-up
97  // from the mesh objectRegistry
99  (
100  const fvMesh& mesh,
101  Istream& schemeData
102  )
103  :
104  upwind<Type>(mesh, schemeData),
105  gradSchemeName_(schemeData),
106  gradScheme_
107  (
108  fv::gradScheme<Type>::New
109  (
110  mesh,
111  mesh.gradScheme(gradSchemeName_)
112  )
113  )
114  {}
115 
116  //- Construct from faceFlux and Istream
118  (
119  const fvMesh& mesh,
120  const surfaceScalarField& faceFlux,
121  Istream& schemeData
122  )
123  :
124  upwind<Type>(mesh, faceFlux, schemeData),
125  gradSchemeName_(schemeData),
126  gradScheme_
127  (
128  fv::gradScheme<Type>::New
129  (
130  mesh,
131  mesh.gradScheme(gradSchemeName_)
132  )
133  )
134  {}
135 
136 
137  // Member Functions
138 
139  //- Return true if this scheme uses an explicit correction
140  virtual bool corrected() const
141  {
142  return true;
143  }
144 
145  //- Return the explicit correction to the face-interpolate
147  correction
148  (
150  ) const;
151 
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the face-interpolate.
Definition: linearUpwind.C:34
static tmp< limitedSurfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: linearUpwind.H:139
Upwind differencing scheme class.
Definition: upwind.H:51
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
linearUpwind interpolation scheme class derived from upwind and returns upwind weighting factors and ...
Definition: linearUpwind.H:52
A class for managing temporary objects.
Definition: PtrList.H:54
TypeName("linearUpwind")
Runtime type information.
Namespace for OpenFOAM.