mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
motion model docs are added
This commit is contained in:
@ -32,147 +32,183 @@ namespace pFlow
|
||||
class dictionary;
|
||||
class multiRotatingAxisMotion;
|
||||
|
||||
/**
|
||||
* Defines an axis of rotation that rotates around itself and rotates around
|
||||
* another axis.
|
||||
*
|
||||
* This axis rotates around itself and can have one axis of rotation, and that
|
||||
* axis of rotation can have another axis of rotatoin and so on.
|
||||
*
|
||||
*
|
||||
\verbatim
|
||||
// This creates an axis around x-axis. This axis rotates round itself at
|
||||
// 1.57 rad/s and at the same time rotates around rotating axis axisName.
|
||||
// axisName is separatly defined in the same dictionray.
|
||||
axis1
|
||||
{
|
||||
p1 (0 0 0);
|
||||
p2 (1 0 0);
|
||||
omega 1.57;
|
||||
rotationAxis axisName;
|
||||
startTime 1;
|
||||
endTime 5;
|
||||
}
|
||||
|
||||
axisName
|
||||
{
|
||||
p1 (0 0 0);
|
||||
p2 (0 1 1);
|
||||
omega 3.14;
|
||||
} \endverbatim
|
||||
*
|
||||
*
|
||||
* | Parameter | Type | Description | Optional [default value] |
|
||||
* |----| :---: | ---- | :---: |
|
||||
* | p1 | realx3 | begin point of axis | No |
|
||||
* | p2 | realx3 | end point of axis | No |
|
||||
* | omega | real | rotation speed (rad/s) | No |
|
||||
* | rotationAxis | word | the axis rotates around this axis | Yes [none] |
|
||||
* | startTime | real | start time of rotation (s) | Yes [0] |
|
||||
* | endTime | real | end time of rotation (s) | Yes [infinity] |
|
||||
*
|
||||
*/
|
||||
class multiRotatingAxis
|
||||
:
|
||||
public rotatingAxis
|
||||
{
|
||||
protected:
|
||||
|
||||
// this is either host/device pointer
|
||||
multiRotatingAxis* axisList_;
|
||||
/// This is either host/device pointer to all axes
|
||||
multiRotatingAxis* axisList_;
|
||||
|
||||
int32 parentAxisIndex_ = -1;
|
||||
/// Index of parent axis
|
||||
int32 parentAxisIndex_ = -1;
|
||||
|
||||
public:
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
multiRotatingAxis(){}
|
||||
// - Constructors
|
||||
|
||||
FUNCTION_H
|
||||
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
|
||||
/// Empty Constructor
|
||||
INLINE_FUNCTION_HD
|
||||
multiRotatingAxis(){}
|
||||
|
||||
FUNCTION_H
|
||||
multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
|
||||
|
||||
/*FUNCTION_HD
|
||||
multiRotatingAxis(const realx3& p1, const realx3& p2, real omega = 0.0);*/
|
||||
|
||||
FUNCTION_HD
|
||||
multiRotatingAxis(const multiRotatingAxis&) = default;
|
||||
/// Empty with list of axes
|
||||
FUNCTION_H
|
||||
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
|
||||
|
||||
FUNCTION_HD
|
||||
multiRotatingAxis& operator=(const multiRotatingAxis&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
realx3 pointTangentialVel(const realx3& p)const
|
||||
{
|
||||
realx3 parentVel(0);
|
||||
auto parIndex = parentAxisIndex();
|
||||
|
||||
while(parIndex != -1)
|
||||
{
|
||||
auto& ax = axisList_[parIndex];
|
||||
parentVel += ax.linTangentialVelocityPoint(p);
|
||||
parIndex = ax.parentAxisIndex();
|
||||
}
|
||||
|
||||
return parentVel + rotatingAxis::linTangentialVelocityPoint(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
realx3 transferPoint(const realx3& p, real dt)const
|
||||
{
|
||||
auto newP = p;
|
||||
|
||||
// rotation around this axis
|
||||
if(isRotating())
|
||||
{
|
||||
newP = pFlow::rotate(p, *this, dt);
|
||||
}
|
||||
|
||||
auto parIndex = parentAxisIndex_;
|
||||
while(parIndex != -1)
|
||||
{
|
||||
auto& ax = axisList_[parIndex];
|
||||
newP = pFlow::rotate(newP, ax, dt);
|
||||
parIndex = ax.parentAxisIndex();
|
||||
}
|
||||
|
||||
return newP;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool hasParrent()const
|
||||
{
|
||||
return parentAxisIndex_ > -1;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
int32 parentAxisIndex()const
|
||||
{
|
||||
return parentAxisIndex_;
|
||||
}
|
||||
|
||||
// this pointer is device pointer
|
||||
INLINE_FUNCTION_H
|
||||
void setAxisList(multiRotatingAxis* axisList)
|
||||
{
|
||||
axisList_ = axisList;
|
||||
}
|
||||
// it is assumed that the axis with deepest level
|
||||
// (with more parrents) is moved first and then
|
||||
// the axis with lower levels
|
||||
void move(real dt)
|
||||
{
|
||||
/// Construct from dictionary and list of axes
|
||||
FUNCTION_H
|
||||
multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
|
||||
|
||||
if( !hasParrent() ) return;
|
||||
|
||||
auto lp1 = point1();
|
||||
auto lp2 = point2();
|
||||
/// Copy constructor
|
||||
FUNCTION_HD
|
||||
multiRotatingAxis(const multiRotatingAxis&) = default;
|
||||
|
||||
lp1 = axisList_[parentAxisIndex()].transferPoint(lp1, dt);
|
||||
lp2 = axisList_[parentAxisIndex()].transferPoint(lp2, dt);
|
||||
/// Copy assignment
|
||||
FUNCTION_HD
|
||||
multiRotatingAxis& operator=(const multiRotatingAxis&) = default;
|
||||
|
||||
set(lp1, lp2);
|
||||
}
|
||||
/// Destructor
|
||||
~multiRotatingAxis() = default;
|
||||
|
||||
/// - Methods
|
||||
|
||||
/// Tangential velocity at point p
|
||||
INLINE_FUNCTION_HD
|
||||
realx3 pointTangentialVel(const realx3& p)const
|
||||
{
|
||||
realx3 parentVel(0);
|
||||
auto parIndex = parentAxisIndex();
|
||||
|
||||
while(parIndex != -1)
|
||||
{
|
||||
auto& ax = axisList_[parIndex];
|
||||
parentVel += ax.linTangentialVelocityPoint(p);
|
||||
parIndex = ax.parentAxisIndex();
|
||||
}
|
||||
|
||||
return parentVel + rotatingAxis::linTangentialVelocityPoint(p);
|
||||
}
|
||||
|
||||
/// Translate point p for dt seconds based on the axis information
|
||||
INLINE_FUNCTION_HD
|
||||
realx3 transferPoint(const realx3& p, real dt)const
|
||||
{
|
||||
auto newP = p;
|
||||
|
||||
// rotation around this axis
|
||||
if(isRotating())
|
||||
{
|
||||
newP = pFlow::rotate(p, *this, dt);
|
||||
}
|
||||
|
||||
auto parIndex = parentAxisIndex_;
|
||||
while(parIndex != -1)
|
||||
{
|
||||
auto& ax = axisList_[parIndex];
|
||||
newP = pFlow::rotate(newP, ax, dt);
|
||||
parIndex = ax.parentAxisIndex();
|
||||
}
|
||||
|
||||
return newP;
|
||||
}
|
||||
|
||||
/// Does this axis have a parent
|
||||
INLINE_FUNCTION_HD
|
||||
bool hasParent()const
|
||||
{
|
||||
return parentAxisIndex_ > -1;
|
||||
}
|
||||
|
||||
/// Return the index of parent axis
|
||||
INLINE_FUNCTION_HD
|
||||
int32 parentAxisIndex()const
|
||||
{
|
||||
return parentAxisIndex_;
|
||||
}
|
||||
|
||||
/// Set the pointer to the list of all axes.
|
||||
/// This pointer is device pointer
|
||||
INLINE_FUNCTION_H
|
||||
void setAxisList(multiRotatingAxis* axisList)
|
||||
{
|
||||
axisList_ = axisList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the end points of the axis
|
||||
*
|
||||
* This function moves the end points of this axis, if it has any parrents.
|
||||
* It is assumed that the axis with deepest level (with more parrents) is
|
||||
* moved first and then the axis with lower levels.
|
||||
*/
|
||||
void move(real dt)
|
||||
{
|
||||
|
||||
if( !hasParent() ) return;
|
||||
|
||||
auto lp1 = point1();
|
||||
auto lp2 = point2();
|
||||
|
||||
lp1 = axisList_[parentAxisIndex()].transferPoint(lp1, dt);
|
||||
lp2 = axisList_[parentAxisIndex()].transferPoint(lp2, dt);
|
||||
|
||||
set(lp1, lp2);
|
||||
}
|
||||
|
||||
|
||||
// - IO operation
|
||||
FUNCTION_H
|
||||
bool read(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
|
||||
|
||||
FUNCTION_H
|
||||
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
|
||||
/// Read from dictionary
|
||||
FUNCTION_H
|
||||
bool read(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
|
||||
|
||||
/*FUNCTION_H
|
||||
bool read(iIstream& is);
|
||||
|
||||
FUNCTION_H
|
||||
bool write(iOstream& os)const;*/
|
||||
/// Write to dictionary
|
||||
FUNCTION_H
|
||||
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
|
||||
|
||||
};
|
||||
|
||||
/*inline iOstream& operator <<(iOstream& os, const multiRotatingAxis& ax)
|
||||
{
|
||||
if(!ax.write(os))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
inline iIstream& operator >>(iIstream& is, multiRotatingAxis& ax)
|
||||
{
|
||||
if( !ax.read(is) )
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
return is;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -50,13 +50,13 @@ class rotatingAxis;
|
||||
endTime 5;
|
||||
} \endverbatim
|
||||
*
|
||||
* | parameter | value type | discription | optional (default) |
|
||||
* |----| ---- | ---- | ---- |
|
||||
* | Parameter | Type | Description | Optional [default value] |
|
||||
* |----| :---: | ---- | ---- |
|
||||
* | p1 | realx3 | begin point of axis | No |
|
||||
* | p2 | realx3 | end point of axis | No |
|
||||
* | omega | real | rotation speed (rad/s) | No |
|
||||
* | startTime | real | start time of rotation (s) | Yes (0) |
|
||||
* | endTime | real | end time of rotation (s) | Yes (infinity) |
|
||||
* | startTime | real | start time of rotation (s) | Yes [0] |
|
||||
* | endTime | real | end time of rotation (s) | Yes [infinity] |
|
||||
*
|
||||
*/
|
||||
class rotatingAxis
|
||||
|
@ -29,10 +29,39 @@ Licence:
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
// forward
|
||||
class dictionary;
|
||||
class vibrating;
|
||||
|
||||
|
||||
/**
|
||||
* Vibrating model for a wall
|
||||
*
|
||||
* Creates a sinoidal virating model for a wall. The viration is defined by
|
||||
* frequency, amplitude and phase angle.
|
||||
* \f[
|
||||
\vec{v}(t) = \vec{A} sin(\vec{\omega}(t-startTime)+\vec{\phi})
|
||||
\f]
|
||||
\verbatim
|
||||
// This creates sinoidal vibration on the wall in x-direction. The viration
|
||||
// starts at t = 0 s and ends at t = 10 s.
|
||||
{
|
||||
angularFreq (10 0 0);
|
||||
amplitude ( 1 0 0);
|
||||
phaseAngle ( 0 0 0);
|
||||
startTime 0;
|
||||
endTime 10;
|
||||
} \endverbatim
|
||||
*
|
||||
* *
|
||||
* | Parameter | Type | Description | Optional [default value] |
|
||||
* |----| :---: | ---- | :---: |
|
||||
* | angularFreq | realx3 | angular frequency of vibration (rad/s) | No |
|
||||
* | amplitude | realx3 | rotation speed (m/s) | No |
|
||||
* | phaseAngle | realx3 | phase angle (rad) | Yes [(0 0 0)] |
|
||||
* | startTime | real | start time of rotation (s) | Yes [0] |
|
||||
* | endTime | real | end time of rotation (s) | Yes [infinity] |
|
||||
*
|
||||
*/
|
||||
class vibrating
|
||||
:
|
||||
public timeInterval
|
||||
|
Reference in New Issue
Block a user