Merge pull request #62 from PhasicFlow/vibratingWall
vibrating wall added, tested; time interval for wall motion added, te…
This commit is contained in:
commit
d3ba896f73
|
@ -23,9 +23,10 @@ bool pFlow::geometryMotion<MotionModel>::moveGeometry()
|
||||||
{
|
{
|
||||||
|
|
||||||
real dt = this->dt();
|
real dt = this->dt();
|
||||||
|
real t = this->currentTime();
|
||||||
|
|
||||||
auto pointMIndex= pointMotionIndex_.deviceVector();
|
auto pointMIndex= pointMotionIndex_.deviceVector();
|
||||||
auto mModel = motionModel_.getModel();
|
auto mModel = motionModel_.getModel(t);
|
||||||
realx3* points = triSurface_.pointsData_D();
|
realx3* points = triSurface_.pointsData_D();
|
||||||
auto numPoints = triSurface_.numPoints();
|
auto numPoints = triSurface_.numPoints();
|
||||||
|
|
||||||
|
|
|
@ -104,9 +104,9 @@ public:
|
||||||
|
|
||||||
//// - Methods
|
//// - Methods
|
||||||
|
|
||||||
auto getModel()const
|
auto getModel(real t)const
|
||||||
{
|
{
|
||||||
return motionModel_.getModel();
|
return motionModel_.getModel(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
word motionModelTypeName()const override
|
word motionModelTypeName()const override
|
||||||
|
|
|
@ -24,11 +24,14 @@ Licence:
|
||||||
#include "geometryMotion.hpp"
|
#include "geometryMotion.hpp"
|
||||||
#include "fixedWall.hpp"
|
#include "fixedWall.hpp"
|
||||||
#include "rotatingAxisMotion.hpp"
|
#include "rotatingAxisMotion.hpp"
|
||||||
|
#include "vibratingMotion.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
typedef geometryMotion<vibratingMotion> vibratingMotionGeometry;
|
||||||
|
|
||||||
typedef geometryMotion<rotatingAxisMotion> rotationAxisMotionGeometry;
|
typedef geometryMotion<rotatingAxisMotion> rotationAxisMotionGeometry;
|
||||||
|
|
||||||
typedef geometryMotion<fixedWall> fixedGeometry;
|
typedef geometryMotion<fixedWall> fixedGeometry;
|
||||||
|
|
|
@ -20,9 +20,12 @@ Licence:
|
||||||
|
|
||||||
#include "fixedWall.hpp"
|
#include "fixedWall.hpp"
|
||||||
#include "rotatingAxisMotion.hpp"
|
#include "rotatingAxisMotion.hpp"
|
||||||
|
#include "vibratingMotion.hpp"
|
||||||
|
|
||||||
template class pFlow::geometryMotion<pFlow::fixedWall>;
|
template class pFlow::geometryMotion<pFlow::fixedWall>;
|
||||||
|
|
||||||
template class pFlow::geometryMotion<pFlow::rotatingAxisMotion>;
|
template class pFlow::geometryMotion<pFlow::rotatingAxisMotion>;
|
||||||
|
|
||||||
|
template class pFlow::geometryMotion<pFlow::vibratingMotion>;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ bool pFlow::sphereInteraction<contactForceModel,geometryMotionModel, contactList
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
auto lastItem = ppContactList_().loopCount();
|
auto lastItem = ppContactList_().loopCount();
|
||||||
|
|
||||||
// create the kernel functor
|
// create the kernel functor
|
||||||
|
@ -95,6 +96,7 @@ bool pFlow::sphereInteraction<contactForceModel,geometryMotionModel, contactList
|
||||||
{
|
{
|
||||||
|
|
||||||
int32 lastItem = pwContactList_().loopCount();
|
int32 lastItem = pwContactList_().loopCount();
|
||||||
|
real t = this->currentTime();
|
||||||
|
|
||||||
pFlow::sphereInteractionKernels::pwInteractionFunctor
|
pFlow::sphereInteractionKernels::pwInteractionFunctor
|
||||||
pwInteraction(
|
pwInteraction(
|
||||||
|
@ -102,7 +104,7 @@ bool pFlow::sphereInteraction<contactForceModel,geometryMotionModel, contactList
|
||||||
this->forceModel_(),
|
this->forceModel_(),
|
||||||
pwContactList_(),
|
pwContactList_(),
|
||||||
geometryMotion_.getTriangleAccessor(),
|
geometryMotion_.getTriangleAccessor(),
|
||||||
geometryMotion_.getModel() ,
|
geometryMotion_.getModel(t) ,
|
||||||
sphParticles_.diameter().deviceVectorAll() ,
|
sphParticles_.diameter().deviceVectorAll() ,
|
||||||
sphParticles_.propertyId().deviceVectorAll(),
|
sphParticles_.propertyId().deviceVectorAll(),
|
||||||
sphParticles_.pointPosition().deviceVectorAll(),
|
sphParticles_.pointPosition().deviceVectorAll(),
|
||||||
|
|
|
@ -67,6 +67,27 @@ template class pFlow::sphereInteraction<
|
||||||
pFlow::sortedContactList>;
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::limitedLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::unsortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::limitedLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::nonLimitedLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::unsortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::nonLimitedLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// non-linear models
|
/// non-linear models
|
||||||
|
|
||||||
|
@ -111,6 +132,28 @@ template class pFlow::sphereInteraction<
|
||||||
pFlow::sortedContactList>;
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::limitedNonLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::unsortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::limitedNonLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::unsortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - nonLinearMod models
|
// - nonLinearMod models
|
||||||
template class pFlow::sphereInteraction<
|
template class pFlow::sphereInteraction<
|
||||||
pFlow::cfModels::limitedNonLinearModNormalRolling,
|
pFlow::cfModels::limitedNonLinearModNormalRolling,
|
||||||
|
@ -153,5 +196,26 @@ template class pFlow::sphereInteraction<
|
||||||
pFlow::sortedContactList>;
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::limitedNonLinearModNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::unsortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::limitedNonLinearModNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::unsortedContactList>;
|
||||||
|
|
||||||
|
template class pFlow::sphereInteraction<
|
||||||
|
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
|
||||||
|
pFlow::vibratingMotionGeometry,
|
||||||
|
pFlow::sortedContactList>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
|
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
entities/rotatingAxis/rotatingAxis.cpp
|
entities/rotatingAxis/rotatingAxis.cpp
|
||||||
|
entities/timeInterval/timeInterval.cpp
|
||||||
|
entities/vibrating/vibrating.cpp
|
||||||
fixedWall/fixedWall.cpp
|
fixedWall/fixedWall.cpp
|
||||||
rotatingAxisMotion/rotatingAxisMotion.cpp
|
rotatingAxisMotion/rotatingAxisMotion.cpp
|
||||||
|
vibratingMotion/vibratingMotion.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(link_libs Kokkos::kokkos phasicFlow)
|
set(link_libs Kokkos::kokkos phasicFlow)
|
||||||
|
|
|
@ -21,13 +21,6 @@ Licence:
|
||||||
#include "rotatingAxis.hpp"
|
#include "rotatingAxis.hpp"
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
/*FUNCTION_HD
|
|
||||||
pFlow::rotatingAxis::rotatingAxis()
|
|
||||||
:
|
|
||||||
line(),
|
|
||||||
omega_(0.0),
|
|
||||||
rotating_(false)
|
|
||||||
{}*/
|
|
||||||
|
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
pFlow::rotatingAxis::rotatingAxis
|
pFlow::rotatingAxis::rotatingAxis
|
||||||
|
@ -52,6 +45,7 @@ pFlow::rotatingAxis::rotatingAxis
|
||||||
real omega
|
real omega
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
timeInterval(),
|
||||||
line(p1, p2),
|
line(p1, p2),
|
||||||
omega_(omega),
|
omega_(omega),
|
||||||
rotating_(!equal(omega,0.0))
|
rotating_(!equal(omega,0.0))
|
||||||
|
@ -60,7 +54,6 @@ pFlow::rotatingAxis::rotatingAxis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//rotatingAxis(const dictionary& dict);
|
|
||||||
FUNCTION_HD
|
FUNCTION_HD
|
||||||
pFlow::real pFlow::rotatingAxis::setOmega(real omega)
|
pFlow::real pFlow::rotatingAxis::setOmega(real omega)
|
||||||
{
|
{
|
||||||
|
@ -76,6 +69,8 @@ bool pFlow::rotatingAxis::read
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!timeInterval::read(dict))return false;
|
||||||
if(!line::read(dict)) return false;
|
if(!line::read(dict)) return false;
|
||||||
|
|
||||||
real omega = dict.getValOrSet("omega", static_cast<real>(0.0));
|
real omega = dict.getValOrSet("omega", static_cast<real>(0.0));
|
||||||
|
@ -90,6 +85,7 @@ bool pFlow::rotatingAxis::write
|
||||||
dictionary& dict
|
dictionary& dict
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
if( !timeInterval::write(dict) ) return false;
|
||||||
if( !line::write(dict) ) return false;
|
if( !line::write(dict) ) return false;
|
||||||
|
|
||||||
if( !dict.add("omega", omega_) )
|
if( !dict.add("omega", omega_) )
|
||||||
|
@ -107,6 +103,7 @@ bool pFlow::rotatingAxis::read
|
||||||
iIstream& is
|
iIstream& is
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if( !rotatingAxis::timeInterval::read(is)) return false;
|
||||||
if( !rotatingAxis::line::read(is)) return false;
|
if( !rotatingAxis::line::read(is)) return false;
|
||||||
|
|
||||||
word omegaw;
|
word omegaw;
|
||||||
|
@ -137,6 +134,7 @@ bool pFlow::rotatingAxis::write
|
||||||
iOstream& os
|
iOstream& os
|
||||||
)const
|
)const
|
||||||
{
|
{
|
||||||
|
if( !rotatingAxis::timeInterval::write(os)) return false;
|
||||||
if( !rotatingAxis::line::write(os) ) return false;
|
if( !rotatingAxis::line::write(os) ) return false;
|
||||||
|
|
||||||
os.writeWordEntry("omega", omega());
|
os.writeWordEntry("omega", omega());
|
||||||
|
|
|
@ -21,6 +21,7 @@ Licence:
|
||||||
#ifndef __rotatingAxis_hpp__
|
#ifndef __rotatingAxis_hpp__
|
||||||
#define __rotatingAxis_hpp__
|
#define __rotatingAxis_hpp__
|
||||||
|
|
||||||
|
#include "timeInterval.hpp"
|
||||||
#include "line.hpp"
|
#include "line.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -33,6 +34,7 @@ class rotatingAxis;
|
||||||
|
|
||||||
class rotatingAxis
|
class rotatingAxis
|
||||||
:
|
:
|
||||||
|
public timeInterval,
|
||||||
public line
|
public line
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -21,6 +21,9 @@ Licence:
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
pFlow::realx3 pFlow::rotatingAxis::linTangentialVelocityPoint(const realx3 &p)const
|
pFlow::realx3 pFlow::rotatingAxis::linTangentialVelocityPoint(const realx3 &p)const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!inTimeRange()) return {0,0,0};
|
||||||
|
|
||||||
realx3 L = p - projectPoint(p);
|
realx3 L = p - projectPoint(p);
|
||||||
return cross(omega_*unitVector(),L);
|
return cross(omega_*unitVector(),L);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +31,9 @@ pFlow::realx3 pFlow::rotatingAxis::linTangentialVelocityPoint(const realx3 &p)co
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
pFlow::realx3 pFlow::rotate(const realx3& p, const rotatingAxis& ax, real dt)
|
pFlow::realx3 pFlow::rotate(const realx3& p, const rotatingAxis& ax, real dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!ax.inTimeRange()) return p;
|
||||||
|
|
||||||
realx3 nv = ax.unitVector();
|
realx3 nv = ax.unitVector();
|
||||||
real cos_tet = cos(ax.omega()*dt);
|
real cos_tet = cos(ax.omega()*dt);
|
||||||
real sin_tet = sin(ax.omega()*dt);
|
real sin_tet = sin(ax.omega()*dt);
|
||||||
|
@ -61,7 +67,6 @@ INLINE_FUNCTION_HD
|
||||||
pFlow::realx3 pFlow::rotate(const realx3 &p, const line& ln, real theta)
|
pFlow::realx3 pFlow::rotate(const realx3 &p, const line& ln, real theta)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
realx3 nv = ln.unitVector();
|
realx3 nv = ln.unitVector();
|
||||||
real cos_tet = cos(theta);
|
real cos_tet = cos(theta);
|
||||||
real sin_tet = sin(theta);
|
real sin_tet = sin(theta);
|
||||||
|
@ -130,6 +135,8 @@ void pFlow::rotate(realx3* p, size_t n, const line& ln, real theta)
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
void pFlow::rotate(realx3* p, size_t n, const rotatingAxis& ax, real dt)
|
void pFlow::rotate(realx3* p, size_t n, const rotatingAxis& ax, real dt)
|
||||||
{
|
{
|
||||||
|
if(!ax.inTimeRange()) return;
|
||||||
|
|
||||||
realx3 nv = ax.unitVector();
|
realx3 nv = ax.unitVector();
|
||||||
real cos_tet = cos(ax.omega()*dt);
|
real cos_tet = cos(ax.omega()*dt);
|
||||||
real sin_tet = sin(ax.omega()*dt);
|
real sin_tet = sin(ax.omega()*dt);
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
|
||||||
|
|
||||||
|
#include "timeInterval.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::timeInterval::timeInterval(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if(!read(dict))
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::timeInterval::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
startTime_ = dict.getValOrSet<real>("startTime", 0);
|
||||||
|
endTime_ = dict.getValOrSet<real>("endTime", largeValue);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::timeInterval::write(dictionary& dict) const
|
||||||
|
{
|
||||||
|
if( !dict.add("startTime", startTime_) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing startTime to dictionary "<< dict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !dict.add("endTime", endTime_) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing endTime to dictionary "<< dict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::timeInterval::read(iIstream& is)
|
||||||
|
{
|
||||||
|
word key;
|
||||||
|
real val;
|
||||||
|
|
||||||
|
is >> key >> val;
|
||||||
|
if(key != "startTime")
|
||||||
|
{
|
||||||
|
ioErrorInFile(is.name(), is.lineNumber())<<
|
||||||
|
" expected startTime but found "<< key <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
startTime_ = val;
|
||||||
|
|
||||||
|
is.readEndStatement(FUNCTION_NAME);
|
||||||
|
|
||||||
|
is >> key >> val;
|
||||||
|
if(key != "endTime")
|
||||||
|
{
|
||||||
|
ioErrorInFile(is.name(), is.lineNumber())<<
|
||||||
|
" expected endTime but found "<< key <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
endTime_ = val;
|
||||||
|
|
||||||
|
is.readEndStatement(FUNCTION_NAME);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::timeInterval::write(iOstream& os)const
|
||||||
|
{
|
||||||
|
os.writeWordEntry("startTime", startTime_);
|
||||||
|
os.writeWordEntry("endTime", endTime_);
|
||||||
|
return os.check(FUNCTION_NAME);
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __timeInterval_hpp__
|
||||||
|
#define __timeInterval_hpp__
|
||||||
|
|
||||||
|
#include "types.hpp"
|
||||||
|
#include "pFlowMacros.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
// forward
|
||||||
|
class dictionary;
|
||||||
|
|
||||||
|
|
||||||
|
class timeInterval
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
real startTime_ = 0;
|
||||||
|
|
||||||
|
real endTime_ = largeValue;
|
||||||
|
|
||||||
|
real time_=0;
|
||||||
|
|
||||||
|
bool isInInterval_ = true;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
timeInterval(){}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
timeInterval(const timeInterval&) = default;
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
timeInterval& operator=(const timeInterval&) = default;
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
timeInterval(const dictionary& dict);
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
~timeInterval() = default;
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
auto startTime()const
|
||||||
|
{
|
||||||
|
return startTime_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
auto endTime()const
|
||||||
|
{
|
||||||
|
return endTime_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
auto time()const
|
||||||
|
{
|
||||||
|
return time_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
void setTime(real t)
|
||||||
|
{
|
||||||
|
isInInterval_ = inTimeRange(t);
|
||||||
|
time_ = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool inTimeRange(real t)const
|
||||||
|
{
|
||||||
|
return t>= startTime_ && t<= endTime_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool inTimeRange()const
|
||||||
|
{
|
||||||
|
return isInInterval_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - IO operation
|
||||||
|
FUNCTION_H
|
||||||
|
bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool write(dictionary& dict) const;
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool read(iIstream& is);
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool write(iOstream& os)const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline iOstream& operator <<(iOstream& os, const timeInterval& obj)
|
||||||
|
{
|
||||||
|
if(!obj.write(os))
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline iIstream& operator >>(iIstream& is, timeInterval& obj)
|
||||||
|
{
|
||||||
|
if( !obj.read(is) )
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vibrating.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::vibrating::vibrating(const dictionary& dict)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!read(dict))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in reading vibrating from dictionary "<< dict.globalName()<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::vibrating::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!timeInterval::read(dict))return false;
|
||||||
|
|
||||||
|
angularFreq_ = dict.getVal<realx3>("angularFreq");
|
||||||
|
|
||||||
|
phaseAngle_ = dict.getValOrSet<realx3>("phaseAngle", realx3(0));
|
||||||
|
|
||||||
|
amplitude_ = dict.getVal<realx3>("amplitude");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::vibrating::write(dictionary& dict) const
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!timeInterval::write(dict)) return false;
|
||||||
|
|
||||||
|
if( !dict.add("angularFreq", angularFreq_) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing angularFreq to dictionary "<< dict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !dict.add("phaseAngle", phaseAngle_) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing phaseAngle to dictionary "<< dict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !dict.add("amplitude", amplitude_) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing amplitude to dictionary "<< dict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::vibrating::read(iIstream& is)
|
||||||
|
{
|
||||||
|
|
||||||
|
notImplementedFunction;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::vibrating::write(iOstream& os)const
|
||||||
|
{
|
||||||
|
if(!timeInterval::write(os)) return false;
|
||||||
|
|
||||||
|
os.writeWordEntry("angularFreq", angularFreq_);
|
||||||
|
os.writeWordEntry("phaseAngle", phaseAngle_);
|
||||||
|
os.writeWordEntry("amplitude", amplitude_);
|
||||||
|
return os.check(FUNCTION_NAME);
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __vibrating_hpp__
|
||||||
|
#define __vibrating_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "timeInterval.hpp"
|
||||||
|
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class dictionary;
|
||||||
|
class vibrating;
|
||||||
|
|
||||||
|
|
||||||
|
class vibrating
|
||||||
|
:
|
||||||
|
public timeInterval
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// rotation speed
|
||||||
|
realx3 angularFreq_{0,0,0};
|
||||||
|
|
||||||
|
realx3 phaseAngle_{0,0,0};
|
||||||
|
|
||||||
|
realx3 amplitude_{0,0,0};
|
||||||
|
|
||||||
|
realx3 velocity_{0,0,0};
|
||||||
|
|
||||||
|
realx3 velocity0_{0,0,0};
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
void calculateVelocity()
|
||||||
|
{
|
||||||
|
if(inTimeRange())
|
||||||
|
{
|
||||||
|
velocity_ = amplitude_ * sin( angularFreq_*(time()-startTime() ) + phaseAngle_ );
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
velocity_ = {0,0,0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
FUNCTION_HD
|
||||||
|
vibrating(){}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
vibrating(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_HD
|
||||||
|
vibrating(const vibrating&) = default;
|
||||||
|
|
||||||
|
vibrating& operator=(const vibrating&) = default;
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
void setTime(real t)
|
||||||
|
{
|
||||||
|
if( !equal(t, time()) ) velocity0_ = velocity_;
|
||||||
|
timeInterval::setTime(t);
|
||||||
|
calculateVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 linTangentialVelocityPoint(const realx3 &p)const
|
||||||
|
{
|
||||||
|
return velocity_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 transferPoint(const realx3& p, real dt)
|
||||||
|
{
|
||||||
|
if(!inTimeRange()) return p;
|
||||||
|
return p + 0.5*dt*(velocity0_+velocity_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - IO operation
|
||||||
|
FUNCTION_H
|
||||||
|
bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool write(dictionary& dict) const;
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool read(iIstream& is);
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool write(iOstream& os)const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
inline iOstream& operator <<(iOstream& os, const vibrating& obj)
|
||||||
|
{
|
||||||
|
if(!obj.write(os))
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline iIstream& operator >>(iIstream& is, vibrating& obj)
|
||||||
|
{
|
||||||
|
if( !obj.read(is) )
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -107,7 +107,7 @@ public:
|
||||||
|
|
||||||
~fixedWall() = default;
|
~fixedWall() = default;
|
||||||
|
|
||||||
Model getModel()const
|
Model getModel(real t)const
|
||||||
{
|
{
|
||||||
return Model();
|
return Model();
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,8 +129,15 @@ public:
|
||||||
~rotatingAxisMotion() = default;
|
~rotatingAxisMotion() = default;
|
||||||
|
|
||||||
|
|
||||||
Model getModel()const
|
Model getModel(real t)
|
||||||
{
|
{
|
||||||
|
for(int32 i= 0; i<numAxis_; i++ )
|
||||||
|
{
|
||||||
|
axis_[i].setTime(t);
|
||||||
|
}
|
||||||
|
axis_.modifyOnHost();
|
||||||
|
axis_.syncViews();
|
||||||
|
|
||||||
return Model(axis_.deviceVector(), numAxis_);
|
return Model(axis_.deviceVector(), numAxis_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,15 +174,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INLINE_FUNCTION_D
|
/*INLINE_FUNCTION_D
|
||||||
realx3 pointVelocity(label n, const realx3& p)const
|
realx3 pointVelocity(label n, const realx3& p)const
|
||||||
{
|
{
|
||||||
return axis_.deviceVectorAll()[n].linTangentialVelocityPoint(p);
|
return axis_.deviceVectorAll()[n].linTangentialVelocityPoint(p);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INLINE_FUNCTION_D
|
/*INLINE_FUNCTION_D
|
||||||
realx3 transferPoint(label n, const realx3 p, real dt)const
|
realx3 transferPoint(label n, const realx3 p, real dt)const
|
||||||
{
|
{
|
||||||
return rotate(p, axis_.deviceVectorAll()[n], dt);
|
return rotate(p, axis_.deviceVectorAll()[n], dt);
|
||||||
|
@ -190,7 +197,7 @@ public:
|
||||||
rotate( pVec, numP, axis_.deviceVectorAll()[n], dt);
|
rotate( pVec, numP, axis_.deviceVectorAll()[n], dt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isMoving()const
|
bool isMoving()const
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vibratingMotion.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
bool pFlow::vibratingMotion::readDictionary
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto motionModel = dict.getVal<word>("motionModel");
|
||||||
|
|
||||||
|
if(motionModel != "vibratingMotion")
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" motionModel should be vibratingMotion, but found "
|
||||||
|
<< motionModel <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& motionInfo = dict.subDict("vibratingMotionInfo");
|
||||||
|
auto compNames = motionInfo.dictionaryKeywords();
|
||||||
|
|
||||||
|
components_.reserve(compNames.size()+1);
|
||||||
|
|
||||||
|
|
||||||
|
components_.clear();
|
||||||
|
componentName_.clear();
|
||||||
|
|
||||||
|
|
||||||
|
for(auto& cName: compNames)
|
||||||
|
{
|
||||||
|
auto& compDict = motionInfo.subDict(cName);
|
||||||
|
|
||||||
|
if(auto compPtr = makeUnique<vibrating>(compDict); compPtr)
|
||||||
|
{
|
||||||
|
components_.push_back(compPtr());
|
||||||
|
componentName_.push_back(cName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"could not read vibrating motion from "<< compDict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if( !componentName_.search("none") )
|
||||||
|
{
|
||||||
|
components_.push_back
|
||||||
|
(
|
||||||
|
vibrating()
|
||||||
|
);
|
||||||
|
componentName_.push_back("none");
|
||||||
|
}
|
||||||
|
|
||||||
|
components_.syncViews();
|
||||||
|
numComponents_ = components_.size();
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::vibratingMotion::writeDictionary
|
||||||
|
(
|
||||||
|
dictionary& dict
|
||||||
|
)const
|
||||||
|
{
|
||||||
|
dict.add("motionModel", "vibratingMotion");
|
||||||
|
|
||||||
|
auto& motionInfo = dict.subDictOrCreate("vibratingMotionInfo");
|
||||||
|
|
||||||
|
ForAll(i, components_)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto& compDict = motionInfo.subDictOrCreate(componentName_[i]);
|
||||||
|
if( !components_.hostVectorAll()[i].write(compDict))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing motion compoonent "<< componentName_[i] << " to dicrionary "
|
||||||
|
<< motionInfo.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::vibratingMotion::vibratingMotion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
pFlow::vibratingMotion::vibratingMotion
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(! readDictionary(dict) )
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::vibratingMotion::read
|
||||||
|
(
|
||||||
|
iIstream& is
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// create an empty file dictionary
|
||||||
|
dictionary motionInfo(motionModelFile__, true);
|
||||||
|
|
||||||
|
// read dictionary from stream
|
||||||
|
if( !motionInfo.read(is) )
|
||||||
|
{
|
||||||
|
ioErrorInFile(is.name(), is.lineNumber()) <<
|
||||||
|
" error in reading dictionray " << motionModelFile__ <<" from file. \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !readDictionary(motionInfo) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::vibratingMotion::write
|
||||||
|
(
|
||||||
|
iOstream& os
|
||||||
|
)const
|
||||||
|
{
|
||||||
|
// create an empty file dictionary
|
||||||
|
dictionary motionInfo(motionModelFile__, true);
|
||||||
|
|
||||||
|
if( !writeDictionary(motionInfo))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !motionInfo.write(os) )
|
||||||
|
{
|
||||||
|
ioErrorInFile( os.name(), os.lineNumber() )<<
|
||||||
|
" error in writing dictionray to file. \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,216 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __vibratingMotion_hpp__
|
||||||
|
#define __vibratingMotion_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "types.hpp"
|
||||||
|
#include "typeInfo.hpp"
|
||||||
|
#include "VectorDual.hpp"
|
||||||
|
#include "Vectors.hpp"
|
||||||
|
#include "List.hpp"
|
||||||
|
#include "vibrating.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class dictionary;
|
||||||
|
|
||||||
|
class vibratingMotion
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// - this class shuold be decleared in every motion model with
|
||||||
|
// exact methods
|
||||||
|
class Model
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
deviceViewType1D<vibrating> components_;
|
||||||
|
int32 numComponents_=0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
Model(deviceViewType1D<vibrating> comps, int32 numComps):
|
||||||
|
components_(comps),
|
||||||
|
numComponents_(numComps)
|
||||||
|
{}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
Model(const Model&) = default;
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
Model& operator=(const Model&) = default;
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 pointVelocity(int32 n, const realx3& p)const
|
||||||
|
{
|
||||||
|
return components_[n].linTangentialVelocityPoint(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 operator()(int32 n, const realx3& p)const
|
||||||
|
{
|
||||||
|
return pointVelocity(n,p);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 transferPoint(int32 n, const realx3 p, real dt)const
|
||||||
|
{
|
||||||
|
return components_[n].transferPoint(p, dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD int32 numComponents()const
|
||||||
|
{
|
||||||
|
return numComponents_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
using axisVector_HD = VectorDual<vibrating>;
|
||||||
|
|
||||||
|
axisVector_HD components_;
|
||||||
|
|
||||||
|
wordList componentName_;
|
||||||
|
|
||||||
|
label numComponents_= 0;
|
||||||
|
|
||||||
|
bool readDictionary(const dictionary& dict);
|
||||||
|
|
||||||
|
bool writeDictionary(dictionary& dict)const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfoNV("vibratingMotion");
|
||||||
|
|
||||||
|
// empty
|
||||||
|
FUNCTION_H
|
||||||
|
vibratingMotion();
|
||||||
|
|
||||||
|
// construct with dictionary
|
||||||
|
FUNCTION_H
|
||||||
|
vibratingMotion(const dictionary& dict);
|
||||||
|
|
||||||
|
// copy
|
||||||
|
FUNCTION_H
|
||||||
|
vibratingMotion(const vibratingMotion&) = default;
|
||||||
|
|
||||||
|
vibratingMotion(vibratingMotion&&) = delete;
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
vibratingMotion& operator=(const vibratingMotion&) = default;
|
||||||
|
|
||||||
|
vibratingMotion& operator=(vibratingMotion&&) = delete;
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
~vibratingMotion() = default;
|
||||||
|
|
||||||
|
|
||||||
|
Model getModel(real t)
|
||||||
|
{
|
||||||
|
for(int32 i= 0; i<numComponents_; i++ )
|
||||||
|
{
|
||||||
|
components_[i].setTime(t);
|
||||||
|
}
|
||||||
|
components_.modifyOnHost();
|
||||||
|
components_.syncViews();
|
||||||
|
|
||||||
|
return Model(components_.deviceVectorAll(), numComponents_);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
int32 nameToIndex(const word& name)const
|
||||||
|
{
|
||||||
|
if( auto i = componentName_.findi(name); i == -1)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"component name " << name << " does not exist. \n";
|
||||||
|
fatalExit;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
word indexToName(label i)const
|
||||||
|
{
|
||||||
|
if(i < numComponents_ )
|
||||||
|
return componentName_[i];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"out of range access to the list of axes " << i <<endl<<
|
||||||
|
" size of components_ is "<<numComponents_<<endl;
|
||||||
|
fatalExit;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
realx3 pointVelocity(label n, const realx3& p)const
|
||||||
|
{
|
||||||
|
return components_.hostVectorAll()[n].linTangentialVelocityPoint(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
realx3 transferPoint(label n, const realx3 p, real dt)const
|
||||||
|
{
|
||||||
|
return components_.hostVectorAll()[n].transferPoint(p, dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool isMoving()const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
bool move(real dt)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool read(iIstream& is);
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool write(iOstream& os)const;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // pFlow
|
||||||
|
|
||||||
|
#endif //__rotatingAxisMotion_hpp__
|
|
@ -64,11 +64,18 @@ public:
|
||||||
return control_;
|
return control_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
real dt()const
|
real dt()const
|
||||||
{
|
{
|
||||||
return control_.time().dt();
|
return control_.time().dt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
real currentTime()const
|
||||||
|
{
|
||||||
|
return control_.time().currentTime();
|
||||||
|
}
|
||||||
|
|
||||||
auto& timers(){
|
auto& timers(){
|
||||||
return timers_;
|
return timers_;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue