rotatingAxisMotion.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 __rotatingAxisMotion_hpp__
22 #define __rotatingAxisMotion_hpp__
23 
24 
25 #include "types.hpp"
26 #include "typeInfo.hpp"
27 #include "VectorDual.hpp"
28 #include "Vectors.hpp"
29 #include "List.hpp"
30 #include "rotatingAxis.hpp"
31 
32 
33 namespace pFlow
34 {
35 
36 class dictionary;
37 
39 {
40 public:
41 
42  // - this class shuold be decleared in every motion model with
43  // exact methods
44  class Model
45  {
46  protected:
47 
50 
51  public:
52 
55  axis_(axis),
56  numAxis_(numAxis)
57  {}
58 
60  Model(const Model&) = default;
61 
62 
64  Model& operator=(const Model&) = default;
65 
66 
68  realx3 pointVelocity(int32 n, const realx3& p)const
69  {
70  return axis_[n].linTangentialVelocityPoint(p);
71  }
72 
74  realx3 operator()(int32 n, const realx3& p)const
75  {
76  return pointVelocity(n,p);
77  }
78 
80  realx3 transferPoint(int32 n, const realx3 p, real dt)const
81  {
82  return rotate(p, axis_[n], dt);
83  }
84 
86  {
87  return numAxis_;
88  }
89  };
90 
91 protected:
92 
94 
96 
98 
100 
101  bool readDictionary(const dictionary& dict);
102 
103  bool writeDictionary(dictionary& dict)const;
104 
105 public:
106 
107  TypeInfoNV("rotatingAxisMotion");
108 
109  // empty
110  FUNCTION_H
112 
113  // construct with dictionary
114  FUNCTION_H
115  rotatingAxisMotion(const dictionary& dict);
116 
117  // copy
118  FUNCTION_H
119  rotatingAxisMotion(const rotatingAxisMotion&) = default;
120 
122 
123  FUNCTION_H
125 
127 
128  FUNCTION_H
129  ~rotatingAxisMotion() = default;
130 
131 
133  {
134  for(int32 i= 0; i<numAxis_; i++ )
135  {
136  axis_[i].setTime(t);
137  }
139  axis_.syncViews();
140 
141  return Model(axis_.deviceVector(), numAxis_);
142  }
143 
145  int32 nameToIndex(const word& name)const
146  {
147  if( auto i = axisName_.findi(name); i == -1)
148  {
150  "axis name " << name << " does not exist. \n";
151  fatalExit;
152  return i;
153  }
154  else
155  {
156  return i;
157  }
158 
159  }
160 
163  {
164  if(i < numAxis_ )
165  return axisName_[i];
166  else
167  {
169  "out of range access to the list of axes " << i <<endl<<
170  " size of axes_ is "<<numAxis_<<endl;
171  fatalExit;
172  return "";
173  }
174  }
175 
176 
177  /*INLINE_FUNCTION_D
178  realx3 pointVelocity(label n, const realx3& p)const
179  {
180  return axis_.deviceVectorAll()[n].linTangentialVelocityPoint(p);
181  }*/
182 
183 
184 
185  /*INLINE_FUNCTION_D
186  realx3 transferPoint(label n, const realx3 p, real dt)const
187  {
188  return rotate(p, axis_.deviceVectorAll()[n], dt);
189  }
190 
191 
192  INLINE_FUNCTION_D
193  bool transferPoint(label n, realx3* pVec, size_t numP, real dt)
194  {
195  if( n>=numAxis_)return false;
196 
197  rotate( pVec, numP, axis_.deviceVectorAll()[n], dt);
198 
199  return true;
200  }*/
201 
203  bool isMoving()const
204  {
205  return true;
206  }
207 
209  bool move(real t, real dt)
210  {
211  return true;
212  }
213 
214  FUNCTION_H
215  bool read(iIstream& is);
216 
217  FUNCTION_H
218  bool write(iOstream& os)const;
219 
220 
221 };
222 
223 } // pFlow
224 
225 #endif //__rotatingAxisMotion_hpp__
pFlow::List< word >
pFlow::rotatingAxisMotion::move
INLINE_FUNCTION_H bool move(real t, real dt)
Definition: rotatingAxisMotion.hpp:209
pFlow::VectorDual::syncViews
INLINE_FUNCTION_H void syncViews()
Definition: VectorDual.hpp:875
pFlow::rotatingAxisMotion::Model::operator()
INLINE_FUNCTION_HD realx3 operator()(int32 n, const realx3 &p) const
Definition: rotatingAxisMotion.hpp:74
pFlow::real
float real
Definition: builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::rotatingAxisMotion::write
FUNCTION_H bool write(iOstream &os) const
Definition: rotatingAxisMotion.cpp:151
pFlow::rotatingAxisMotion
Definition: rotatingAxisMotion.hpp:38
types.hpp
pFlow::rotatingAxisMotion::Model::operator=
INLINE_FUNCTION_HD Model & operator=(const Model &)=default
pFlow::rotatingAxisMotion::rotatingAxisMotion
FUNCTION_H rotatingAxisMotion()
Definition: rotatingAxisMotion.cpp:115
List.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::rotatingAxisMotion::nameToIndex
INLINE_FUNCTION_H int32 nameToIndex(const word &name) const
Definition: rotatingAxisMotion.hpp:145
pFlow::rotatingAxisMotion::numAxis_
label numAxis_
Definition: rotatingAxisMotion.hpp:99
Vectors.hpp
rotatingAxis.hpp
pFlow::rotatingAxisMotion::TypeInfoNV
TypeInfoNV("rotatingAxisMotion")
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::rotatingAxisMotion::writeDictionary
bool writeDictionary(dictionary &dict) const
Definition: rotatingAxisMotion.cpp:91
pFlow::VectorDual::modifyOnHost
INLINE_FUNCTION_H void modifyOnHost()
Definition: VectorDual.hpp:796
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
Definition: KokkosTypes.hpp:93
VectorDual.hpp
pFlow
Definition: demComponent.hpp:28
pFlow::rotatingAxisMotion::operator=
FUNCTION_H rotatingAxisMotion & operator=(const rotatingAxisMotion &)=default
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::rotatingAxisMotion::~rotatingAxisMotion
FUNCTION_H ~rotatingAxisMotion()=default
pFlow::List::findi
int32 findi(const T &val) const
Definition: ListI.hpp:109
n
int32 n
Definition: NBSCrossLoop.hpp:24
pFlow::iIstream
Definition: iIstream.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< rotatingAxis >
pFlow::rotatingAxisMotion::Model::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(int32 n, const realx3 p, real dt) const
Definition: rotatingAxisMotion.hpp:80
pFlow::rotatingAxisMotion::Model::numAxis_
int32 numAxis_
Definition: rotatingAxisMotion.hpp:49
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::rotatingAxisMotion::isMoving
INLINE_FUNCTION_HD bool isMoving() const
Definition: rotatingAxisMotion.hpp:203
pFlow::rotatingAxisMotion::read
FUNCTION_H bool read(iIstream &is)
Definition: rotatingAxisMotion.cpp:130
pFlow::rotatingAxisMotion::Model::pointVelocity
INLINE_FUNCTION_HD realx3 pointVelocity(int32 n, const realx3 &p) const
Definition: rotatingAxisMotion.hpp:68
pFlow::rotatingAxisMotion::axis_
axisVector_HD axis_
Definition: rotatingAxisMotion.hpp:95
rotate
INLINE_FUNCTION_HD realx3 rotate(const realx3 &p, const line &ln, real theta)
pFlow::rotatingAxisMotion::Model::Model
INLINE_FUNCTION_HD Model(deviceViewType1D< rotatingAxis > axis, int32 numAxis)
Definition: rotatingAxisMotion.hpp:54
pFlow::rotatingAxisMotion::readDictionary
bool readDictionary(const dictionary &dict)
Definition: rotatingAxisMotion.cpp:27
pFlow::rotatingAxisMotion::Model
Definition: rotatingAxisMotion.hpp:44
pFlow::rotatingAxisMotion::axisName_
wordList axisName_
Definition: rotatingAxisMotion.hpp:97
pFlow::rotatingAxisMotion::getModel
Model getModel(real t)
Definition: rotatingAxisMotion.hpp:132
pFlow::VectorDual::deviceVector
INLINE_FUNCTION_H deviceViewType & deviceVector()
Definition: VectorDual.hpp:354
pFlow::rotatingAxisMotion::Model::axis_
deviceViewType1D< rotatingAxis > axis_
Definition: rotatingAxisMotion.hpp:48
typeInfo.hpp
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::rotatingAxisMotion::Model::numComponents
INLINE_FUNCTION_HD int32 numComponents() const
Definition: rotatingAxisMotion.hpp:85
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::rotatingAxisMotion::indexToName
INLINE_FUNCTION_H word indexToName(label i) const
Definition: rotatingAxisMotion.hpp:162
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::dictionary
Definition: dictionary.hpp:38