# why the function linearInterpolate(phi) can be directly used?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 4, 2015, 11:12 why the function linearInterpolate(phi) can be directly used? #1 New Member   nemo Join Date: Jan 2015 Posts: 26 Rep Power: 4 Hello. In this wiki page https://openfoamwiki.net/index.php/O...eInterpolation,include this sentence: "The linear scheme is explicitly included with fvCFD.H, a file that at the top level of most solvers. To specifically force a linear interpolation: linearInterpolate(phi);" But I do not understand this,can anyone explain this to me why in the createPhi.H the linearInterpolate(U) can be directly used?THe linearInterpolate() is a part of the class linear..,it confuses me.

November 5, 2015, 06:50
#2
Senior Member

Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 231
Rep Power: 10
Quote:
 Originally Posted by huyidao Hello. In this wiki page https://openfoamwiki.net/index.php/O...eInterpolation,include this sentence: "The linear scheme is explicitly included with fvCFD.H, a file that at the top level of most solvers. To specifically force a linear interpolation: linearInterpolate(phi);" But I do not understand this,can anyone explain this to me why in the createPhi.H the linearInterpolate(U) can be directly used?THe linearInterpolate() is a part of the class linear..,it confuses me.
Hello,

This sentence means that fvCFD.H includes the linear interpolation (linear.H), therefore it is available for every solver.

linearInterpolate() can be directly used because it is a function not a class. To be more precise it is a template function which calls surfaceInterpolationScheme::interpolate static function. linearInterpolate() is defined in linear.H.

Bw,
Hassan

November 5, 2015, 07:34
#3
New Member

nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 4
Thank you.
I finally realize my stupid mistake..I did not read the code carefully..
The function linearInterpolate is not part of class linear.It is defined in the namespace Foam.

Quote:
 template class linear : public surfaceInterpolationScheme { // Private Member Functions //- Disallow default bitwise assignment void operator=(const linear&); public: //- Runtime type information TypeName("linear"); // Constructors //- Construct from mesh linear(const fvMesh& mesh) : surfaceInterpolationScheme(mesh) {} //- Construct from Istream linear(const fvMesh& mesh, Istream&) : surfaceInterpolationScheme(mesh) {} //- Construct from faceFlux and Istream linear ( const fvMesh& mesh, const surfaceScalarField&, Istream& ) : surfaceInterpolationScheme(mesh) {} // Member Functions //- Return the interpolation weighting factors tmp weights ( const GeometricField& ) const { return this->mesh().surfaceInterpolation::weights(); } }; //********************************************** //********************************************** //********************************************** //class linear ends here.. //The linearInterpolate is not a part of class linear //It is defined in namespace Foam //********************************************** // ********************************************* //********************************************** template tmp > linearInterpolate(const GeometricField& vf) { return surfaceInterpolationScheme::interpolate ( vf, vf.mesh().surfaceInterpolation::weights() ); } template tmp > linearInterpolate(const tmp >& tvf) { tmp > tinterp = linearInterpolate(tvf()); tvf.clear(); return tinterp; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post lakeat OpenFOAM Mesh Utilities 57 February 1, 2015 09:25 riesotto OpenFOAM 50 May 26, 2014 01:47 hsingtzu OpenFOAM Native Meshers: blockMesh 2 March 14, 2012 10:56 anand_30 OpenFOAM Meshing & Mesh Conversion 12 December 12, 2011 05:16 ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50

All times are GMT -4. The time now is 13:56.