surfaceInterpolationScheme.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::surfaceInterpolationScheme
26 
27 Description
28  Abstract base class for surface interpolation schemes.
29 
30 SourceFiles
31  surfaceInterpolationScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef surfaceInterpolationScheme_H
36 #define surfaceInterpolationScheme_H
37 
38 #include "tmp.H"
39 #include "volFieldsFwd.H"
40 #include "surfaceFieldsFwd.H"
41 #include "typeInfo.H"
42 #include "runTimeSelectionTables.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class fvMesh;
50 
51 /*---------------------------------------------------------------------------*\
52  Class surfaceInterpolationScheme Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type>
57 :
58  public tmp<surfaceInterpolationScheme<Type>>::refCount
59 {
60  // Private data
61 
62  //- Hold reference to mesh
63  const fvMesh& mesh_;
64 
65 
66  // Private Member Functions
67 
68  //- Disallow copy construct
70 
71  //- Disallow default bitwise assignment
72  void operator=(const surfaceInterpolationScheme&);
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("surfaceInterpolationScheme");
79 
80 
81  // Declare run-time constructor selection tables
82 
84  (
85  tmp,
87  Mesh,
88  (
89  const fvMesh& mesh,
90  Istream& schemeData
91  ),
92  (mesh, schemeData)
93  );
94 
96  (
97  tmp,
99  MeshFlux,
100  (
101  const fvMesh& mesh,
102  const surfaceScalarField& faceFlux,
103  Istream& schemeData
104  ),
105  (mesh, faceFlux, schemeData)
106  );
107 
108 
109  // Constructors
110 
111  //- Construct from mesh
113  :
114  mesh_(mesh)
115  {}
116 
117 
118  // Selectors
119 
120  //- Return new tmp interpolation scheme
122  (
123  const fvMesh& mesh,
124  Istream& schemeData
125  );
126 
127  //- Return new tmp interpolation scheme
129  (
130  const fvMesh& mesh,
131  const surfaceScalarField& faceFlux,
132  Istream& schemeData
133  );
134 
135 
136  //- Destructor
137  virtual ~surfaceInterpolationScheme();
138 
139 
140  // Member Functions
141 
142  //- Return mesh reference
143  const fvMesh& mesh() const
144  {
145  return mesh_;
146  }
147 
148 
149  //- Return the face-interpolate of the given cell field
150  // with the given owner and neighbour weigting factors
153  (
157  );
158 
159  //- Return the face-interpolate of the given cell field
160  // with the given weighting factors dotted with given field Sf
161  template<class SFType>
162  static tmp
163  <
165  <
169  >
170  >
172  (
173  const SFType& Sf,
175  const tmp<surfaceScalarField>& tlambdas
176  );
177 
178  //- Return the face-interpolate of the given cell field
179  // with the given weighting factors
182  (
185  );
186 
187  //- Return the interpolation weighting factors for the given field
189  (
191  ) const = 0;
192 
193  //- Return true if this scheme uses an explicit correction
194  virtual bool corrected() const
195  {
196  return false;
197  }
198 
199  //- Return the explicit correction to the face-interpolate
200  // for the given field
203  {
205  (
206  nullptr
207  );
208  }
209 
210  //- Return the face-interpolate of the given cell field
211  // with explicit correction dotted with given field Sf
212  virtual
213  tmp
214  <
216  <
218  fvsPatchField,
220  >
221  >
223  (
224  const surfaceVectorField& Sf,
226  ) const;
227 
228  //- Return the face-interpolate of the given tmp cell field
229  // with explicit correction dotted with given field Sf
230  tmp
231  <
233  <
234  typename innerProduct<vector, Type>::type,
235  fvsPatchField,
237  >
238  >
240  (
241  const surfaceVectorField& Sf,
243  ) const;
244 
245  //- Return the face-interpolate of the given cell field
246  // with explicit correction
249 
250  //- Return the face-interpolate of the given tmp cell field
251  // with explicit correction
254  (
256  ) const;
257 };
258 
259 
260 template<>
261 tmp
262 <
264  <
268  >
269 >
271 (
272  const surfaceVectorField& Sf,
274 ) const;
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 // Add the patch constructor functions to the hash tables
285 #define makeSurfaceInterpolationTypeScheme(SS, Type) \
286  \
287 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
288  \
289 surfaceInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type>> \
290  add##SS##Type##MeshConstructorToTable_; \
291  \
292 surfaceInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type>> \
293  add##SS##Type##MeshFluxConstructorToTable_;
295 #define makeSurfaceInterpolationScheme(SS) \
296  \
297 makeSurfaceInterpolationTypeScheme(SS, scalar) \
298 makeSurfaceInterpolationTypeScheme(SS, vector) \
299 makeSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
300 makeSurfaceInterpolationTypeScheme(SS, symmTensor) \
301 makeSurfaceInterpolationTypeScheme(SS, tensor)
302 
303 
304 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
305 
306 #ifdef NoRepository
308 #endif
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #endif
313 
314 // ************************************************************************* //
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
declareRunTimeSelectionTable(tmp, surfaceInterpolationScheme, Mesh,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
Mesh data needed to do the Finite Volume discretisation.
Definition: surfaceMesh.H:47
Reference counter for various OpenFOAM components.
Definition: refCount.H:49
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const fvMesh & mesh() const
Return mesh reference.
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
static tmp< GeometricField< typename innerProduct< typename SFType::value_type, Type >::type, fvsPatchField, surfaceMesh > > dotInterpolate(const SFType &Sf, const GeometricField< Type, fvPatchField, volMesh > &vf, const tmp< surfaceScalarField > &tlambdas)
Return the face-interpolate of the given cell field.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const tmp< surfaceScalarField > &, const tmp< surfaceScalarField > &)
Return the face-interpolate of the given cell field.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const =0
Return the interpolation weighting factors for the given field.
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
TypeName("surfaceInterpolationScheme")
Runtime type information.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) - 2 >::type type
Definition: products.H:115
Abstract base class for surface interpolation schemes.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:65
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the face-interpolate.
Namespace for OpenFOAM.