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-2019 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 public:
67 
68  //- Runtime type information
69  TypeName("surfaceInterpolationScheme");
70 
71 
72  // Declare run-time constructor selection tables
73 
75  (
76  tmp,
78  Mesh,
79  (
80  const fvMesh& mesh,
81  Istream& schemeData
82  ),
83  (mesh, schemeData)
84  );
85 
87  (
88  tmp,
90  MeshFlux,
91  (
92  const fvMesh& mesh,
93  const surfaceScalarField& faceFlux,
94  Istream& schemeData
95  ),
96  (mesh, faceFlux, schemeData)
97  );
98 
99 
100  // Constructors
101 
102  //- Construct from mesh
104  :
105  mesh_(mesh)
106  {}
107 
108  //- Disallow default bitwise copy construction
110 
111 
112 
113  // Selectors
114 
115  //- Return new tmp interpolation scheme
117  (
118  const fvMesh& mesh,
119  Istream& schemeData
120  );
121 
122  //- Return new tmp interpolation scheme
124  (
125  const fvMesh& mesh,
126  const surfaceScalarField& faceFlux,
127  Istream& schemeData
128  );
129 
130 
131  //- Destructor
132  virtual ~surfaceInterpolationScheme();
133 
134 
135  // Member Functions
136 
137  //- Return mesh reference
138  const fvMesh& mesh() const
139  {
140  return mesh_;
141  }
142 
143 
144  //- Return the face-interpolate of the given cell field
145  // with the given owner and neighbour weigting factors
148  (
152  );
153 
154  //- Return the face-interpolate of the given cell field
155  // with the given weighting factors dotted with given field Sf
156  template<class SFType>
157  static tmp
158  <
160  <
164  >
165  >
167  (
168  const SFType& Sf,
170  const tmp<surfaceScalarField>& tlambdas
171  );
172 
173  //- Return the face-interpolate of the given cell field
174  // with the given weighting factors
177  (
180  );
181 
182  //- Return the interpolation weighting factors for the given field
184  (
186  ) const = 0;
187 
188  //- Return true if this scheme uses an explicit correction
189  virtual bool corrected() const
190  {
191  return false;
192  }
193 
194  //- Return the explicit correction to the face-interpolate
195  // for the given field
198  {
200  (
201  nullptr
202  );
203  }
204 
205  //- Return the face-interpolate of the given cell field
206  // with explicit correction dotted with given field Sf
207  virtual
208  tmp
209  <
211  <
213  fvsPatchField,
215  >
216  >
218  (
219  const surfaceVectorField& Sf,
221  ) const;
222 
223  //- Return the face-interpolate of the given tmp cell field
224  // with explicit correction dotted with given field Sf
225  tmp
226  <
228  <
229  typename innerProduct<vector, Type>::type,
230  fvsPatchField,
232  >
233  >
235  (
236  const surfaceVectorField& Sf,
238  ) const;
239 
240  //- Return the face-interpolate of the given cell field
241  // with explicit correction
244 
245  //- Return the face-interpolate of the given tmp cell field
246  // with explicit correction
249  (
251  ) const;
252 
253 
254  // Member Operators
255 
256  //- Disallow default bitwise assignment
257  void operator=(const surfaceInterpolationScheme&) = delete;
258 };
259 
260 
261 template<>
262 tmp
263 <
265  <
269  >
270 >
272 (
273  const surfaceVectorField& Sf,
275 ) const;
276 
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 } // End namespace Foam
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 // Add the patch constructor functions to the hash tables
286 #define makeSurfaceInterpolationTypeScheme(SS, Type) \
287  \
288 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
289  \
290 surfaceInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type>> \
291  add##SS##Type##MeshConstructorToTable_; \
292  \
293 surfaceInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type>> \
294  add##SS##Type##MeshFluxConstructorToTable_;
296 #define makeSurfaceInterpolationScheme(SS) \
297  \
298 makeSurfaceInterpolationTypeScheme(SS, scalar) \
299 makeSurfaceInterpolationTypeScheme(SS, vector) \
300 makeSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
301 makeSurfaceInterpolationTypeScheme(SS, symmTensor) \
302 makeSurfaceInterpolationTypeScheme(SS, tensor)
303 
304 
305 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 
307 #ifdef NoRepository
309 #endif
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 #endif
314 
315 // ************************************************************************* //
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
surfaceInterpolationScheme(const fvMesh &mesh)
Construct from mesh.
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.
void operator=(const surfaceInterpolationScheme &)=delete
Disallow default bitwise assignment.
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.