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-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::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 weighting factors
146  static tmp<SurfaceField<Type>>
148  (
149  const VolField<Type>&,
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  <
162  >
163  >
165  (
166  const SFType& Sf,
167  const VolField<Type>& vf,
168  const tmp<surfaceScalarField>& tlambdas
169  );
170 
171  //- Return the face-interpolate of the given cell field
172  // with the given weighting factors
173  static tmp<SurfaceField<Type>>
175  (
176  const VolField<Type>&,
178  );
179 
180  //- Return the interpolation weighting factors for the given field
182  (
183  const VolField<Type>&
184  ) const = 0;
185 
186  //- Return true if this scheme uses an explicit correction
187  virtual bool corrected() const
188  {
189  return false;
190  }
191 
192  //- Return the explicit correction to the face-interpolate
193  // for the given field
195  correction(const VolField<Type>&) const
196  {
197  return tmp<SurfaceField<Type>>
198  (
199  nullptr
200  );
201  }
202 
203  //- Return the face-interpolate of the given cell field
204  // with explicit correction dotted with given field Sf
207  (
208  const surfaceVectorField& Sf,
209  const VolField<Type>& vf
210  ) const;
211 
212  //- Return the face-interpolate of the given tmp cell field
213  // with explicit correction dotted with given field Sf
216  (
217  const surfaceVectorField& Sf,
218  const tmp<VolField<Type>>&
219  ) const;
220 
221  //- Return the face-interpolate of the given cell field
222  // with explicit correction
223  virtual tmp<SurfaceField<Type>>
224  interpolate(const VolField<Type>&) const;
225 
226  //- Return the face-interpolate of the given tmp cell field
227  // with explicit correction
230  (
231  const tmp<VolField<Type>>&
232  ) const;
233 
234 
235  // Member Operators
236 
237  //- Disallow default bitwise assignment
238  void operator=(const surfaceInterpolationScheme&) = delete;
239 };
240 
241 
242 template<>
245 (
246  const surfaceVectorField& Sf,
247  const VolField<scalar>&
248 ) const;
249 
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 } // End namespace Foam
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 // Add the patch constructor functions to the hash tables
258 
259 #define makeSurfaceInterpolationTypeScheme(SS, Type) \
260  \
261 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
262  \
263 surfaceInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type>> \
264  add##SS##Type##MeshConstructorToTable_; \
265  \
266 surfaceInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type>> \
267  add##SS##Type##MeshFluxConstructorToTable_;
268 
269 #define makeSurfaceInterpolationScheme(SS) \
270  \
271 makeSurfaceInterpolationTypeScheme(SS, scalar) \
272 makeSurfaceInterpolationTypeScheme(SS, vector) \
273 makeSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
274 makeSurfaceInterpolationTypeScheme(SS, symmTensor) \
275 makeSurfaceInterpolationTypeScheme(SS, tensor)
276 
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 #ifdef NoRepository
282 #endif
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 #endif
287 
288 // ************************************************************************* //
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:99
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) - 2 >::type type
Definition: products.H:115
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Abstract base class for surface interpolation schemes.
static tmp< SurfaceField< typename innerProduct< typename SFType::value_type, Type >::type > > dotInterpolate(const SFType &Sf, const VolField< Type > &vf, const tmp< surfaceScalarField > &tlambdas)
Return the face-interpolate of the given cell field.
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
surfaceInterpolationScheme(const fvMesh &mesh)
Construct from mesh.
const fvMesh & mesh() const
Return mesh reference.
virtual tmp< SurfaceField< Type > > correction(const VolField< Type > &) const
Return the explicit correction to the face-interpolate.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &, const tmp< surfaceScalarField > &, const tmp< surfaceScalarField > &)
Return the face-interpolate of the given cell field.
TypeName("surfaceInterpolationScheme")
Runtime type information.
virtual tmp< surfaceScalarField > weights(const VolField< Type > &) const =0
Return the interpolation weighting factors for the given field.
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
declareRunTimeSelectionTable(tmp, surfaceInterpolationScheme, Mesh,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
void operator=(const surfaceInterpolationScheme &)=delete
Disallow default bitwise assignment.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...