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,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;
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user