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 -------------------------------------------------------------------------------
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::laplacianScheme
28 
29 Group
30  grpFvLaplacianSchemes
31 
32 Description
33  Abstract base class for laplacian schemes.
34 
35 SourceFiles
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"
49 #include "runTimeSelectionTables.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 template<class Type>
57 class fvMatrix;
58 
59 class fvMesh;
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace fv
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class laplacianScheme Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class Type, class GType>
71 class laplacianScheme
72 :
73  public refCount
74 {
75 
76 protected:
77 
78  // Protected data
79 
80  const fvMesh& mesh_;
83 
84 
85 private:
86 
87  // Private Member Functions
88 
89  //- No copy construct
90  laplacianScheme(const laplacianScheme&) = delete;
91 
92  //- No copy assignment
93  void operator=(const laplacianScheme&) = 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,
108  Istream,
109  (const fvMesh& mesh, Istream& schemeData),
110  (mesh, schemeData)
111  );
112 
113 
114  // Constructors
115 
116  //- Construct from mesh
117  laplacianScheme(const fvMesh& mesh)
118  :
119  mesh_(mesh),
120  tinterpGammaScheme_(new linear<GType>(mesh)),
122  {}
123 
124  //- Construct from mesh and Istream
125  laplacianScheme(const fvMesh& mesh, Istream& is)
126  :
127  mesh_(mesh),
128  tinterpGammaScheme_(nullptr),
129  tsnGradScheme_(nullptr)
130  {
132  (
134  );
135 
137  (
139  );
140  }
141 
142  //- Construct from mesh, interpolation and snGradScheme schemes
144  (
145  const fvMesh& mesh,
147  const tmp<snGradScheme<Type>>& sngs
148  )
149  :
150  mesh_(mesh),
151  tinterpGammaScheme_(igs),
152  tsnGradScheme_(sngs)
153  {}
154 
155 
156  // Selectors
157 
158  //- Return a pointer to a new laplacianScheme created on freestore
160  (
161  const fvMesh& mesh,
162  Istream& schemeData
163  );
164 
165 
166  //- Destructor
167  virtual ~laplacianScheme() = default;
168 
169 
170  // Member Functions
171 
172  //- Return mesh reference
173  const fvMesh& mesh() const
174  {
175  return mesh_;
176  }
177 
179  (
182  ) = 0;
183 
185  (
188  );
189 
191  (
193  ) = 0;
194 
196  (
199  ) = 0;
200 
202  (
205  );
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace fv
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 // Add the patch constructor functions to the hash tables
220 
221 #define makeFvLaplacianTypeScheme(SS, GType, Type) \
222  typedef Foam::fv::SS<Foam::Type, Foam::GType> SS##Type##GType; \
223  defineNamedTemplateTypeNameAndDebug(SS##Type##GType, 0); \
224  \
225  namespace Foam \
226  { \
227  namespace fv \
228  { \
229  typedef SS<Type, GType> SS##Type##GType; \
230  \
231  laplacianScheme<Type, GType>:: \
232  addIstreamConstructorToTable<SS<Type, GType>> \
233  add##SS##Type##GType##IstreamConstructorToTable_; \
234  } \
235  }
236 
237 
238 #define makeFvLaplacianScheme(SS) \
239  \
240 makeFvLaplacianTypeScheme(SS, scalar, scalar) \
241 makeFvLaplacianTypeScheme(SS, symmTensor, scalar) \
242 makeFvLaplacianTypeScheme(SS, tensor, scalar) \
243 makeFvLaplacianTypeScheme(SS, scalar, vector) \
244 makeFvLaplacianTypeScheme(SS, symmTensor, vector) \
245 makeFvLaplacianTypeScheme(SS, tensor, vector) \
246 makeFvLaplacianTypeScheme(SS, scalar, sphericalTensor) \
247 makeFvLaplacianTypeScheme(SS, symmTensor, sphericalTensor) \
248 makeFvLaplacianTypeScheme(SS, tensor, sphericalTensor) \
249 makeFvLaplacianTypeScheme(SS, scalar, symmTensor) \
250 makeFvLaplacianTypeScheme(SS, symmTensor, symmTensor) \
251 makeFvLaplacianTypeScheme(SS, tensor, symmTensor) \
252 makeFvLaplacianTypeScheme(SS, scalar, tensor) \
253 makeFvLaplacianTypeScheme(SS, symmTensor, tensor) \
254 makeFvLaplacianTypeScheme(SS, tensor, tensor)
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #ifdef NoRepository
259  #include "laplacianScheme.C"
260 #endif
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
Foam::fv::laplacianScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: laplacianScheme.H:172
volFieldsFwd.H
Foam::surfaceInterpolationScheme::New
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: surfaceInterpolationScheme.C:40
Foam::fv::laplacianScheme::New
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
Definition: laplacianScheme.C:48
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
typeInfo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::fv::laplacianScheme::tinterpGammaScheme_
tmp< surfaceInterpolationScheme< GType > > tinterpGammaScheme_
Definition: laplacianScheme.H:80
laplacianScheme.C
Foam::fv::laplacianScheme
Abstract base class for laplacian schemes.
Definition: laplacianScheme.H:70
Foam::fv::laplacianScheme::~laplacianScheme
virtual ~laplacianScheme()=default
Destructor.
Foam::fv::laplacianScheme::mesh_
const fvMesh & mesh_
Definition: laplacianScheme.H:79
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::fv::laplacianScheme::laplacianScheme
laplacianScheme(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
Definition: laplacianScheme.H:124
Foam::fv::laplacianScheme::fvmLaplacian
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)=0
Foam::fv::laplacianScheme::laplacianScheme
laplacianScheme(const fvMesh &mesh)
Construct from mesh.
Definition: laplacianScheme.H:116
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
correctedSnGrad.H
Foam::fv::laplacianScheme::type
virtual const word & type() const =0
Runtime type information.
Foam::fv::laplacianScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, laplacianScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
fv
labelList fv(nPoints)
tmp.H
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::fv::laplacianScheme::tsnGradScheme_
tmp< snGradScheme< Type > > tsnGradScheme_
Definition: laplacianScheme.H:81
surfaceFieldsFwd.H
Foam::fv::correctedSnGrad
Surface gradient scheme with full explicit non-orthogonal correction.
Definition: correctedSnGrad.H:69
Foam::fv::laplacianScheme::fvcLaplacian
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)=0
Foam::surfaceInterpolationScheme< GType >
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::linear
Central-differencing interpolation scheme class.
Definition: linear.H:55
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53