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