Merge branch 'main' into documentation

This commit is contained in:
Hamidreza Norouzi 2023-04-02 09:20:34 -07:00
commit 1ead684e8b
8 changed files with 579 additions and 364 deletions

View File

@ -1554,7 +1554,7 @@ FORMULA_MACROFILE =
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
USE_MATHJAX = NO
USE_MATHJAX = YES
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:

View File

@ -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;
}*/
}

View File

@ -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

View File

@ -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

View File

@ -34,12 +34,26 @@ namespace pFlow
class dictionary;
/**
* Fixed wall motion model for walls
*
* This class is used for geometries that are fixed during simulation.
*
*
\verbatim
// In geometryDict file, this will defines fixed walls during simulation
...
motionModel fixedWall;
...
\endverbatim
*/
class fixedWall
{
public:
// - this class shuold be decleared in every motion model with
// exact methods
/** Motion model class to be passed to computational units/kernels for
* transfing points and returning velocities at various positions
*/
class Model
{
@ -80,89 +94,111 @@ public:
};
protected:
/// Name
const word name_ = "none";
/// Read from a dictionary
bool readDictionary(const dictionary& dict);
/// write to a dictionary
bool writeDictionary(dictionary& dict)const;
public:
/// Type info
TypeInfoNV("fixedWall");
// empty
fixedWall();
// - Constructors
// construct with dictionary
fixedWall(const dictionary& dict);
/// Empty
fixedWall();
fixedWall(const fixedWall&) = default;
/// Constructor with dictionary
fixedWall(const dictionary& dict);
fixedWall(fixedWall&&) = default;
/// Copy constructor
fixedWall(const fixedWall&) = default;
fixedWall& operator=(const fixedWall&) = default;
/// Move constructor
fixedWall(fixedWall&&) = default;
fixedWall& operator=(fixedWall&&) = default;
/// Copy assignment
fixedWall& operator=(const fixedWall&) = default;
~fixedWall() = default;
/// Move assignment
fixedWall& operator=(fixedWall&&) = default;
Model getModel(real t)const
{
return Model();
}
/// Destructor
~fixedWall() = default;
int32 nameToIndex(const word& name)const
{
return 0;
}
// - Methods
word indexToName(label i)const
{
return name_;
}
/// Return motion model
/// t is the current simulation time
Model getModel(real t)const
{
return Model();
}
INLINE_FUNCTION_HD
realx3 pointVelocity(label n, const realx3& p)const
{
return zero3;
}
/// Name of the motion component to index
int32 nameToIndex(const word& name)const
{
return 0;
}
/// Index of motion component to name
word indexToName(label i)const
{
return name_;
}
INLINE_FUNCTION_HD
realx3 transferPoint(label n, const realx3 p, real dt)const
{
return p;
}
/// Velocity at point p
INLINE_FUNCTION_HD
realx3 pointVelocity(label n, const realx3& p)const
{
return zero3;
}
/// Transfer point p for dt seconds according to motion component n
INLINE_FUNCTION_HD
realx3 transferPoint(label n, const realx3 p, real dt)const
{
return p;
}
INLINE_FUNCTION_HD
bool transferPoint(label n, realx3* pVec, size_t numP, real dt)
{
return true;
}
/// Transfer a vector of point pVec for dt seconds according to motion
/// component n
INLINE_FUNCTION_HD
bool transferPoint(label n, realx3* pVec, size_t numP, real dt)
{
return true;
}
INLINE_FUNCTION_HD
bool isMoving()const
{
return false;
}
/// Are walls moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return false;
}
bool move(real t, real dt)
{
return true;
}
/// Move points
bool move(real t, real dt)
{
return true;
}
FUNCTION_H
bool read(iIstream& is);
// - IO operations
FUNCTION_H
bool write(iOstream& os)const;
/// Read from input stream is
FUNCTION_H
bool read(iIstream& is);
/// Write to output stream os
FUNCTION_H
bool write(iOstream& os)const;
};
} // pFlow

View File

@ -32,14 +32,43 @@ Licence:
namespace pFlow
{
// forward
class dictionary;
/**
* Rotating axis motion model for walls
*
* This class is used for simulaiton that at least one wall components
* is moving according to multiRotatingAxis motion mode. One or more than one
* motion components can be defined in multiRotatingAxisMotionInfo dictionary
*
\verbatim
// In geometryDict file, this will defines multi-rotating walls during simulation
...
motionModel multiRotatingAxisMotion;
multiRotatingAxisMotionInfo
{
rotationAxis1
{
// the definition based on class multiRotatingAxis
}
rotatoinAxis2
{
// the definition based on calss multiRotatingAxis
}
}
...
\endverbatim
*
*/
class multiRotatingAxisMotion
{
public:
// - this class shuold be decleared in every motion model with
// exact methods
/** Motion model class to be passed to computational units/kernels for
* transfing points and returning velocities at various positions
*/
class Model
{
protected:
@ -91,121 +120,141 @@ protected:
using axisVector_HD = VectorDual<multiRotatingAxis>;
/// Vector of multiRotaingAxis axes
axisVector_HD axis_;
/// Sorted index based on number of parrents each axis ha
VectorDual<int32> sortedIndex_;
/// List of axes names
wordList axisName_;
/// Number of axes
label numAxis_= 0;
/// Read from a dictionary
bool readDictionary(const dictionary& dict);
/// Write to a dictionary
bool writeDictionary(dictionary& dict)const;
public:
/// Type info
TypeInfoNV("multiRotatingAxisMotion");
// empty
FUNCTION_H
multiRotatingAxisMotion();
// - Constructor
// construct with dictionary
FUNCTION_H
multiRotatingAxisMotion(const dictionary& dict);
/// Empty constructor
FUNCTION_H
multiRotatingAxisMotion();
// copy
FUNCTION_H
multiRotatingAxisMotion(const multiRotatingAxisMotion&) = default;
/// Construct with dictionary
FUNCTION_H
multiRotatingAxisMotion(const dictionary& dict);
multiRotatingAxisMotion(multiRotatingAxisMotion&&) = delete;
/// Copy constructor
FUNCTION_H
multiRotatingAxisMotion(const multiRotatingAxisMotion&) = default;
FUNCTION_H
multiRotatingAxisMotion& operator=(const multiRotatingAxisMotion&) = default;
/// No Move
multiRotatingAxisMotion(multiRotatingAxisMotion&&) = delete;
multiRotatingAxisMotion& operator=(multiRotatingAxisMotion&&) = delete;
/// Copy assignment
FUNCTION_H
multiRotatingAxisMotion& operator=(const multiRotatingAxisMotion&) = default;
FUNCTION_H
~multiRotatingAxisMotion() = default;
/// No move assignment
multiRotatingAxisMotion& operator=(multiRotatingAxisMotion&&) = delete;
/// Destructor
FUNCTION_H
~multiRotatingAxisMotion() = default;
Model getModel(real t)
{
for(int32 i= 0; i<numAxis_; i++ )
// - Methods
/// Retrun motion model at time t
Model getModel(real t)
{
axis_[i].setTime(t);
axis_[i].setAxisList(getAxisListPtrDevice());
for(int32 i= 0; i<numAxis_; i++ )
{
axis_[i].setTime(t);
axis_[i].setAxisList(getAxisListPtrDevice());
}
axis_.modifyOnHost();
axis_.syncViews();
return Model(axis_.deviceVector(), numAxis_);
}
axis_.modifyOnHost();
axis_.syncViews();
return Model(axis_.deviceVector(), numAxis_);
}
INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrHost()
{
return axis_.hostVectorAll().data();
}
INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrDevice()
{
return axis_.deviceVectorAll().data();
}
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
if( auto i = axisName_.findi(name); i == -1)
/// Pointer to axis list on host side
INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrHost()
{
fatalErrorInFunction<<
"axis name " << name << " does not exist. \n";
fatalExit;
return i;
return axis_.hostVectorAll().data();
}
else
/// Pointer to axis list on device
INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrDevice()
{
return i;
return axis_.deviceVectorAll().data();
}
/// Name of motion component to index
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
if( auto i = axisName_.findi(name); i == -1)
{
fatalErrorInFunction<<
"axis name " << name << " does not exist. \n";
fatalExit;
return i;
}
else
{
return i;
}
}
/// Index of motion component to component name
INLINE_FUNCTION_H
word indexToName(label i)const
{
if(i < numAxis_ )
return axisName_[i];
else
{
fatalErrorInFunction<<
"out of range access to the list of axes " << i <<endl<<
" size of axes_ is "<<numAxis_<<endl;
fatalExit;
return "";
}
}
/// Is moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
/// Move points
FUNCTION_H
bool move(real t, real dt);
}
// - IO operation
INLINE_FUNCTION_H
word indexToName(label i)const
{
if(i < numAxis_ )
return axisName_[i];
else
{
fatalErrorInFunction<<
"out of range access to the list of axes " << i <<endl<<
" size of axes_ is "<<numAxis_<<endl;
fatalExit;
return "";
}
}
/// Read from input stream is
FUNCTION_H
bool read(iIstream& is);
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
FUNCTION_H
bool move(real t, real dt);
FUNCTION_H
bool read(iIstream& is);
FUNCTION_H
bool write(iOstream& os)const;
/// Write to output stream os
FUNCTION_H
bool write(iOstream& os)const;
};

View File

@ -35,12 +35,40 @@ namespace pFlow
class dictionary;
/**
* Rotating axis motion model for walls
*
* This class is used for simulaiton that at least one wall components
* is moving according to rotatingAxis motion mode. One or more than one
* motion components can be defined in rotatingAxisMotionInfo dictionary
*
\verbatim
// In geometryDict file, this will defines rotating walls during simulation
...
motionModel rotatingAxisMotion;
rotatingAxisMotionInfo
{
rotationAxis1
{
// the definition based on class rotatingAxis
}
rotatoinAxis2
{
// the definition based on calss rotatingAxis
}
}
...
\endverbatim
*
*/
class rotatingAxisMotion
{
public:
// - this class shuold be decleared in every motion model with
// exact methods
/** Motion model class to be passed to computational units/kernels for
* transfing points and returning velocities at various positions
*/
class Model
{
protected:
@ -92,132 +120,126 @@ protected:
using axisVector_HD = VectorDual<rotatingAxis>;
/// Vector to store axes
axisVector_HD axis_;
/// Names of axes
wordList axisName_;
/// Number of axes components
label numAxis_= 0;
/// Read from dictionary
bool readDictionary(const dictionary& dict);
/// Write to dictionary
bool writeDictionary(dictionary& dict)const;
public:
/// Type info
TypeInfoNV("rotatingAxisMotion");
// empty
FUNCTION_H
rotatingAxisMotion();
// - Constructors
/// Empty
FUNCTION_H
rotatingAxisMotion();
// construct with dictionary
FUNCTION_H
rotatingAxisMotion(const dictionary& dict);
/// Construct with dictionary
FUNCTION_H
rotatingAxisMotion(const dictionary& dict);
// copy
FUNCTION_H
rotatingAxisMotion(const rotatingAxisMotion&) = default;
/// Copy constructor
FUNCTION_H
rotatingAxisMotion(const rotatingAxisMotion&) = default;
rotatingAxisMotion(rotatingAxisMotion&&) = delete;
/// No move constructor
rotatingAxisMotion(rotatingAxisMotion&&) = delete;
FUNCTION_H
rotatingAxisMotion& operator=(const rotatingAxisMotion&) = default;
/// Copy assignment
FUNCTION_H
rotatingAxisMotion& operator=(const rotatingAxisMotion&) = default;
rotatingAxisMotion& operator=(rotatingAxisMotion&&) = delete;
/// No move assignment
rotatingAxisMotion& operator=(rotatingAxisMotion&&) = delete;
FUNCTION_H
~rotatingAxisMotion() = default;
/// Destructor
FUNCTION_H
~rotatingAxisMotion() = default;
Model getModel(real t)
{
for(int32 i= 0; i<numAxis_; i++ )
// - Methods
/// Return the motion model at time t
Model getModel(real t)
{
axis_[i].setTime(t);
}
axis_.modifyOnHost();
axis_.syncViews();
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_);
}
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
if( auto i = axisName_.findi(name); i == -1)
/// Motion component name to index
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
fatalErrorInFunction<<
"axis name " << name << " does not exist. \n";
fatalExit;
return i;
if( auto i = axisName_.findi(name); i == -1)
{
fatalErrorInFunction<<
"axis name " << name << " does not exist. \n";
fatalExit;
return i;
}
else
{
return i;
}
}
else
/// Motion index to motion component name
INLINE_FUNCTION_H
word indexToName(label i)const
{
return i;
if(i < numAxis_ )
return axisName_[i];
else
{
fatalErrorInFunction<<
"out of range access to the list of axes " << i <<endl<<
" size of axes_ is "<<numAxis_<<endl;
fatalExit;
return "";
}
}
}
INLINE_FUNCTION_H
word indexToName(label i)const
{
if(i < numAxis_ )
return axisName_[i];
else
/// Are walls moving
INLINE_FUNCTION_HD
bool isMoving()const
{
fatalErrorInFunction<<
"out of range access to the list of axes " << i <<endl<<
" size of axes_ is "<<numAxis_<<endl;
fatalExit;
return "";
return true;
}
}
/*INLINE_FUNCTION_D
realx3 pointVelocity(label n, const realx3& p)const
{
return axis_.deviceVectorAll()[n].linTangentialVelocityPoint(p);
}*/
/// Move
INLINE_FUNCTION_H
bool move(real t, real dt)
{
return true;
}
// - IO operation
/// Read from input stream is
FUNCTION_H
bool read(iIstream& is);
/*INLINE_FUNCTION_D
realx3 transferPoint(label n, const realx3 p, real dt)const
{
return rotate(p, axis_.deviceVectorAll()[n], dt);
}
/// Write to output stream os
FUNCTION_H
bool write(iOstream& os)const;
INLINE_FUNCTION_D
bool transferPoint(label n, realx3* pVec, size_t numP, real dt)
{
if( n>=numAxis_)return false;
rotate( pVec, numP, axis_.deviceVectorAll()[n], dt);
return true;
}*/
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
INLINE_FUNCTION_H
bool move(real t, real dt)
{
return true;
}
FUNCTION_H
bool read(iIstream& is);
FUNCTION_H
bool write(iOstream& os)const;
};
} // pFlow

View File

@ -34,14 +34,44 @@ Licence:
namespace pFlow
{
// forward
class dictionary;
/**
* Vibrating motion model for walls
*
* This class is used for simulaiton that at least one wall components
* are moving according to a sinoidal viration defined in class vibrating.
* One or more than one motion components can be defined in
* vibratingMotionInfo dictionary
*
\verbatim
// In geometryDict file, this will defines vibrating walls during simulation
...
motionModel vibratingMotion;
vibratingMotionInfo
{
vibComponent1
{
// the definition based on class vibrating
}
vibComponent2
{
// the definition based on calss vibrating
}
}
...
\endverbatim
*
*/
class vibratingMotion
{
public:
// - this class shuold be decleared in every motion model with
// exact methods
/** Motion model class to be passed to computational units/kernels for
* transfing points and returning velocities at various positions
*/
class Model
{
protected:
@ -93,43 +123,53 @@ protected:
using axisVector_HD = VectorDual<vibrating>;
/// Vibrating motion components
axisVector_HD components_;
/// Names of components
wordList componentName_;
/// Number of components
label numComponents_= 0;
/// Read from a dictionary
bool readDictionary(const dictionary& dict);
/// Write to a dictionary
bool writeDictionary(dictionary& dict)const;
public:
/// Type info
TypeInfoNV("vibratingMotion");
// empty
/// Empty
FUNCTION_H
vibratingMotion();
// construct with dictionary
/// Construct with dictionary
FUNCTION_H
vibratingMotion(const dictionary& dict);
// copy
/// Copy constructor
FUNCTION_H
vibratingMotion(const vibratingMotion&) = default;
/// No move
vibratingMotion(vibratingMotion&&) = delete;
/// Copy assignment
FUNCTION_H
vibratingMotion& operator=(const vibratingMotion&) = default;
/// No Move assignment
vibratingMotion& operator=(vibratingMotion&&) = delete;
/// Destructor
FUNCTION_H
~vibratingMotion() = default;
/// Return motion model at time t
Model getModel(real t)
{
for(int32 i= 0; i<numComponents_; i++ )
@ -142,6 +182,7 @@ public:
return Model(components_.deviceVectorAll(), numComponents_);
}
/// Name to component index
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
@ -159,6 +200,7 @@ public:
}
/// Index to name
INLINE_FUNCTION_H
word indexToName(label i)const
{
@ -174,41 +216,42 @@ public:
}
}
/// velocity at point p according to motion component n
INLINE_FUNCTION_H
realx3 pointVelocity(label n, const realx3& p)const
{
return components_.hostVectorAll()[n].linTangentialVelocityPoint(p);
}
/// Transfer point p for dt seconds based on motion component n
INLINE_FUNCTION_H
realx3 transferPoint(label n, const realx3 p, real dt)const
{
return components_.hostVectorAll()[n].transferPoint(p, dt);
}
/// Is moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
/// Move ponits at time t for dt seconds
INLINE_FUNCTION_H
bool move(real t, real dt)
{
return true;
}
/// Read from input stream is
FUNCTION_H
bool read(iIstream& is);
/// Write to output stream os
FUNCTION_H
bool write(iOstream& os)const;
};
} // pFlow