Loading...
Searching...
No Matches
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 auto tresult = tmp<FieldField<fvsPatchField, Type>>::New(fvpff.size());
282 auto& result = tresult.ref();
283
284 forAll(result, patchi)
285 {
286 result.set
287 (
288 patchi,
289 fvsPatchField<Type>::NewCalculatedType(fvpff[patchi].patch()).ptr()
290 );
291 result[patchi] = fvpff[patchi];
292 }
293
294 return tresult;
295}
296
297
298template<class Type>
301(
302 const tmp<FieldField<fvPatchField, Type>>& tfvpff
303)
304{
305 tmp<FieldField<fvsPatchField, Type>> tfvspff = interpolate(tfvpff());
306 tfvpff.clear();
307 return tfvspff;
308}
309
310
311template<class Type>
313<
315 <
319 >
320>
322(
323 const surfaceVectorField& Sf,
324 const GeometricField<Type, fvPatchField, volMesh>& vf
325)
326{
327 if (surfaceInterpolation::debug)
328 {
330 << "interpolating GeometricField<Type, fvPatchField, volMesh> "
331 << vf.name() << " using run-time selected scheme"
332 << endl;
333 }
334
335 return scheme<Type>
336 (
337 vf.mesh(),
338 "dotInterpolate(" + Sf.name() + ',' + vf.name() + ')'
339 )().dotInterpolate(Sf, vf);
340}
341
342
343template<class Type>
345<
347 <
351 >
352>
354(
355 const surfaceVectorField& Sf,
356 const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf
357)
358{
359 tmp
360 <
361 GeometricField
362 <
364 fvsPatchField,
365 surfaceMesh
366 >
367 > tsf = dotInterpolate(Sf, tvf());
368 tvf.clear();
369 return tsf;
370}
371
372
373// ************************************************************************* //
Generic GeometricField class.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) -2 >::type type
Definition products.H:155
Mesh data needed to do the Finite Volume discretisation.
Definition surfaceMesh.H:47
A class for managing temporary objects.
Definition tmp.H:75
mesh interpolate(rAU)
dynamicFvMesh & mesh
Surface Interpolation.
auto & name
#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:519
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299