linearUpwindV.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::linearUpwindV
28 
29 Description
30  linearUpwindV interpolation scheme class derived from upwind and returns
31  upwind weighting factors but also applies an explicit correction.
32 
33 SourceFiles
34  linearUpwindV.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef linearUpwindV_H
39 #define linearUpwindV_H
40 
41 #include "upwind.H"
42 #include "gaussGrad.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class linearUpwindV Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Type>
54 class linearUpwindV
55 :
56  public upwind<Type>
57 {
58  // Private Data
59 
60  word gradSchemeName_;
61  tmp<fv::gradScheme<Type>> gradScheme_;
62 
63 
64  // Private Member Functions
65 
66  //- No copy construct
67  linearUpwindV(const linearUpwindV&) = delete;
68 
69  //- No copy assignment
70  void operator=(const linearUpwindV&) = delete;
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName("linearUpwindV");
77 
78 
79  // Constructors
80 
81  //- Construct from faceFlux
83  (
84  const fvMesh& mesh,
85  const surfaceScalarField& faceFlux
86  )
87  :
88  upwind<Type>(mesh, faceFlux),
89  gradSchemeName_("grad"),
90  gradScheme_
91  (
92  new fv::gaussGrad<Type>(mesh)
93  )
94  {}
95 
96  //- Construct from Istream.
97  // The name of the flux field is read from the Istream and looked-up
98  // from the mesh objectRegistry
100  (
101  const fvMesh& mesh,
102  Istream& schemeData
103  )
104  :
105  upwind<Type>(mesh, schemeData),
106  gradSchemeName_(schemeData),
107  gradScheme_
108  (
109  fv::gradScheme<Type>::New
110  (
111  mesh,
112  mesh.gradScheme(gradSchemeName_)
113  )
114  )
115  {}
116 
117  //- Construct from faceFlux and Istream
119  (
120  const fvMesh& mesh,
121  const surfaceScalarField& faceFlux,
122  Istream& schemeData
123  )
124  :
125  upwind<Type>(mesh, faceFlux, schemeData),
126  gradSchemeName_(schemeData),
127  gradScheme_
128  (
129  fv::gradScheme<Type>::New
130  (
131  mesh,
132  mesh.gradScheme(gradSchemeName_)
133  )
134  )
135  {}
136 
137 
138  // Member Functions
139 
140  //- Return true if this scheme uses an explicit correction
141  virtual bool corrected() const
142  {
143  return true;
144  }
145 
146  //- Return the explicit correction to the face-interpolate
148  correction
149  (
151  ) const;
152 
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::upwind
Upwind differencing scheme class.
Definition: upwind.H:56
Foam::limitedSurfaceInterpolationScheme::New
static tmp< limitedSurfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: limitedSurfaceInterpolationScheme.C:39
Foam::fv::gaussGrad
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussGrad.H:63
Foam::schemesLookup::gradScheme
ITstream & gradScheme(const word &name) const
Get grad scheme for given name, or default.
Definition: schemesLookup.C:213
gaussGrad.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
upwind.H
Foam::linearUpwindV::corrected
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: linearUpwindV.H:140
Foam::fv::gradScheme
Abstract base class for gradient schemes.
Definition: gradScheme.H:63
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::linearUpwindV
linearUpwindV interpolation scheme class derived from upwind and returns upwind weighting factors but...
Definition: linearUpwindV.H:53
Foam::linearUpwindV::correction
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the face-interpolate.
Definition: linearUpwindV.C:38
Foam::linearUpwindV::TypeName
TypeName("linearUpwindV")
Runtime type information.
Foam::surfaceInterpolationScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: surfaceInterpolationScheme.H:144
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >