FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2011 OpenCFD Ltd.
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 but also applies an explicit correction.
30 
31 SourceFiles
32  linearUpwind.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef linearUpwind_H
37 #define linearUpwind_H
38 
39 #include <finiteVolume/upwind.H>
40 #include <finiteVolume/gaussGrad.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class linearUpwind Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type>
53 :
54  public upwind<Type>
55 {
56  // Private Data
57 
58  tmp<fv::gradScheme<Type> > gradScheme_;
59 
60 
61  // Private Member Functions
62 
63  //- Disallow default bitwise copy construct
64  linearUpwind(const linearUpwind&);
65 
66  //- Disallow default bitwise assignment
67  void operator=(const linearUpwind&);
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("linearUpwind");
74 
75 
76  // Constructors
77 
78  //- Construct from faceFlux
80  (
81  const fvMesh& mesh,
82  const surfaceScalarField& faceFlux
83  )
84  :
85  upwind<Type>(mesh, faceFlux),
86  gradScheme_
87  (
88  new fv::gaussGrad<Type>(mesh)
89  )
90  {}
91 
92  //- Construct from Istream.
93  // The name of the flux field is read from the Istream and looked-up
94  // from the mesh objectRegistry
96  (
97  const fvMesh& mesh,
98  Istream& schemeData
99  )
100  :
101  upwind<Type>(mesh, schemeData),
102  gradScheme_
103  (
105  (
106  mesh,
107  schemeData
108  )
109  )
110  {}
111 
112  //- Construct from faceFlux and Istream
114  (
115  const fvMesh& mesh,
116  const surfaceScalarField& faceFlux,
117  Istream& schemeData
118  )
119  :
120  upwind<Type>(mesh, faceFlux, schemeData),
121  gradScheme_
122  (
124  (
125  mesh,
126  schemeData
127  )
128  )
129  {}
130 
131 
132  // Member Functions
133 
134  //- Return true if this scheme uses an explicit correction
135  virtual bool corrected() const
136  {
137  return true;
138  }
139 
140  //- Return the explicit correction to the face-interpolate
142  correction
143  (
145  ) const;
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************ vim: set sw=4 sts=4 et: ************************ //