www.cemf.ir
multiRotatingAxis.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #ifndef __multiRotatingAxis_hpp__
22 #define __multiRotatingAxis_hpp__
23 
24 
25 #include "rotatingAxis.hpp"
26 #include "KokkosTypes.hpp"
27 
28 
29 namespace pFlow
30 {
31 
32 class dictionary;
33 class multiRotatingAxisMotion;
34 
76 :
77  public rotatingAxis
78 {
79 protected:
80 
83 
86 
87 public:
88 
89  // - Constructors
90 
94 
98 
100  FUNCTION_H
101  multiRotatingAxis(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
102 
105  multiRotatingAxis(const multiRotatingAxis&) = default;
106 
109  multiRotatingAxis& operator=(const multiRotatingAxis&) = default;
110 
112  ~multiRotatingAxis() = default;
113 
115 
119  {
120  realx3 parentVel(0);
121  auto parIndex = parentAxisIndex();
122 
123  while(parIndex != -1)
124  {
125  auto& ax = axisList_[parIndex];
126  parentVel += ax.linTangentialVelocityPoint(p);
127  parIndex = ax.parentAxisIndex();
128  }
129 
130  return parentVel + rotatingAxis::linTangentialVelocityPoint(p);
131  }
132 
135  realx3 transferPoint(const realx3& p, real dt)const
136  {
137  auto newP = p;
138 
139  // rotation around this axis
140  if(isRotating())
141  {
142  newP = pFlow::rotate(p, *this, dt);
143  }
144 
145  auto parIndex = parentAxisIndex_;
146  while(parIndex != -1)
147  {
148  auto& ax = axisList_[parIndex];
149  newP = pFlow::rotate(newP, ax, dt);
150  parIndex = ax.parentAxisIndex();
151  }
152 
153  return newP;
154  }
155 
158  bool hasParent()const
159  {
160  return parentAxisIndex_ > -1;
161  }
162 
166  {
167  return parentAxisIndex_;
168  }
169 
174  {
175  axisList_ = axisList;
176  }
177 
185  void move(real dt)
186  {
187 
188  if( !hasParent() ) return;
189 
190  auto lp1 = point1();
191  auto lp2 = point2();
192 
193  lp1 = axisList_[parentAxisIndex()].transferPoint(lp1, dt);
194  lp2 = axisList_[parentAxisIndex()].transferPoint(lp2, dt);
195 
196  set(lp1, lp2);
197  }
198 
199 
200  // - IO operation
201 
203  FUNCTION_H
204  bool read(multiRotatingAxisMotion* axisMotion, const dictionary& dict);
205 
207  FUNCTION_H
208  bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
209 
210 };
211 
212 
213 }
214 
215 
216 #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:45
KokkosTypes.hpp
rotatingAxis.hpp
pFlow::line::set
INLINE_FUNCTION_HD void set(const realx3 &lp1, const realx3 &lp2)
Definition: line.hpp:86
pFlow::multiRotatingAxis::setAxisListPtr
INLINE_FUNCTION_H void setAxisListPtr(multiRotatingAxis *axisList)
Set the pointer to the list of all axes.
Definition: multiRotatingAxis.hpp:173
pFlow::rotatingAxis::isRotating
INLINE_FUNCTION_HD bool isRotating() const
Is rotating.
Definition: rotatingAxis.hpp:122
pFlow
Definition: demGeometry.hpp:27
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:62
pFlow::multiRotatingAxis
Defines an axis of rotation that rotates around itself and rotates around another axis.
Definition: multiRotatingAxis.hpp:75
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:50
pFlow::rotatingAxis
An axis which rotates around itself at specified speed.
Definition: rotatingAxis.hpp:61
pFlow::line::point2
INLINE_FUNCTION_HD realx3 point2() const
Definition: line.hpp:98
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:57
pFlow::multiRotatingAxis::parentAxisIndex_
int32 parentAxisIndex_
Index of parent axis.
Definition: multiRotatingAxis.hpp:85
FUNCTION_HD
#define FUNCTION_HD
Definition: pFlowMacros.hpp:61
pFlow::multiRotatingAxis::operator=
FUNCTION_HD multiRotatingAxis & operator=(const multiRotatingAxis &)=default
Copy assignment.
pFlow::multiRotatingAxis::axisList_
multiRotatingAxis * axisList_
This is 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:94
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
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::triple< real >
pFlow::multiRotatingAxis::parentAxisIndex
INLINE_FUNCTION_HD int32 parentAxisIndex() const
Return the index of parent axis.
Definition: multiRotatingAxis.hpp:165
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67
pFlow::rotate
INLINE_FUNCTION_HD realx3 rotate(const realx3 &p, const line &ln, real theta)
Definition: rotatingAxisI.hpp:74