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