# PhasicFlow: src/MotionModel/entities/multiRotatingAxis/multiRotatingAxis.hpp Source File

multiRotatingAxis.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __multiRotatingAxis_hpp__
#define __multiRotatingAxis_hpp__
#include "rotatingAxis.hpp"
#include "KokkosTypes.hpp"
namespace pFlow
{
class dictionary;
class multiRotatingAxisMotion;
class multiRotatingAxis
:
public rotatingAxis
{
protected:
multiRotatingAxis* axisList_;
int32 parentAxisIndex_ = -1;
public:
// - Constructors
INLINE_FUNCTION_HD
multiRotatingAxis(){}
FUNCTION_H
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
FUNCTION_H
multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
FUNCTION_HD
multiRotatingAxis(const multiRotatingAxis&) = default;
FUNCTION_HD
multiRotatingAxis& operator=(const multiRotatingAxis&) = default;
~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 hasParent()const
{
return parentAxisIndex_ > -1;
}
INLINE_FUNCTION_HD
int32 parentAxisIndex()const
{
return parentAxisIndex_;
}
INLINE_FUNCTION_H
void setAxisList(multiRotatingAxis* axisList)
{
axisList_ = axisList;
}
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;
};
}
#endif
pFlow::multiRotatingAxis::write
FUNCTION_H bool write(const multiRotatingAxisMotion *axisMotion, dictionary &dict) const
Write to dictionary.
Definition: multiRotatingAxis.cpp:80
pFlow::multiRotatingAxis::hasParent
INLINE_FUNCTION_HD bool hasParent() const
Does this axis have a parent.
Definition: multiRotatingAxis.hpp:158
pFlow::multiRotatingAxis::read
FUNCTION_H bool read(multiRotatingAxisMotion *axisMotion, const dictionary &dict)
Read from dictionary.
Definition: multiRotatingAxis.cpp:56
pFlow::multiRotatingAxis::~multiRotatingAxis
~multiRotatingAxis()=default
Destructor.
pFlow::real
float real
Definition: builtinTypes.hpp:46
KokkosTypes.hpp
rotatingAxis.hpp
pFlow::line::set
INLINE_FUNCTION_HD void set(const realx3 &lp1, const realx3 &lp2)
Definition: line.hpp:78
pFlow::rotatingAxis::isRotating
INLINE_FUNCTION_HD bool isRotating() const
Is rotating.
Definition: rotatingAxis.hpp:111
pFlow
Definition: demComponent.hpp:28
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::multiRotatingAxis
Defines an axis of rotation that rotates around itself and rotates around another axis.
Definition: multiRotatingAxis.hpp:75
pFlow::multiRotatingAxis::setAxisList
INLINE_FUNCTION_H void setAxisList(multiRotatingAxis *axisList)
Set the pointer to the list of all axes.
Definition: multiRotatingAxis.hpp:173
pFlow::multiRotatingAxis::pointTangentialVel
INLINE_FUNCTION_HD realx3 pointTangentialVel(const realx3 &p) const
Tangential velocity at point p.
Definition: multiRotatingAxis.hpp:118
pFlow::multiRotatingAxis::multiRotatingAxis
INLINE_FUNCTION_HD multiRotatingAxis()
Empty Constructor.
Definition: multiRotatingAxis.hpp:93
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::rotatingAxis
An axis which rotates around itself at specified speed.
Definition: rotatingAxis.hpp:62
pFlow::line::point2
INLINE_FUNCTION_HD realx3 point2() const
Definition: line.hpp:90
pFlow::multiRotatingAxis::move
void move(real dt)
Move the end points of the axis.
Definition: multiRotatingAxis.hpp:185
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::multiRotatingAxis::parentAxisIndex_
int32 parentAxisIndex_
Index of parent axis.
Definition: multiRotatingAxis.hpp:85
FUNCTION_HD
#define FUNCTION_HD
Definition: pFlowMacros.hpp:57
pFlow::multiRotatingAxis::operator=
FUNCTION_HD multiRotatingAxis & operator=(const multiRotatingAxis &)=default
Copy assignment.
rotate
INLINE_FUNCTION_HD realx3 rotate(const realx3 &p, const line &ln, real theta)
pFlow::multiRotatingAxis::axisList_
multiRotatingAxis * axisList_
This is either host/device pointer to all axes.
Definition: multiRotatingAxis.hpp:82
pFlow::multiRotatingAxisMotion
Rotating axis motion model for walls.
Definition: multiRotatingAxisMotion.hpp:65
pFlow::line::point1
INLINE_FUNCTION_HD realx3 point1() const
Definition: line.hpp:86
pFlow::multiRotatingAxis::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(const realx3 &p, real dt) const
Translate point p for dt seconds based on the axis information.
Definition: multiRotatingAxis.hpp:135
pFlow::rotatingAxis::linTangentialVelocityPoint
INLINE_FUNCTION_HD realx3 linTangentialVelocityPoint(const realx3 &p) const
Linear tangential velocity at point p.
Definition: rotatingAxisI.hpp:22
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::multiRotatingAxis::parentAxisIndex
INLINE_FUNCTION_HD int32 parentAxisIndex() const
Return the index of parent axis.
Definition: multiRotatingAxis.hpp:165
pFlow::dictionary
Definition: dictionary.hpp:38