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-2023 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_;
76 
78 
80 
81 
82 public:
83 
84  //- Runtime type information
85  virtual const word& type() const = 0;
86 
87 
88  // Declare run-time constructor selection tables
89 
91  (
92  tmp,
94  Istream,
95  (const fvMesh& mesh, Istream& schemeData),
96  (mesh, schemeData)
97  );
98 
99 
100  // Constructors
101 
102  //- Construct from mesh
103  laplacianScheme(const fvMesh& mesh)
104  :
105  mesh_(mesh),
106  tinterpGammaScheme_(new linear<GType>(mesh)),
108  {}
109 
110  //- Construct from mesh and Istream
111  laplacianScheme(const fvMesh& mesh, Istream& is)
112  :
113  mesh_(mesh),
114  tinterpGammaScheme_(nullptr),
115  tsnGradScheme_(nullptr)
116  {
118  (
120  );
121 
123  (
125  );
126  }
127 
128  //- Construct from mesh, interpolation and snGradScheme schemes
130  (
131  const fvMesh& mesh,
133  const tmp<snGradScheme<Type>>& sngs
134  )
135  :
136  mesh_(mesh),
137  tinterpGammaScheme_(igs),
138  tsnGradScheme_(sngs)
139  {}
140 
141  //- Disallow default bitwise copy construction
142  laplacianScheme(const laplacianScheme&) = delete;
143 
144 
145  // Selectors
146 
147  //- Return a pointer to a new laplacianScheme created on freestore
149  (
150  const fvMesh& mesh,
151  Istream& schemeData
152  );
153 
154 
155  //- Destructor
156  virtual ~laplacianScheme();
157 
158 
159  // Member Functions
160 
161  //- Return mesh reference
162  const fvMesh& mesh() const
163  {
164  return mesh_;
165  }
166 
168  (
169  const SurfaceField<GType>&,
170  const VolField<Type>&
171  ) = 0;
172 
174  (
175  const VolField<GType>&,
176  const VolField<Type>&
177  );
178 
180  (
181  const VolField<Type>&
182  ) = 0;
183 
185  (
186  const SurfaceField<GType>&,
187  const VolField<Type>&
188  ) = 0;
189 
191  (
192  const VolField<GType>&,
193  const VolField<Type>&
194  );
195 
196 
197  // Member Operators
198 
199  //- Disallow default bitwise assignment
200  void operator=(const laplacianScheme&) = delete;
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
215 
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 
232 
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 // ************************************************************************* //
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:101
Simple central-difference snGrad scheme with non-orthogonal correction.
Abstract base class for laplacian schemes.
virtual tmp< fvMatrix< Type > > fvmLaplacian(const SurfaceField< GType > &, const VolField< Type > &)=0
virtual const word & type() const =0
Runtime type information.
const fvMesh & mesh() const
Return mesh reference.
declareRunTimeSelectionTable(tmp, laplacianScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
void operator=(const laplacianScheme &)=delete
Disallow default bitwise assignment.
tmp< snGradScheme< Type > > tsnGradScheme_
virtual ~laplacianScheme()
Destructor.
virtual tmp< VolField< Type > > fvcLaplacian(const VolField< Type > &)=0
tmp< surfaceInterpolationScheme< GType > > tinterpGammaScheme_
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)
Construct from mesh.
Abstract base class for snGrad schemes.
Definition: snGradScheme.H:63
static tmp< snGradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: snGradScheme.C:46
Centred interpolation interpolation scheme class.
Definition: linear.H:53
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Abstract base class for surface interpolation schemes.
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
Macros to ease declaration of run-time selection tables.