surfaceInterpolate.C
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-------------------------------------------------------------------------------
10License
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\*---------------------------------------------------------------------------*/
27
28#include "surfaceInterpolate.H"
29
30// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31
32template<class Type>
35(
36 const surfaceScalarField& faceFlux,
37 Istream& streamData
38)
39{
40 return surfaceInterpolationScheme<Type>::New
41 (
42 faceFlux.mesh(),
43 faceFlux,
44 streamData
45 );
46}
47
48
49template<class Type>
51(
52 const surfaceScalarField& faceFlux,
53 const word& name
54)
55{
56 return surfaceInterpolationScheme<Type>::New
57 (
58 faceFlux.mesh(),
59 faceFlux,
60 faceFlux.mesh().interpolationScheme(name)
61 );
62}
63
64
65template<class Type>
67(
68 const fvMesh& mesh,
69 Istream& streamData
70)
71{
72 return surfaceInterpolationScheme<Type>::New
73 (
74 mesh,
75 streamData
76 );
77}
78
79
80template<class Type>
82(
83 const fvMesh& mesh,
84 const word& name
85)
86{
87 return surfaceInterpolationScheme<Type>::New
88 (
89 mesh,
90 mesh.interpolationScheme(name)
91 );
92}
93
94
95template<class Type>
98(
99 const GeometricField<Type, fvPatchField, volMesh>& vf,
100 const surfaceScalarField& faceFlux,
101 Istream& schemeData
102)
103{
104 if (surfaceInterpolation::debug)
105 {
107 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
108 << vf.name() << endl;
109 }
110
111 return scheme<Type>(faceFlux, schemeData)().interpolate(vf);
112}
113
114
115template<class Type>
118(
119 const GeometricField<Type, fvPatchField, volMesh>& vf,
120 const surfaceScalarField& faceFlux,
121 const word& name
122)
123{
124 if (surfaceInterpolation::debug)
125 {
127 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
128 << vf.name() << " using " << name << endl;
129 }
130
131 return scheme<Type>(faceFlux, name)().interpolate(vf);
132}
133
134template<class Type>
137(
138 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf,
139 const surfaceScalarField& faceFlux,
140 const word& name
141)
142{
143 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf =
144 interpolate(tvf(), faceFlux, name);
145
146 tvf.clear();
147
148 return tsf;
149}
150
151template<class Type>
154(
155 const GeometricField<Type, fvPatchField, volMesh>& vf,
156 const tmp<surfaceScalarField>& tFaceFlux,
157 const word& name
158)
159{
160 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf =
161 interpolate(vf, tFaceFlux(), name);
162
163 tFaceFlux.clear();
164
165 return tsf;
166}
167
168template<class Type>
171(
172 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf,
173 const tmp<surfaceScalarField>& tFaceFlux,
174 const word& name
175)
176{
177 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf =
178 interpolate(tvf(), tFaceFlux(), name);
179
180 tvf.clear();
181 tFaceFlux.clear();
182
183 return tsf;
184}
185
186
187template<class Type>
190(
191 const GeometricField<Type, fvPatchField, volMesh>& vf,
192 Istream& schemeData
193)
194{
195 if (surfaceInterpolation::debug)
196 {
198 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
199 << vf.name() << endl;
200 }
201
202 return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf);
203}
204
205template<class Type>
208(
209 const GeometricField<Type, fvPatchField, volMesh>& vf,
210 const word& name
211)
212{
213 if (surfaceInterpolation::debug)
214 {
216 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
217 << vf.name() << " using " << name
218 << endl;
219 }
220
221 return scheme<Type>(vf.mesh(), name)().interpolate(vf);
222}
223
224template<class Type>
227(
228 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf,
229 const word& name
230)
231{
232 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf =
233 interpolate(tvf(), name);
234
235 tvf.clear();
236
237 return tsf;
238}
239
240
241template<class Type>
244(
245 const GeometricField<Type, fvPatchField, volMesh>& vf
246)
247{
248 if (surfaceInterpolation::debug)
249 {
251 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
252 << vf.name() << " using run-time selected scheme"
253 << endl;
254 }
255
256 return interpolate(vf, "interpolate(" + vf.name() + ')');
257}
258
259
260template<class Type>
263(
264 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf
265)
266{
267 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf =
268 interpolate(tvf());
269 tvf.clear();
270 return tsf;
271}
272
273
274template<class Type>
277(
278 const FieldField<fvPatchField, Type>& fvpff
279)
280{
281 FieldField<fvsPatchField, Type>* fvspffPtr
282 (
283 new FieldField<fvsPatchField, Type>(fvpff.size())
284 );
285
286 forAll(*fvspffPtr, patchi)
287 {
288 fvspffPtr->set
289 (
290 patchi,
291 fvsPatchField<Type>::NewCalculatedType(fvpff[patchi].patch()).ptr()
292 );
293 (*fvspffPtr)[patchi] = fvpff[patchi];
294 }
295
296 return tmp<FieldField<fvsPatchField, Type>>(fvspffPtr);
297}
298
299
300template<class Type>
303(
304 const tmp<FieldField<fvPatchField, Type>>& tfvpff
305)
306{
307 tmp<FieldField<fvsPatchField, Type>> tfvspff = interpolate(tfvpff());
308 tfvpff.clear();
309 return tfvspff;
310}
311
312
313template<class Type>
315<
317 <
321 >
322>
324(
325 const surfaceVectorField& Sf,
326 const GeometricField<Type, fvPatchField, volMesh>& vf
327)
328{
329 if (surfaceInterpolation::debug)
330 {
332 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
333 << vf.name() << " using run-time selected scheme"
334 << endl;
335 }
336
337 return scheme<Type>
338 (
339 vf.mesh(),
340 "dotInterpolate(" + Sf.name() + ',' + vf.name() + ')'
341 )().dotInterpolate(Sf, vf);
342}
343
344
345template<class Type>
347<
349 <
353 >
354>
356(
357 const surfaceVectorField& Sf,
358 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf
359)
360{
361 tmp
362 <
363 GeometricField
364 <
366 fvsPatchField,
367 surfaceMesh
368 >
369 > tsf = dotInterpolate(Sf, tvf());
370 tvf.clear();
371 return tsf;
372}
373
374
375// ************************************************************************* //
Generic GeometricField class.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:79
Mesh data needed to do the Finite Volume discretisation.
Definition: surfaceMesh.H:52
A class for managing temporary objects.
Definition: tmp.H:65
type
Volume classification types.
Definition: volumeType.H:66
mesh interpolate(rAU)
dynamicFvMesh & mesh
#define InfoInFunction
Report an information message using Foam::Info.
const std::string patch
OpenFOAM patch number as a std::string.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
static tmp< surfaceInterpolationScheme< Type > > scheme(const surfaceScalarField &faceFlux, Istream &schemeData)
Return weighting factors for scheme given from Istream.
static tmp< GeometricField< typename innerProduct< vector, Type >::type, fvsPatchField, surfaceMesh > > dotInterpolate(const surfaceVectorField &Sf, const GeometricField< Type, fvPatchField, volMesh > &tvf)
Interpolate field onto faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333