www.cemf.ir
vibratingMotion.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 __vibratingMotion_hpp__
22 #define __vibratingMotion_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 "vibrating.hpp"
31 
32 
33 
34 namespace pFlow
35 {
36 
37 // forward
38 class dictionary;
39 
69 {
70 public:
71 
75  class Model
76  {
77  protected:
78 
81 
82  public:
83 
86  components_(comps),
87  numComponents_(numComps)
88  {}
89 
91  Model(const Model&) = default;
92 
93 
95  Model& operator=(const Model&) = default;
96 
97 
99  realx3 pointVelocity(int32 n, const realx3& p)const
100  {
101  return components_[n].linTangentialVelocityPoint(p);
102  }
103 
105  realx3 operator()(int32 n, const realx3& p)const
106  {
107  return pointVelocity(n,p);
108  }
109 
111  realx3 transferPoint(int32 n, const realx3 p, real dt)const
112  {
113  return components_[n].transferPoint(p, dt);
114  }
115 
117  {
118  return numComponents_;
119  }
120  };
121 
122 protected:
123 
125 
128 
131 
134 
136  bool readDictionary(const dictionary& dict);
137 
139  bool writeDictionary(dictionary& dict)const;
140 
141 public:
142 
144  TypeInfoNV("vibratingMotion");
145 
147  FUNCTION_H
148  vibratingMotion();
149 
151  FUNCTION_H
152  vibratingMotion(const dictionary& dict);
153 
155  FUNCTION_H
156  vibratingMotion(const vibratingMotion&) = default;
157 
159  vibratingMotion(vibratingMotion&&) = delete;
160 
162  FUNCTION_H
163  vibratingMotion& operator=(const vibratingMotion&) = default;
164 
167 
169  FUNCTION_H
170  ~vibratingMotion() = default;
171 
174  {
175  for(int32 i= 0; i<numComponents_; i++ )
176  {
177  components_[i].setTime(t);
178  }
181 
183  }
184 
187  int32 nameToIndex(const word& name)const
188  {
189  if( auto i = componentName_.findi(name); i == -1)
190  {
192  "component 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 < numComponents_ )
208  return componentName_[i];
209  else
210  {
212  "out of range access to the list of axes " << i <<endl<<
213  " size of components_ is "<<numComponents_<<endl;
214  fatalExit;
215  return "";
216  }
217  }
218 
221  realx3 pointVelocity(label n, const realx3& p)const
222  {
223  return components_.hostVectorAll()[n].linTangentialVelocityPoint(p);
224  }
225 
228  realx3 transferPoint(label n, const realx3 p, real dt)const
229  {
230  return components_.hostVectorAll()[n].transferPoint(p, dt);
231  }
232 
235  bool isMoving()const
236  {
237  return true;
238  }
239 
242  bool move(real t, real dt)
243  {
244  return true;
245  }
246 
248  FUNCTION_H
249  bool read(iIstream& is);
250 
252  FUNCTION_H
253  bool write(iOstream& os)const;
254 
255 };
256 
257 } // pFlow
258 
259 #endif //__rotatingAxisMotion_hpp__
pFlow::vibratingMotion::nameToIndex
INLINE_FUNCTION_H int32 nameToIndex(const word &name) const
Name to component index.
Definition: vibratingMotion.hpp:187
pFlow::vibratingMotion::isMoving
INLINE_FUNCTION_HD bool isMoving() const
Is moving.
Definition: vibratingMotion.hpp:235
pFlow::vibratingMotion
Vibrating motion model for walls.
Definition: vibratingMotion.hpp:68
pFlow::vibratingMotion::read
FUNCTION_H bool read(iIstream &is)
Read from input stream is.
Definition: vibratingMotion.cpp:127
pFlow::List< word >
pFlow::VectorDual::syncViews
INLINE_FUNCTION_H void syncViews()
Definition: VectorDual.hpp:909
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::vibratingMotion::transferPoint
INLINE_FUNCTION_H realx3 transferPoint(label n, const realx3 p, real dt) const
Transfer point p for dt seconds based on motion component n.
Definition: vibratingMotion.hpp:228
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::vibratingMotion::TypeInfoNV
TypeInfoNV("vibratingMotion")
Type info.
pFlow::vibratingMotion::Model::numComponents
INLINE_FUNCTION_HD int32 numComponents() const
Definition: vibratingMotion.hpp:116
pFlow::vibratingMotion::Model
Motion model class to be passed to computational units/kernels for transfing points and returning vel...
Definition: vibratingMotion.hpp:75
pFlow::VectorDual::hostVectorAll
INLINE_FUNCTION_H hostViewType & hostVectorAll()
Definition: VectorDual.hpp:345
types.hpp
List.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::vibratingMotion::Model::operator=
INLINE_FUNCTION_HD Model & operator=(const Model &)=default
Vectors.hpp
pFlow::vibratingMotion::Model::components_
deviceViewType1D< vibrating > components_
Definition: vibratingMotion.hpp:79
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:320
pFlow::vibratingMotion::components_
axisVector_HD components_
Vibrating motion components.
Definition: vibratingMotion.hpp:127
pFlow::VectorDual::modifyOnHost
INLINE_FUNCTION_H void modifyOnHost()
Definition: VectorDual.hpp:830
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
Definition: KokkosTypes.hpp:98
pFlow::vibratingMotion::pointVelocity
INLINE_FUNCTION_H realx3 pointVelocity(label n, const realx3 &p) const
velocity at point p according to motion component n
Definition: vibratingMotion.hpp:221
pFlow::vibratingMotion::numComponents_
label numComponents_
Number of components.
Definition: vibratingMotion.hpp:133
VectorDual.hpp
pFlow
Definition: demComponent.hpp:28
vibrating.hpp
pFlow::vibratingMotion::Model::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(int32 n, const realx3 p, real dt) const
Definition: vibratingMotion.hpp:111
pFlow::vibratingMotion::~vibratingMotion
FUNCTION_H ~vibratingMotion()=default
Destructor.
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::List::findi
int32 findi(const T &val) const
Definition: ListI.hpp:109
pFlow::VectorDual::deviceVectorAll
INLINE_FUNCTION_H deviceViewType & deviceVectorAll()
Definition: VectorDual.hpp:335
n
int32 n
Definition: NBSCrossLoop.hpp:24
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::vibratingMotion::operator=
FUNCTION_H vibratingMotion & operator=(const vibratingMotion &)=default
Copy assignment.
pFlow::vibratingMotion::readDictionary
bool readDictionary(const dictionary &dict)
Read from a dictionary.
Definition: vibratingMotion.cpp:27
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< vibrating >
pFlow::vibratingMotion::Model::operator()
INLINE_FUNCTION_HD realx3 operator()(int32 n, const realx3 &p) const
Definition: vibratingMotion.hpp:105
pFlow::vibratingMotion::Model::pointVelocity
INLINE_FUNCTION_HD realx3 pointVelocity(int32 n, const realx3 &p) const
Definition: vibratingMotion.hpp:99
pFlow::vibratingMotion::move
INLINE_FUNCTION_H bool move(real t, real dt)
Move ponits at time t for dt seconds.
Definition: vibratingMotion.hpp:242
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::vibratingMotion::Model::numComponents_
int32 numComponents_
Definition: vibratingMotion.hpp:80
pFlow::vibratingMotion::Model::Model
INLINE_FUNCTION_HD Model(deviceViewType1D< vibrating > comps, int32 numComps)
Definition: vibratingMotion.hpp:85
pFlow::vibratingMotion::componentName_
wordList componentName_
Names of components.
Definition: vibratingMotion.hpp:130
pFlow::vibratingMotion::writeDictionary
bool writeDictionary(dictionary &dict) const
Write to a dictionary.
Definition: vibratingMotion.cpp:88
typeInfo.hpp
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::vibratingMotion::vibratingMotion
FUNCTION_H vibratingMotion()
Empty.
Definition: vibratingMotion.cpp:112
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::vibratingMotion::write
FUNCTION_H bool write(iOstream &os) const
Write to output stream os.
Definition: vibratingMotion.cpp:148
pFlow::vibratingMotion::getModel
Model getModel(real t)
Return motion model at time t.
Definition: vibratingMotion.hpp:173
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::vibratingMotion::indexToName
INLINE_FUNCTION_H word indexToName(label i) const
Index to name.
Definition: vibratingMotion.hpp:205
pFlow::dictionary
Definition: dictionary.hpp:38