Normal vector of wall is included into the wall velocity calculations

This commit is contained in:
Hamidreza
2025-07-22 13:54:23 +03:30
parent e62ba11a8d
commit c340040b40
14 changed files with 187 additions and 134 deletions

View File

@ -251,6 +251,8 @@ struct pwInteractionFunctor
realx3 xi = pos_[i]; realx3 xi = pos_[i];
realx3x3 tri = triangles_(tj); realx3x3 tri = triangles_(tj);
const realx3& normW = triangles_.normal(tj);
real ovrlp; real ovrlp;
realx3 Nij, cp; realx3 Nij, cp;
@ -262,7 +264,7 @@ struct pwInteractionFunctor
int32 mInd = wTriMotionIndex_[tj]; int32 mInd = wTriMotionIndex_[tj];
auto Vw = motionModel_(mInd, cp); auto Vw = motionModel_(mInd, cp, normW);
//output<< "par-wall index "<< i<<" - "<< tj<<endl; //output<< "par-wall index "<< i<<" - "<< tj<<endl;

View File

@ -238,7 +238,9 @@ struct pwInteractionFunctor
real Rj = 10000.0; real Rj = 10000.0;
realx3 xi = pos_[i]; realx3 xi = pos_[i];
realx3x3 tri = triangles_(tj); const realx3x3 tri = triangles_(tj);
const realx3& normW = triangles_.normal(tj);
real ovrlp; real ovrlp;
realx3 Nij, cp; realx3 Nij, cp;
@ -250,7 +252,7 @@ struct pwInteractionFunctor
int32 mInd = wTriMotionIndex_[tj]; int32 mInd = wTriMotionIndex_[tj];
auto Vw = motionModel_(mInd, cp); auto Vw = motionModel_(mInd, cp, normW);
//output<< "par-wall index "<< i<<" - "<< tj<<endl; //output<< "par-wall index "<< i<<" - "<< tj<<endl;

View File

@ -85,15 +85,15 @@ public:
~ModelInterface()=default; ~ModelInterface()=default;
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 pointVelocity(uint32 n, const realx3& p)const realx3 pointVelocity(uint32 n, const realx3& p, const realx3& wallNormal)const
{ {
return components_[n].linVelocityPoint(p); return components_[n].linVelocityPoint(p, wallNormal);
} }
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 operator()(uint32 n, const realx3& p)const realx3 operator()(uint32 n, const realx3& p, const realx3& wallNormal)const
{ {
return pointVelocity(n,p); return pointVelocity(n, p, wallNormal);
} }
INLINE_FUNCTION_HD INLINE_FUNCTION_HD

View File

@ -28,7 +28,7 @@ pFlow::conveyorBelt::conveyorBelt(const dictionary& dict)
if(!read(dict)) if(!read(dict))
{ {
fatalErrorInFunction<< fatalErrorInFunction<<
" error in reading conveyorBelt from dictionary "<< dict.globalName()<<endl; " error in reading from dictionary "<< dict.globalName()<<endl;
fatalExit; fatalExit;
} }
} }
@ -37,7 +37,21 @@ FUNCTION_H
bool pFlow::conveyorBelt::read(const dictionary& dict) bool pFlow::conveyorBelt::read(const dictionary& dict)
{ {
tangentVelocity_ = dict.getVal<realx3>("tangentVelocity"); linearVelocity_ = dict.getVal<real>("linearVelocity");
normal_ = dict.getVal<realx3>("normal");
if(normal_.length() > verySmallValue)
{
normal_.normalize();
}
else
{
fatalErrorInFunction<<
" normal vector in "<<
dict.globalName() <<
" cannot be zero vector "<<endl;
return false;
}
return true; return true;
} }
@ -45,12 +59,19 @@ bool pFlow::conveyorBelt::read(const dictionary& dict)
FUNCTION_H FUNCTION_H
bool pFlow::conveyorBelt::write(dictionary& dict) const bool pFlow::conveyorBelt::write(dictionary& dict) const
{ {
if( !dict.add("tangentVelocity", tangentVelocity_) ) if( !dict.add("linearVelocity", linearVelocity_) )
{ {
fatalErrorInFunction<< fatalErrorInFunction<<
" error in writing tangentVelocity to dictionary "<< dict.globalName()<<endl; " error in writing tangentVelocity to dictionary "<< dict.globalName()<<endl;
return false; return false;
} }
if(!dict.add("normal", normal_))
{
fatalErrorInFunction<<
" error in writing normal to dictionary "<< dict.globalName()<<endl;
return false;
}
return true; return true;
} }
@ -65,6 +86,7 @@ bool pFlow::conveyorBelt::read(iIstream& is)
FUNCTION_H FUNCTION_H
bool pFlow::conveyorBelt::write(iOstream& os)const bool pFlow::conveyorBelt::write(iOstream& os)const
{ {
os.writeWordEntry("tangentVelocity", tangentVelocity_); os.writeWordEntry("linearVelocity", linearVelocity_);
os.writeWordEntry("normal", normal_);
return true; return true;
} }

View File

@ -41,7 +41,12 @@ class conveyorBelt
{ {
private: private:
realx3 tangentVelocity_{0, 0, 0}; /// @brief linear velocity of the conveyor belt
real linearVelocity_{0};
/// normal vector of the velocity plane.
/// The velocity vector is tangent to this plane (velocity plane).
realx3 normal_{1,0,0};
public: public:
@ -63,10 +68,16 @@ public:
void setTime(real t) void setTime(real t)
{} {}
INLINE_FUNCTION_HD /*INLINE_FUNCTION_HD
realx3 linVelocityPoint(const realx3 &)const realx3 linVelocityPoint(const realx3 &)const
{ {
return tangentVelocity_; return tangentVelocity_;
}*/
INLINE_FUNCTION_HD
realx3 linVelocityPoint(const realx3 &, const realx3& wallNormal)const
{
return linearVelocity_ * cross(wallNormal, normal_);
} }
INLINE_FUNCTION_HD INLINE_FUNCTION_HD

View File

@ -120,7 +120,7 @@ public:
/// Tangential velocity at point p /// Tangential velocity at point p
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 pointTangentialVel(const realx3& p)const realx3 pointTangentialVel(const realx3& p, const realx3& wallNormal)const
{ {
realx3 parentVel(0); realx3 parentVel(0);
auto parIndex = parentAxisIndex(); auto parIndex = parentAxisIndex();
@ -128,11 +128,11 @@ public:
while(parIndex != -1) while(parIndex != -1)
{ {
auto& ax = axisList_[parIndex]; auto& ax = axisList_[parIndex];
parentVel += ax.linVelocityPoint(p); parentVel += ax.linVelocityPoint(p, wallNormal);
parIndex = ax.parentAxisIndex(); parIndex = ax.parentAxisIndex();
} }
return parentVel + rotatingAxis::linVelocityPoint(p); return parentVel + rotatingAxis::linVelocityPoint(p, wallNormal);
} }
/// Translate point p for dt seconds based on the axis information /// Translate point p for dt seconds based on the axis information

View File

@ -126,7 +126,7 @@ public:
/// Linear tangential velocity at point p /// Linear tangential velocity at point p
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 linVelocityPoint(const realx3 &p)const; realx3 linVelocityPoint(const realx3 &p, const realx3& wallNormal)const;
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 transferPoint(const realx3 p, real dt)const; realx3 transferPoint(const realx3 p, real dt)const;

View File

@ -20,7 +20,7 @@ Licence:
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
pFlow::realx3 pFlow::rotatingAxis::linVelocityPoint(const realx3 &p)const pFlow::realx3 pFlow::rotatingAxis::linVelocityPoint(const realx3 &p, const realx3&)const
{ {
if(!inTimeRange()) return {0,0,0}; if(!inTimeRange()) return {0,0,0};

View File

@ -60,7 +60,7 @@ public:
{} {}
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 linVelocityPoint(const realx3 &)const realx3 linVelocityPoint(const realx3 &, const realx3&)const
{ {
return realx3(0); return realx3(0);
} }

View File

@ -117,7 +117,7 @@ public:
} }
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3 linVelocityPoint(const realx3 &)const realx3 linVelocityPoint(const realx3 &, const realx3&)const
{ {
return velocity_; return velocity_;
} }

View File

@ -46,6 +46,9 @@ private:
deviceViewType1D<realx3> dPoints_; deviceViewType1D<realx3> dPoints_;
deviceViewType1D<uint32x3> dVectices_; deviceViewType1D<uint32x3> dVectices_;
deviceViewType1D<realx3> dNormals_;
public: public:
INLINE_FUNCTION_H INLINE_FUNCTION_H
@ -53,12 +56,14 @@ public:
uint32 numPoints, uint32 numPoints,
deviceViewType1D<realx3> points, deviceViewType1D<realx3> points,
uint32 numTrianlges, uint32 numTrianlges,
deviceViewType1D<uint32x3> vertices ) deviceViewType1D<uint32x3> vertices,
deviceViewType1D<realx3> normals )
: :
numPoints_(numPoints), numPoints_(numPoints),
numTriangles_(numTrianlges), numTriangles_(numTrianlges),
dPoints_(points), dPoints_(points),
dVectices_(vertices) dVectices_(vertices),
dNormals_(normals)
{} {}
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
@ -91,11 +96,17 @@ public:
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
realx3x3 operator[](uint32 i)const { return triangle(i); } realx3x3 operator[](uint32 i)const { return triangle(i); }
INLINE_FUNCTION_HD
const realx3& normal(uint32 i)const
{
return dNormals_[i];
}
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
uint32 numPoints()const { return numPoints_; } uint32 numPoints()const { return numPoints_; }
INLINE_FUNCTION_HD INLINE_FUNCTION_HD
uint32 numTrianlges()const { return numTriangles_;} uint32 numTriangles()const { return numTriangles_;}
}; };
@ -224,7 +235,8 @@ public:
points_.size(), points_.size(),
points_.deviceViewAll(), points_.deviceViewAll(),
vertices_.size(), vertices_.size(),
vertices_.deviceViewAll()); vertices_.deviceViewAll(),
normals_.deviceViewAll() );
} }
//// - IO operations //// - IO operations

View File

@ -7,14 +7,18 @@ objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
// motion model can be rotatingAxis or stationary or vibrating
motionModel conveyorBelt; motionModel conveyorBelt;
conveyorBeltInfo conveyorBeltInfo
{ {
conveyorBelt1 conveyorBelt1
{ {
tangentVelocity (0.5 0 0); // linear velocity of belt
linearVelocity 0.5;
// normal vector of velocity plate
// The velocity vector is tangent to this plane
normal (0 -1 0);
} }
} }

View File

@ -34,7 +34,7 @@ writeFormat ascii; // data writting format (ascii
timersReport Yes; // report timers timersReport Yes; // report timers
timersReportInterval 0.01; // time interval for reporting timers timersReportInterval 0.1; // time interval for reporting timers

View File

@ -38,7 +38,7 @@ surfaces
type stlWall; // type of the wall type stlWall; // type of the wall
file shell.stl; // file name in stl folder file shell.stl; // file name in stl folder
material prop1; // material name of this wall material prop1; // material name of this wall
motion none; // this surface is not moving ==> none motion none; // this surface is not movng ==> none
} }
} }