# PhasicFlow: src/MotionModel/entities/vibrating/vibrating.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

vibrating.hpp
Go to the documentation of this file.
/*------------------------------- 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
{
// forward
class dictionary;
class vibrating
:
public timeInterval
{
private:
// 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:
TypeInfoNV("vibrating");
FUNCTION_HD
vibrating()=default;
FUNCTION_H
explicit 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 linVelocityPoint(const realx3 &)const
{
return velocity_;
}
INLINE_FUNCTION_HD
realx3 transferPoint(const realx3& p, real dt)const
{
if(!inTimeRange()) return p;
return p + static_cast< real >(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
timeInterval.hpp
pFlow::real
float real
Definition: builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::vibrating::angularFreq_
realx3 angularFreq_
Definition: vibrating.hpp:73
pFlow::vibrating
Vibrating model for a wall.
Definition: vibrating.hpp:65
pFlow::vibrating::velocity0_
realx3 velocity0_
Definition: vibrating.hpp:81
pFlow::timeInterval::startTime
INLINE_FUNCTION_HD auto startTime() const
Definition: timeInterval.hpp:45
pFlow::equal
INLINE_FUNCTION_HD bool equal(const box &b1, const box &b2, real tol=smallValue)
Definition: box.hpp:135
pFlow::vibrating::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(const realx3 &p, real dt) const
Definition: vibrating.hpp:126
pFlow::vibrating::calculateVelocity
INLINE_FUNCTION_HD void calculateVelocity()
Definition: vibrating.hpp:84
pFlow::vibrating::operator=
vibrating & operator=(const vibrating &)=default
pFlow
Definition: demGeometry.hpp:27
pFlow::vibrating::velocity_
realx3 velocity_
Definition: vibrating.hpp:79
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:62
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::timeInterval::time
INLINE_FUNCTION_HD auto time() const
Definition: timeInterval.hpp:57
pFlow::vibrating::phaseAngle_
realx3 phaseAngle_
Definition: vibrating.hpp:75
pFlow::vibrating::read
FUNCTION_H bool read(const dictionary &dict)
Definition: vibrating.cpp:40
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::timeInterval::inTimeRange
INLINE_FUNCTION_HD bool inTimeRange() const
Definition: timeInterval.hpp:76
pFlow::timeInterval
Definition: timeInterval.hpp:16
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
FUNCTION_HD
#define FUNCTION_HD
Definition: pFlowMacros.hpp:61
streams.hpp
pFlow::vibrating::linVelocityPoint
INLINE_FUNCTION_HD realx3 linVelocityPoint(const realx3 &) const
Definition: vibrating.hpp:120
pFlow::vibrating::write
FUNCTION_H bool write(dictionary &dict) const
Definition: vibrating.cpp:55
pFlow::vibrating::setTime
INLINE_FUNCTION_HD void setTime(real t)
Definition: vibrating.hpp:112
pFlow::sin
Vector< T, Allocator > sin(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:92
pFlow::vibrating::TypeInfoNV
TypeInfoNV("vibrating")
pFlow::vibrating::vibrating
FUNCTION_HD vibrating()=default
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::triple< real >
pFlow::timeInterval::setTime
INLINE_FUNCTION_HD void setTime(real t)
Definition: timeInterval.hpp:63
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67
pFlow::vibrating::amplitude_
realx3 amplitude_
Definition: vibrating.hpp:77