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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::snGradScheme
29 
30 Group
31  grpFvSnGradSchemes
32 
33 Description
34  Abstract base class for runtime selected \c snGrad surface
35  normal gradient schemes.
36 
37  A surface normal gradient is evaluated at a cell face. It
38  is the normal-to-face component of the gradient of
39  values at the centres of two cells that the face connects.
40 
41  Unit-surface-normal vector decomposition is based on the
42  so-called over-relaxed approach. Orthogonal components are
43  treated implicitly and non-orthogonal components are treated
44  explicitly with (or without) various limiters.
45 
46 SourceFiles
47  snGradScheme.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef snGradScheme_H
52 #define snGradScheme_H
53 
54 #include "tmp.H"
55 #include "volFieldsFwd.H"
56 #include "surfaceFieldsFwd.H"
57 #include "typeInfo.H"
58 #include "runTimeSelectionTables.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 class fvMesh;
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace fv
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class snGradScheme Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class Type>
77 class snGradScheme
78 :
79  public refCount
80 {
81  // Private Data
82 
83  //- Hold const reference to mesh
84  const fvMesh& mesh_;
85 
86 
87  // Private Member Functions
88 
89  //- No copy construct
90  snGradScheme(const snGradScheme&) = delete;
91 
92  //- No copy assignment
93  void operator=(const snGradScheme&) = delete;
94 
95 
96 public:
97 
98  //- Runtime type information
99  virtual const word& type() const = 0;
100 
101 
102  // Declare run-time constructor selection tables
103 
105  (
106  tmp,
107  snGradScheme,
108  Mesh,
109  (const fvMesh& mesh, Istream& schemeData),
110  (mesh, schemeData)
111  );
112 
113 
114  // Constructors
115 
116  //- Construct from mesh
117  snGradScheme(const fvMesh& mesh)
118  :
119  mesh_(mesh)
120  {}
121 
122 
123  // Selectors
124 
125  //- Return new tmp interpolation scheme
127  (
128  const fvMesh& mesh,
129  Istream& schemeData
130  );
131 
132 
133  //- Destructor
134  virtual ~snGradScheme() = default;
135 
136 
137  // Member Functions
138 
139  //- Return const reference to mesh
140  const fvMesh& mesh() const
141  {
142  return mesh_;
143  }
144 
145  //- Return the snGrad of the given cell field
146  //- by using the given deltaCoeffs
148  snGrad
149  (
152  const word& snGradName = "snGrad"
153  );
154 
155  //- Return the sndGrad of the given cell field
157  sndGrad
158  (
160  const word& snGradName = "sndGrad"
161  );
162 
163  //- Return the interpolation weighting factors for the given field
165  (
167  ) const = 0;
168 
169  //- Return true if this scheme uses an explicit correction
170  virtual bool corrected() const noexcept
171  {
172  return false;
173  }
174 
175  //- Return the explicit correction to the snGrad
176  //- for the given field
179  {
181  (
182  nullptr
183  );
184  }
185 
186  //- Return the snGrad of the given cell field
187  //- with explicit correction
190 
191  //- Return the snGrad of the given tmp cell field
192  //- with explicit correction
194  snGrad
195  (
197  ) const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace fv
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 // Add the patch constructor functions to the hash tables
212 
213 #define makeSnGradTypeScheme(SS, Type) \
214  defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
215  \
216  namespace Foam \
217  { \
218  namespace fv \
219  { \
220  snGradScheme<Type>::addMeshConstructorToTable<SS<Type>> \
221  add##SS##Type##MeshConstructorToTable_; \
222  } \
223  }
224 
225 #define makeSnGradScheme(SS) \
226  \
227 makeSnGradTypeScheme(SS, scalar) \
228 makeSnGradTypeScheme(SS, vector) \
229 makeSnGradTypeScheme(SS, sphericalTensor) \
230 makeSnGradTypeScheme(SS, symmTensor) \
231 makeSnGradTypeScheme(SS, tensor)
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #ifdef NoRepository
237  #include "snGradScheme.C"
238 #endif
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #endif
243 
244 // ************************************************************************* //
volFieldsFwd.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::snGradScheme::snGradScheme
snGradScheme(const fvMesh &mesh)
Construct from mesh.
Definition: snGradScheme.H:116
typeInfo.H
Foam::fv::snGradScheme::corrected
virtual bool corrected() const noexcept
Return true if this scheme uses an explicit correction.
Definition: snGradScheme.H:169
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:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::fv::snGradScheme::mesh
const fvMesh & mesh() const
Return const reference to mesh.
Definition: snGradScheme.H:139
tmp.H
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 runtime selected snGrad surface normal gradient schemes.
Definition: snGradScheme.H:76
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
Definition: snGradScheme.H:177
Foam::fv::snGradScheme::snGrad
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &, const tmp< surfaceScalarField > &, const word &snGradName="snGrad")
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