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 
66 {
67 public:
68 
72  class Model
73  {
74  protected:
75 
78 
79  public:
80 
83  axis_(axis),
84  numAxis_(numAxis)
85  {}
86 
88  Model(const Model&) = default;
89 
90 
92  Model& operator=(const Model&) = default;
93 
94 
96  realx3 pointVelocity(int32 n, const realx3& p)const
97  {
98  return axis_[n].linTangentialVelocityPoint(p);
99  }
100 
102  realx3 operator()(int32 n, const realx3& p)const
103  {
104  return pointVelocity(n,p);
105  }
106 
108  realx3 transferPoint(int32 n, const realx3 p, real dt)const
109  {
110  return rotate(p, axis_[n], dt);
111  }
112 
114  {
115  return numAxis_;
116  }
117  };
118 
119 protected:
120 
122 
125 
128 
131 
133  bool readDictionary(const dictionary& dict);
134 
136  bool writeDictionary(dictionary& dict)const;
137 
138 public:
139 
141  TypeInfoNV("rotatingAxisMotion");
142 
143  // - Constructors
144 
146  FUNCTION_H
148 
150  FUNCTION_H
151  rotatingAxisMotion(const dictionary& dict);
152 
154  FUNCTION_H
155  rotatingAxisMotion(const rotatingAxisMotion&) = default;
156 
159 
161  FUNCTION_H
163 
166 
168  FUNCTION_H
169  ~rotatingAxisMotion() = default;
170 
171  // - Methods
174  {
175  for(int32 i= 0; i<numAxis_; i++ )
176  {
177  axis_[i].setTime(t);
178  }
180  axis_.syncViews();
181 
182  return Model(axis_.deviceVector(), numAxis_);
183  }
184 
187  int32 nameToIndex(const word& name)const
188  {
189  if( auto i = axisName_.findi(name); i == -1)
190  {
192  "axis name " << name << " does not exist. \n";
193  fatalExit;
194  return i;
195  }
196  else
197  {
198  return i;
199  }
200 
201  }
202 
206  {
207  if(i < numAxis_ )
208  return axisName_[i];
209  else
210  {
212  "out of range access to the list of axes " << i <<endl<<
213  " size of axes_ is "<<numAxis_<<endl;
214  fatalExit;
215  return "";
216  }
217  }
218 
219 
222  bool isMoving()const
223  {
224  return true;
225  }
226 
229  bool move(real t, real dt)
230  {
231  return true;
232  }
233 
234  // - IO operation
236  FUNCTION_H
237  bool read(iIstream& is);
238 
240  FUNCTION_H
241  bool write(iOstream& os)const;
242 
243 };
244 
245 } // pFlow
246 
247 #endif //__rotatingAxisMotion_hpp__
pFlow::List< word >
pFlow::rotatingAxisMotion::move
INLINE_FUNCTION_H bool move(real t, real dt)
Move.
Definition: rotatingAxisMotion.hpp:229
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:102
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
Write to output stream os.
Definition: rotatingAxisMotion.cpp:151
pFlow::rotatingAxisMotion
Rotating axis motion model for walls.
Definition: rotatingAxisMotion.hpp:65
types.hpp
pFlow::rotatingAxisMotion::Model::operator=
INLINE_FUNCTION_HD Model & operator=(const Model &)=default
pFlow::rotatingAxisMotion::rotatingAxisMotion
FUNCTION_H rotatingAxisMotion()
Empty.
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
Motion component name to index.
Definition: rotatingAxisMotion.hpp:187
pFlow::rotatingAxisMotion::numAxis_
label numAxis_
Number of axes components.
Definition: rotatingAxisMotion.hpp:130
Vectors.hpp
rotatingAxis.hpp
pFlow::rotatingAxisMotion::TypeInfoNV
TypeInfoNV("rotatingAxisMotion")
Type info.
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::rotatingAxisMotion::writeDictionary
bool writeDictionary(dictionary &dict) const
Write to dictionary.
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
Copy assignment.
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::rotatingAxisMotion::~rotatingAxisMotion
FUNCTION_H ~rotatingAxisMotion()=default
Destructor.
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:108
pFlow::rotatingAxisMotion::Model::numAxis_
int32 numAxis_
Definition: rotatingAxisMotion.hpp:77
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::rotatingAxisMotion::isMoving
INLINE_FUNCTION_HD bool isMoving() const
Are walls moving.
Definition: rotatingAxisMotion.hpp:222
pFlow::rotatingAxisMotion::read
FUNCTION_H bool read(iIstream &is)
Read from input stream is.
Definition: rotatingAxisMotion.cpp:130
pFlow::rotatingAxisMotion::Model::pointVelocity
INLINE_FUNCTION_HD realx3 pointVelocity(int32 n, const realx3 &p) const
Definition: rotatingAxisMotion.hpp:96
pFlow::rotatingAxisMotion::axis_
axisVector_HD axis_
Vector to store axes.
Definition: rotatingAxisMotion.hpp:124
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:82
pFlow::rotatingAxisMotion::readDictionary
bool readDictionary(const dictionary &dict)
Read from dictionary.
Definition: rotatingAxisMotion.cpp:27
pFlow::rotatingAxisMotion::Model
Motion model class to be passed to computational units/kernels for transfing points and returning vel...
Definition: rotatingAxisMotion.hpp:72
pFlow::rotatingAxisMotion::axisName_
wordList axisName_
Names of axes.
Definition: rotatingAxisMotion.hpp:127
pFlow::rotatingAxisMotion::getModel
Model getModel(real t)
Return the motion model at time t.
Definition: rotatingAxisMotion.hpp:173
pFlow::VectorDual::deviceVector
INLINE_FUNCTION_H deviceViewType & deviceVector()
Definition: VectorDual.hpp:354
pFlow::rotatingAxisMotion::Model::axis_
deviceViewType1D< rotatingAxis > axis_
Definition: rotatingAxisMotion.hpp:76
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:113
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
Motion index to motion component name.
Definition: rotatingAxisMotion.hpp:205
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::dictionary
Definition: dictionary.hpp:38