CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

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

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By huyidao

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 4, 2015, 10:12
Default why the function linearInterpolate(phi) can be directly used?
  #1
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
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.
huyidao is offline   Reply With Quote

Old   November 5, 2015, 05:50
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
Quote:
Originally Posted by huyidao View Post
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
hk318i is offline   Reply With Quote

Old   November 5, 2015, 06:34
Default
  #3
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
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 Type>
class linear
:
public surfaceInterpolationScheme<Type>
{
// 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<Type>(mesh)
{}
//- Construct from Istream
linear(const fvMesh& mesh, Istream&)
:
surfaceInterpolationScheme<Type>(mesh)
{}
//- Construct from faceFlux and Istream
linear
(
const fvMesh& mesh,
const surfaceScalarField&,
Istream&
)
:
surfaceInterpolationScheme<Type>(mesh)
{}
// Member Functions
//- Return the interpolation weighting factors
tmp<surfaceScalarField> weights
(
const GeometricField<Type, fvPatchField, volMesh>&
) 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<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
linearInterpolate(const GeometricField<Type, fvPatchField, volMesh>& vf)
{
return surfaceInterpolationScheme<Type>::interpolate
(
vf,
vf.mesh().surfaceInterpolation::weights()
);
}
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
linearInterpolate(const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf)
{
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tinterp =
linearInterpolate(tvf());
tvf.clear();
return tinterp;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
Michael@UW likes this.
huyidao is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


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