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. # The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES. # 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 # When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see: # the MathJax output. See the MathJax site (see:

View File

@ -32,147 +32,183 @@ namespace pFlow
class dictionary; class dictionary;
class multiRotatingAxisMotion; 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 class multiRotatingAxis
: :
public rotatingAxis public rotatingAxis
{ {
protected: protected:
// this is either host/device pointer /// This is either host/device pointer to all axes
multiRotatingAxis* axisList_; multiRotatingAxis* axisList_;
int32 parentAxisIndex_ = -1; /// Index of parent axis
int32 parentAxisIndex_ = -1;
public: public:
INLINE_FUNCTION_HD // - Constructors
multiRotatingAxis(){}
FUNCTION_H /// Empty Constructor
multiRotatingAxis(multiRotatingAxisMotion* axisMotion); INLINE_FUNCTION_HD
multiRotatingAxis(){}
FUNCTION_H /// Empty with list of axes
multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict); FUNCTION_H
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
/*FUNCTION_HD
multiRotatingAxis(const realx3& p1, const realx3& p2, real omega = 0.0);*/
FUNCTION_HD
multiRotatingAxis(const multiRotatingAxis&) = default;
FUNCTION_HD /// Construct from dictionary and list of axes
multiRotatingAxis& operator=(const multiRotatingAxis&) = default; FUNCTION_H
multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
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)
{
if( !hasParrent() ) return; /// Copy constructor
FUNCTION_HD
auto lp1 = point1(); multiRotatingAxis(const multiRotatingAxis&) = default;
auto lp2 = point2();
lp1 = axisList_[parentAxisIndex()].transferPoint(lp1, dt); /// Copy assignment
lp2 = axisList_[parentAxisIndex()].transferPoint(lp2, dt); 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 // - IO operation
FUNCTION_H
bool read(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
FUNCTION_H /// Read from dictionary
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const; FUNCTION_H
bool read(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
/*FUNCTION_H /// Write to dictionary
bool read(iIstream& is); FUNCTION_H
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
FUNCTION_H
bool write(iOstream& os)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; endTime 5;
} \endverbatim } \endverbatim
* *
* | parameter | value type | discription | optional (default) | * | Parameter | Type | Description | Optional [default value] |
* |----| ---- | ---- | ---- | * |----| :---: | ---- | ---- |
* | p1 | realx3 | begin point of axis | No | * | p1 | realx3 | begin point of axis | No |
* | p2 | realx3 | end point of axis | No | * | p2 | realx3 | end point of axis | No |
* | omega | real | rotation speed (rad/s) | No | * | omega | real | rotation speed (rad/s) | No |
* | startTime | real | start time of rotation (s) | Yes (0) | * | startTime | real | start time of rotation (s) | Yes [0] |
* | endTime | real | end time of rotation (s) | Yes (infinity) | * | endTime | real | end time of rotation (s) | Yes [infinity] |
* *
*/ */
class rotatingAxis class rotatingAxis

View File

@ -29,10 +29,39 @@ Licence:
namespace pFlow namespace pFlow
{ {
// forward
class dictionary; 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 class vibrating
: :
public timeInterval public timeInterval

View File

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

View File

@ -32,14 +32,43 @@ Licence:
namespace pFlow namespace pFlow
{ {
// forward
class dictionary; 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 class multiRotatingAxisMotion
{ {
public: public:
// - this class shuold be decleared in every motion model with /** Motion model class to be passed to computational units/kernels for
// exact methods * transfing points and returning velocities at various positions
*/
class Model class Model
{ {
protected: protected:
@ -91,121 +120,141 @@ protected:
using axisVector_HD = VectorDual<multiRotatingAxis>; using axisVector_HD = VectorDual<multiRotatingAxis>;
/// Vector of multiRotaingAxis axes
axisVector_HD axis_; axisVector_HD axis_;
/// Sorted index based on number of parrents each axis ha
VectorDual<int32> sortedIndex_; VectorDual<int32> sortedIndex_;
/// List of axes names
wordList axisName_; wordList axisName_;
/// Number of axes
label numAxis_= 0; label numAxis_= 0;
/// Read from a dictionary
bool readDictionary(const dictionary& dict); bool readDictionary(const dictionary& dict);
/// Write to a dictionary
bool writeDictionary(dictionary& dict)const; bool writeDictionary(dictionary& dict)const;
public: public:
/// Type info
TypeInfoNV("multiRotatingAxisMotion"); TypeInfoNV("multiRotatingAxisMotion");
// empty // - Constructor
FUNCTION_H
multiRotatingAxisMotion();
// construct with dictionary /// Empty constructor
FUNCTION_H FUNCTION_H
multiRotatingAxisMotion(const dictionary& dict); multiRotatingAxisMotion();
// copy /// Construct with dictionary
FUNCTION_H FUNCTION_H
multiRotatingAxisMotion(const multiRotatingAxisMotion&) = default; multiRotatingAxisMotion(const dictionary& dict);
multiRotatingAxisMotion(multiRotatingAxisMotion&&) = delete; /// Copy constructor
FUNCTION_H
multiRotatingAxisMotion(const multiRotatingAxisMotion&) = default;
FUNCTION_H /// No Move
multiRotatingAxisMotion& operator=(const multiRotatingAxisMotion&) = default; multiRotatingAxisMotion(multiRotatingAxisMotion&&) = delete;
multiRotatingAxisMotion& operator=(multiRotatingAxisMotion&&) = delete; /// Copy assignment
FUNCTION_H
multiRotatingAxisMotion& operator=(const multiRotatingAxisMotion&) = default;
FUNCTION_H /// No move assignment
~multiRotatingAxisMotion() = default; multiRotatingAxisMotion& operator=(multiRotatingAxisMotion&&) = delete;
/// Destructor
FUNCTION_H
~multiRotatingAxisMotion() = default;
Model getModel(real t) // - Methods
{
for(int32 i= 0; i<numAxis_; i++ ) /// Retrun motion model at time t
Model getModel(real t)
{ {
axis_[i].setTime(t); for(int32 i= 0; i<numAxis_; i++ )
axis_[i].setAxisList(getAxisListPtrDevice()); {
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_); /// Pointer to axis list on host side
} INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrHost()
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)
{ {
fatalErrorInFunction<< return axis_.hostVectorAll().data();
"axis name " << name << " does not exist. \n";
fatalExit;
return i;
} }
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 /// Read from input stream is
word indexToName(label i)const FUNCTION_H
{ bool read(iIstream& is);
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 "";
}
}
/// Write to output stream os
INLINE_FUNCTION_HD FUNCTION_H
bool isMoving()const bool write(iOstream& os)const;
{
return true;
}
FUNCTION_H
bool move(real t, real dt);
FUNCTION_H
bool read(iIstream& is);
FUNCTION_H
bool write(iOstream& os)const;
}; };

View File

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

View File

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