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