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 // Forward Declarations
57 template<class Type> class fvMatrix;
58 class fvMesh;
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace fv
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class laplacianScheme Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class Type, class GType>
70 class laplacianScheme
71 :
72  public refCount
73 {
74 protected:
75 
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 
92 public:
93 
94  //- Runtime type information
95  virtual const word& type() const = 0;
96 
97 
98  // Declare run-time constructor selection tables
99 
101  (
102  tmp,
104  Istream,
105  (const fvMesh& mesh, Istream& schemeData),
106  (mesh, schemeData)
107  );
108 
109 
110  // Constructors
111 
112  //- Construct from mesh
113  laplacianScheme(const fvMesh& mesh)
114  :
115  mesh_(mesh),
118  {}
119 
120  //- Construct from mesh and Istream
121  laplacianScheme(const fvMesh& mesh, Istream& is)
122  :
123  mesh_(mesh)
124  {
125  if (is.eof())
126  {
129  }
130  else
131  {
132  tinterpGammaScheme_.reset
133  (
135  );
136 
137  tsnGradScheme_.reset
138  (
140  );
141  }
142  }
143 
144  //- Construct from mesh, interpolation and snGradScheme schemes
146  (
147  const fvMesh& mesh,
148  const tmp<surfaceInterpolationScheme<GType>>& igs,
149  const tmp<snGradScheme<Type>>& sngs
150  )
151  :
152  mesh_(mesh),
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;
170 
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  (
190  );
191 
193  (
195  ) = 0;
196 
198  (
201  ) = 0;
202 
204  (
207  );
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace fv
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
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  \
242 makeFvLaplacianTypeScheme(SS, scalar, scalar) \
243 makeFvLaplacianTypeScheme(SS, symmTensor, scalar) \
244 makeFvLaplacianTypeScheme(SS, tensor, scalar) \
245 makeFvLaplacianTypeScheme(SS, scalar, vector) \
246 makeFvLaplacianTypeScheme(SS, symmTensor, vector) \
247 makeFvLaplacianTypeScheme(SS, tensor, vector) \
248 makeFvLaplacianTypeScheme(SS, scalar, sphericalTensor) \
249 makeFvLaplacianTypeScheme(SS, symmTensor, sphericalTensor) \
250 makeFvLaplacianTypeScheme(SS, tensor, sphericalTensor) \
251 makeFvLaplacianTypeScheme(SS, scalar, symmTensor) \
252 makeFvLaplacianTypeScheme(SS, symmTensor, symmTensor) \
253 makeFvLaplacianTypeScheme(SS, tensor, symmTensor) \
254 makeFvLaplacianTypeScheme(SS, scalar, tensor) \
255 makeFvLaplacianTypeScheme(SS, symmTensor, tensor) \
256 makeFvLaplacianTypeScheme(SS, tensor, tensor)
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #ifdef NoRepository
261  #include "laplacianScheme.C"
262 #endif
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
virtual ~laplacianScheme()=default
Destructor.
Reference counter for various OpenFOAM components.
Definition: refCount.H:44
Forwards and collection of common volume field types.
Central-differencing interpolation scheme class.
Definition: linear.H:51
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Abstract base class for laplacian schemes.
Generic GeometricField class.
tmp< surfaceInterpolationScheme< GType > > tinterpGammaScheme_
laplacianScheme(const laplacianScheme &)=delete
No copy construct.
A class for handling words, derived from Foam::string.
Definition: word.H:63
labelList fv(nPoints)
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
Abstract base class for runtime selected snGrad surface normal gradient schemes.
Definition: snGradScheme.H:72
Basic run-time type information using word as the type&#39;s name. Used to enhance the standard RTTI to c...
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
void operator=(const laplacianScheme &)=delete
No copy assignment.
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: HashPtrTable.H:50
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.
Abstract base class for surface interpolation schemes.
tmp< snGradScheme< Type > > tsnGradScheme_
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:289
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)=0
Namespace for OpenFOAM.