snGradScheme.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::snGradScheme
28 
29 Group
30  grpFvSnGradSchemes
31 
32 Description
33  Abstract base class for snGrad schemes.
34 
35 SourceFiles
36  snGradScheme.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef snGradScheme_H
41 #define snGradScheme_H
42 
43 #include "tmp.H"
44 #include "volFieldsFwd.H"
45 #include "surfaceFieldsFwd.H"
46 #include "typeInfo.H"
47 #include "runTimeSelectionTables.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 class fvMesh;
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace fv
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class snGradScheme Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type>
66 class snGradScheme
67 :
68  public refCount
69 {
70  // Private data
71 
72  //- Hold reference to mesh
73  const fvMesh& mesh_;
74 
75 
76  // Private Member Functions
77 
78  //- No copy construct
79  snGradScheme(const snGradScheme&) = delete;
80 
81  //- No copy assignment
82  void operator=(const snGradScheme&) = delete;
83 
84 
85 public:
86 
87  //- Runtime type information
88  virtual const word& type() const = 0;
89 
90 
91  // Declare run-time constructor selection tables
92 
94  (
95  tmp,
97  Mesh,
98  (const fvMesh& mesh, Istream& schemeData),
99  (mesh, schemeData)
100  );
101 
102 
103  // Constructors
104 
105  //- Construct from mesh
106  snGradScheme(const fvMesh& mesh)
107  :
108  mesh_(mesh)
109  {}
110 
111 
112  // Selectors
113 
114  //- Return new tmp interpolation scheme
116  (
117  const fvMesh& mesh,
118  Istream& schemeData
119  );
120 
121 
122  //- Destructor
123  virtual ~snGradScheme() = default;
124 
125 
126  // Member Functions
127 
128  //- Return mesh reference
129  const fvMesh& mesh() const
130  {
131  return mesh_;
132  }
133 
134 
135  //- Return the snGrad of the given cell field with the given deltaCoeffs
137  snGrad
138  (
141  const word& snGradName = "snGrad"
142  );
143 
144  //- Return the sndGrad of the given cell field
146  sndGrad
147  (
149  const word& snGradName = "sndGrad"
150  );
151 
152  //- Return the interpolation weighting factors for the given field
154  (
156  ) const = 0;
157 
158  //- Return true if this scheme uses an explicit correction
159  virtual bool corrected() const
160  {
161  return false;
162  }
163 
164  //- Return the explicit correction to the snGrad
165  // for the given field
168  {
170  (
171  nullptr
172  );
173  }
174 
175  //- Return the snGrad of the given cell field
176  // with explicit correction
179 
180  //- Return the snGrad of the given tmp cell field
181  // with explicit correction
183  snGrad
184  (
186  ) const;
187 };
188 
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 } // End namespace fv
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 // Add the patch constructor functions to the hash tables
201 
202 #define makeSnGradTypeScheme(SS, Type) \
203  defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
204  \
205  namespace Foam \
206  { \
207  namespace fv \
208  { \
209  snGradScheme<Type>::addMeshConstructorToTable<SS<Type>> \
210  add##SS##Type##MeshConstructorToTable_; \
211  } \
212  }
213 
214 #define makeSnGradScheme(SS) \
215  \
216 makeSnGradTypeScheme(SS, scalar) \
217 makeSnGradTypeScheme(SS, vector) \
218 makeSnGradTypeScheme(SS, sphericalTensor) \
219 makeSnGradTypeScheme(SS, symmTensor) \
220 makeSnGradTypeScheme(SS, tensor)
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #ifdef NoRepository
226  #include "snGradScheme.C"
227 #endif
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
volFieldsFwd.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::snGradScheme::snGradScheme
snGradScheme(const fvMesh &mesh)
Construct from mesh.
Definition: snGradScheme.H:105
typeInfo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fv::snGradScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, snGradScheme, Mesh,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::fv::snGradScheme::~snGradScheme
virtual ~snGradScheme()=default
Destructor.
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::fv::snGradScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: snGradScheme.H:128
tmp.H
Foam::fv::snGradScheme::corrected
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: snGradScheme.H:158
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::fv::snGradScheme::type
virtual const word & type() const =0
Runtime type information.
surfaceFieldsFwd.H
Foam::fv::snGradScheme
Abstract base class for snGrad schemes.
Definition: snGradScheme.H:65
Foam::fv::snGradScheme::New
static tmp< snGradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: snGradScheme.C:49
Foam::fv::snGradScheme::correction
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the snGrad.
Definition: snGradScheme.H:166
Foam::fv::snGradScheme::snGrad
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &, const tmp< surfaceScalarField > &, const word &snGradName="snGrad")
Return the snGrad of the given cell field with the given deltaCoeffs.
Definition: snGradScheme.C:93
Foam::fv::snGradScheme::deltaCoeffs
virtual tmp< surfaceScalarField > deltaCoeffs(const GeometricField< Type, fvPatchField, volMesh > &) const =0
Return the interpolation weighting factors for the given field.
Foam::GeometricField< Type, fvPatchField, volMesh >
snGradScheme.C
Foam::fv::snGradScheme::sndGrad
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > sndGrad(const GeometricField< Type, fvPatchField, volMesh > &, const word &snGradName="sndGrad")
Return the sndGrad of the given cell field.
Definition: snGradScheme.C:158