Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fv::snGradScheme
29
30Group
31 grpFvSnGradSchemes
32
33Description
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
46SourceFiles
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"
59
60// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62namespace Foam
63{
64
65class fvMesh;
66
67// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68
69namespace fv
70{
71
72/*---------------------------------------------------------------------------*\
73 Class snGradScheme Declaration
74\*---------------------------------------------------------------------------*/
75
76template<class Type>
77class 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
96public:
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
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_;
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 for the given field
178 {
179 return nullptr;
180 }
182 //- Return the snGrad of the given cell field
183 //- with explicit correction
186
187 //- Return the snGrad of the given tmp cell field
188 //- with explicit correction
193 ) const;
194};
195
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199} // End namespace fv
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
203} // End namespace Foam
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207// Add the patch constructor functions to the hash tables
208
209#define makeSnGradTypeScheme(SS, Type) \
210 defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
211 \
212 namespace Foam \
213 { \
214 namespace fv \
215 { \
216 snGradScheme<Type>::addMeshConstructorToTable<SS<Type>> \
217 add##SS##Type##MeshConstructorToTable_; \
218 } \
219 }
220
221#define makeSnGradScheme(SS) \
222 \
223makeSnGradTypeScheme(SS, scalar) \
224makeSnGradTypeScheme(SS, vector) \
225makeSnGradTypeScheme(SS, sphericalTensor) \
226makeSnGradTypeScheme(SS, symmTensor) \
227makeSnGradTypeScheme(SS, tensor)
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#ifdef NoRepository
233 #include "snGradScheme.C"
234#endif
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237
238#endif
239
240// ************************************************************************* //
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:85
snGradScheme(const fvMesh &mesh)
Construct from mesh.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > sndGrad(const GeometricField< Type, fvPatchField, volMesh > &, const word &snGradName="sndGrad")
Return the sndGrad of the given cell field.
virtual ~snGradScheme()=default
Destructor.
declareRunTimeSelectionTable(tmp, snGradScheme, Mesh,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
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 by using the given deltaCoeffs.
const fvMesh & mesh() const
Return const reference to mesh.
virtual bool corrected() const noexcept
Return true if this scheme uses an explicit correction.
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the snGrad for the given field.
static tmp< snGradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
virtual const word & type() const =0
Runtime type information.
virtual tmp< surfaceScalarField > deltaCoeffs(const GeometricField< Type, fvPatchField, volMesh > &) const =0
Return the interpolation weighting factors for the given field.
constexpr refCount() noexcept
Default construct, initializing count to 0.
Definition refCount.H:63
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace for finite-volume.
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
Forwards and collection of common volume field types.