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

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

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 4, 2015, 11:12
Default why the function linearInterpolate(phi) can be directly used?
  #1
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 3
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, 06:50
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 208
Rep Power: 10
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 online now   Reply With Quote

Old   November 5, 2015, 07:34
Default
  #3
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 3
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
huyidao is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Mesh Utilities 57 February 1, 2015 09:25
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Native Meshers: blockMesh 2 March 14, 2012 10:56
mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 12 December 12, 2011 05:16
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 16:53.