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,38 +32,88 @@ 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
/// This is either host/device pointer to all axes
multiRotatingAxis* axisList_;
/// Index of parent axis
int32 parentAxisIndex_ = -1;
public:
// - Constructors
/// Empty Constructor
INLINE_FUNCTION_HD
multiRotatingAxis(){}
/// Empty with list of axes
FUNCTION_H
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
/// Construct from dictionary and list of axes
FUNCTION_H
multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
/*FUNCTION_HD
multiRotatingAxis(const realx3& p1, const realx3& p2, real omega = 0.0);*/
/// Copy constructor
FUNCTION_HD
multiRotatingAxis(const multiRotatingAxis&) = default;
/// Copy assignment
FUNCTION_HD
multiRotatingAxis& operator=(const multiRotatingAxis&) = default;
/// Destructor
~multiRotatingAxis() = default;
/// - Methods
/// Tangential velocity at point p
INLINE_FUNCTION_HD
realx3 pointTangentialVel(const realx3& p)const
{
@ -80,8 +130,7 @@ public:
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
{
@ -104,31 +153,39 @@ public:
return newP;
}
/// Does this axis have a parent
INLINE_FUNCTION_HD
bool hasParrent()const
bool hasParent()const
{
return parentAxisIndex_ > -1;
}
/// Return the index of parent axis
INLINE_FUNCTION_HD
int32 parentAxisIndex()const
{
return parentAxisIndex_;
}
// this pointer is device pointer
/// Set the pointer to the list of all axes.
/// 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
/**
* 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( !hasParrent() ) return;
if( !hasParent() ) return;
auto lp1 = point1();
auto lp2 = point2();
@ -140,39 +197,18 @@ public:
}
// - IO operation
/// Read from dictionary
FUNCTION_H
bool read(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
/// Write to dictionary
FUNCTION_H
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
/*FUNCTION_H
bool read(iIstream& is);
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;
} \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
{
@ -81,48 +95,66 @@ 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
// - Constructors
/// Empty
fixedWall();
// construct with dictionary
/// Constructor with dictionary
fixedWall(const dictionary& dict);
/// Copy constructor
fixedWall(const fixedWall&) = default;
/// Move constructor
fixedWall(fixedWall&&) = default;
/// Copy assignment
fixedWall& operator=(const fixedWall&) = default;
/// Move assignment
fixedWall& operator=(fixedWall&&) = default;
/// Destructor
~fixedWall() = default;
// - Methods
/// Return motion model
/// t is the current simulation time
Model getModel(real t)const
{
return Model();
}
/// 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_;
}
/// Velocity at point p
INLINE_FUNCTION_HD
realx3 pointVelocity(label n, const realx3& p)const
{
@ -130,39 +162,43 @@ public:
}
/// 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;
}
/// 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;
}
/// Are walls moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return false;
}
/// Move points
bool move(real t, real dt)
{
return true;
}
// - IO operations
/// 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,47 +120,60 @@ 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
// - Constructor
/// Empty constructor
FUNCTION_H
multiRotatingAxisMotion();
// construct with dictionary
/// Construct with dictionary
FUNCTION_H
multiRotatingAxisMotion(const dictionary& dict);
// copy
/// Copy constructor
FUNCTION_H
multiRotatingAxisMotion(const multiRotatingAxisMotion&) = default;
/// No Move
multiRotatingAxisMotion(multiRotatingAxisMotion&&) = delete;
/// Copy assignment
FUNCTION_H
multiRotatingAxisMotion& operator=(const multiRotatingAxisMotion&) = default;
/// No move assignment
multiRotatingAxisMotion& operator=(multiRotatingAxisMotion&&) = delete;
/// Destructor
FUNCTION_H
~multiRotatingAxisMotion() = default;
// - Methods
/// Retrun motion model at time t
Model getModel(real t)
{
for(int32 i= 0; i<numAxis_; i++ )
@ -145,19 +187,21 @@ public:
return Model(axis_.deviceVector(), numAxis_);
}
/// Pointer to axis list on host side
INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrHost()
{
return axis_.hostVectorAll().data();
}
/// Pointer to axis list on device
INLINE_FUNCTION_H
multiRotatingAxis* getAxisListPtrDevice()
{
return axis_.deviceVectorAll().data();
}
/// Name of motion component to index
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
@ -175,6 +219,7 @@ public:
}
/// Index of motion component to component name
INLINE_FUNCTION_H
word indexToName(label i)const
{
@ -190,20 +235,24 @@ public:
}
}
/// Is moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
/// Move points
FUNCTION_H
bool move(real t, real dt);
// - IO operation
/// Read from input stream is
FUNCTION_H
bool read(iIstream& is);
/// 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,43 +120,56 @@ 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
// - Constructors
/// Empty
FUNCTION_H
rotatingAxisMotion();
// construct with dictionary
/// Construct with dictionary
FUNCTION_H
rotatingAxisMotion(const dictionary& dict);
// copy
/// Copy constructor
FUNCTION_H
rotatingAxisMotion(const rotatingAxisMotion&) = default;
/// No move constructor
rotatingAxisMotion(rotatingAxisMotion&&) = delete;
/// Copy assignment
FUNCTION_H
rotatingAxisMotion& operator=(const rotatingAxisMotion&) = default;
/// No move assignment
rotatingAxisMotion& operator=(rotatingAxisMotion&&) = delete;
/// Destructor
FUNCTION_H
~rotatingAxisMotion() = default;
// - Methods
/// Return the motion model at time t
Model getModel(real t)
{
for(int32 i= 0; i<numAxis_; i++ )
@ -141,6 +182,7 @@ public:
return Model(axis_.deviceVector(), numAxis_);
}
/// Motion component name to index
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
@ -158,6 +200,7 @@ public:
}
/// Motion index to motion component name
INLINE_FUNCTION_H
word indexToName(label i)const
{
@ -174,50 +217,29 @@ public:
}
/*INLINE_FUNCTION_D
realx3 pointVelocity(label n, const realx3& p)const
{
return axis_.deviceVectorAll()[n].linTangentialVelocityPoint(p);
}*/
/*INLINE_FUNCTION_D
realx3 transferPoint(label n, const realx3 p, real dt)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;
}*/
/// Are walls moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
/// 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);
/// Write to output stream os
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