Loading...
Searching...
No Matches
laplacianScheme.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::fv::laplacianScheme
28
29Group
30 grpFvLaplacianSchemes
31
32Description
33 Abstract base class for laplacian schemes.
34
35SourceFiles
36 laplacianScheme.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef laplacianScheme_H
41#define laplacianScheme_H
42
43#include "tmp.H"
44#include "volFieldsFwd.H"
45#include "surfaceFieldsFwd.H"
46#include "linear.H"
47#include "correctedSnGrad.H"
48#include "typeInfo.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56// Forward Declarations
57template<class Type> class fvMatrix;
58class fvMesh;
59
60// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62namespace fv
63{
64
65/*---------------------------------------------------------------------------*\
66 Class laplacianScheme Declaration
67\*---------------------------------------------------------------------------*/
68
69template<class Type, class GType>
71:
72 public refCount
74protected:
76 // Protected Data
77
78 const fvMesh& mesh_;
81
82
83 // Protected Member Functions
84
85 //- No copy construct
86 laplacianScheme(const laplacianScheme&) = delete;
87
88 //- No copy assignment
89 void operator=(const laplacianScheme&) = delete;
90
91
92public:
93
94 //- Runtime type information
95 virtual const word& type() const = 0;
97
98 // Declare run-time constructor selection tables
99
102 tmp,
104 Istream,
105 (const fvMesh& mesh, Istream& schemeData),
106 (mesh, schemeData)
107 );
108
109
110 // Constructors
111
112 //- Construct from mesh
114 :
115 mesh_(mesh),
118 {}
119
120 //- Construct from mesh and Istream
122 :
123 mesh_(mesh)
124 {
125 if (is.eof())
127 tinterpGammaScheme_.reset(new linear<GType>(mesh));
128 tsnGradScheme_.reset(new correctedSnGrad<Type>(mesh));
129 }
130 else
131 {
132 tinterpGammaScheme_.reset
133 (
134 surfaceInterpolationScheme<GType>::New(mesh, is)
135 );
136
137 tsnGradScheme_.reset
138 (
139 snGradScheme<Type>::New(mesh, is)
140 );
141 }
142 }
143
144 //- Construct from mesh, interpolation and snGradScheme schemes
146 (
147 const fvMesh& mesh,
149 const tmp<snGradScheme<Type>>& sngs
150 )
151 :
154 tsnGradScheme_(sngs)
155 {}
156
157
158 // Selectors
159
160 //- Return a pointer to a new laplacianScheme created on freestore
162 (
163 const fvMesh& mesh,
164 Istream& schemeData
165 );
166
167
168 //- Destructor
169 virtual ~laplacianScheme() = default;
171
172 // Member Functions
173
174 //- Return mesh reference
175 const fvMesh& mesh() const
176 {
177 return mesh_;
178 }
179
181 (
184 ) = 0;
185
187 (
195 ) = 0;
196
198 (
201 ) = 0;
202
204 (
207 );
208};
209
211// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212
213} // End namespace fv
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217} // End namespace Foam
218
219// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220
221// Add the patch constructor functions to the hash tables
222
223#define makeFvLaplacianTypeScheme(SS, GType, Type) \
224 typedef Foam::fv::SS<Foam::Type, Foam::GType> SS##Type##GType; \
225 defineNamedTemplateTypeNameAndDebug(SS##Type##GType, 0); \
226 \
227 namespace Foam \
228 { \
229 namespace fv \
230 { \
231 typedef SS<Type, GType> SS##Type##GType; \
232 \
233 laplacianScheme<Type, GType>:: \
234 addIstreamConstructorToTable<SS<Type, GType>> \
235 add##SS##Type##GType##IstreamConstructorToTable_; \
236 } \
237 }
238
239
240#define makeFvLaplacianScheme(SS) \
241 \
242makeFvLaplacianTypeScheme(SS, scalar, scalar) \
243makeFvLaplacianTypeScheme(SS, symmTensor, scalar) \
244makeFvLaplacianTypeScheme(SS, tensor, scalar) \
245makeFvLaplacianTypeScheme(SS, scalar, vector) \
246makeFvLaplacianTypeScheme(SS, symmTensor, vector) \
247makeFvLaplacianTypeScheme(SS, tensor, vector) \
248makeFvLaplacianTypeScheme(SS, scalar, sphericalTensor) \
249makeFvLaplacianTypeScheme(SS, symmTensor, sphericalTensor) \
250makeFvLaplacianTypeScheme(SS, tensor, sphericalTensor) \
251makeFvLaplacianTypeScheme(SS, scalar, symmTensor) \
252makeFvLaplacianTypeScheme(SS, symmTensor, symmTensor) \
253makeFvLaplacianTypeScheme(SS, tensor, symmTensor) \
254makeFvLaplacianTypeScheme(SS, scalar, tensor) \
255makeFvLaplacianTypeScheme(SS, symmTensor, tensor) \
256makeFvLaplacianTypeScheme(SS, tensor, tensor)
257
258// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259
260#ifdef NoRepository
261 #include "laplacianScheme.C"
262#endif
263
264// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265
266#endif
267
268// ************************************************************************* //
Generic GeometricField class.
bool eof() const noexcept
True if end of input seen.
Definition IOstream.H:289
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Surface gradient scheme with full explicit non-orthogonal correction.
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)=0
laplacianScheme(const laplacianScheme &)=delete
No copy construct.
declareRunTimeSelectionTable(tmp, laplacianScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
void operator=(const laplacianScheme &)=delete
No copy assignment.
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)=0
tmp< snGradScheme< scalar > > tsnGradScheme_
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< GType, fvPatchField, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
laplacianScheme(const fvMesh &mesh, const tmp< surfaceInterpolationScheme< GType > > &igs, const tmp< snGradScheme< Type > > &sngs)
Construct from mesh, interpolation and snGradScheme schemes.
tmp< surfaceInterpolationScheme< scalar > > tinterpGammaScheme_
virtual ~laplacianScheme()=default
Destructor.
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
laplacianScheme(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
laplacianScheme(const fvMesh &mesh)
Construct from mesh.
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvPatchField, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)=0
virtual const word & type() const =0
Runtime type information.
Abstract base class for runtime selected snGrad surface normal gradient schemes.
Central-differencing interpolation scheme class.
Definition linear.H:54
constexpr refCount() noexcept
Default construct, initializing count to 0.
Definition refCount.H:63
Abstract base class for surface interpolation schemes.
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.
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.