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 class dictionary;
38 
40 {
41 public:
42 
43  // - this class shuold be decleared in every motion model with
44  // exact methods
45  class Model
46  {
47  protected:
48 
51 
52  public:
53 
56  components_(comps),
57  numComponents_(numComps)
58  {}
59 
61  Model(const Model&) = default;
62 
63 
65  Model& operator=(const Model&) = default;
66 
67 
69  realx3 pointVelocity(int32 n, const realx3& p)const
70  {
71  return components_[n].linTangentialVelocityPoint(p);
72  }
73 
75  realx3 operator()(int32 n, const realx3& p)const
76  {
77  return pointVelocity(n,p);
78  }
79 
81  realx3 transferPoint(int32 n, const realx3 p, real dt)const
82  {
83  return components_[n].transferPoint(p, dt);
84  }
85 
87  {
88  return numComponents_;
89  }
90  };
91 
92 protected:
93 
95 
97 
99 
101 
102  bool readDictionary(const dictionary& dict);
103 
104  bool writeDictionary(dictionary& dict)const;
105 
106 public:
107 
108  TypeInfoNV("vibratingMotion");
109 
110  // empty
111  FUNCTION_H
112  vibratingMotion();
113 
114  // construct with dictionary
115  FUNCTION_H
116  vibratingMotion(const dictionary& dict);
117 
118  // copy
119  FUNCTION_H
120  vibratingMotion(const vibratingMotion&) = default;
121 
122  vibratingMotion(vibratingMotion&&) = delete;
123 
124  FUNCTION_H
125  vibratingMotion& operator=(const vibratingMotion&) = default;
126 
128 
129  FUNCTION_H
130  ~vibratingMotion() = default;
131 
132 
134  {
135  for(int32 i= 0; i<numComponents_; i++ )
136  {
137  components_[i].setTime(t);
138  }
141 
143  }
144 
146  int32 nameToIndex(const word& name)const
147  {
148  if( auto i = componentName_.findi(name); i == -1)
149  {
151  "component name " << name << " does not exist. \n";
152  fatalExit;
153  return i;
154  }
155  else
156  {
157  return i;
158  }
159 
160  }
161 
164  {
165  if(i < numComponents_ )
166  return componentName_[i];
167  else
168  {
170  "out of range access to the list of axes " << i <<endl<<
171  " size of components_ is "<<numComponents_<<endl;
172  fatalExit;
173  return "";
174  }
175  }
176 
177 
179  realx3 pointVelocity(label n, const realx3& p)const
180  {
181  return components_.hostVectorAll()[n].linTangentialVelocityPoint(p);
182  }
183 
184 
185 
187  realx3 transferPoint(label n, const realx3 p, real dt)const
188  {
189  return components_.hostVectorAll()[n].transferPoint(p, dt);
190  }
191 
192 
194  bool isMoving()const
195  {
196  return true;
197  }
198 
200  bool move(real t, real dt)
201  {
202  return true;
203  }
204 
205  FUNCTION_H
206  bool read(iIstream& is);
207 
208  FUNCTION_H
209  bool write(iOstream& os)const;
210 
211 
212 };
213 
214 } // pFlow
215 
216 #endif //__rotatingAxisMotion_hpp__
pFlow::vibratingMotion::nameToIndex
INLINE_FUNCTION_H int32 nameToIndex(const word &name) const
Definition: vibratingMotion.hpp:146
pFlow::vibratingMotion::isMoving
INLINE_FUNCTION_HD bool isMoving() const
Definition: vibratingMotion.hpp:194
pFlow::vibratingMotion
Definition: vibratingMotion.hpp:39
pFlow::vibratingMotion::read
FUNCTION_H bool read(iIstream &is)
Definition: vibratingMotion.cpp:127
pFlow::List< word >
pFlow::VectorDual::syncViews
INLINE_FUNCTION_H void syncViews()
Definition: VectorDual.hpp:875
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::vibratingMotion::transferPoint
INLINE_FUNCTION_H realx3 transferPoint(label n, const realx3 p, real dt) const
Definition: vibratingMotion.hpp:187
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::vibratingMotion::TypeInfoNV
TypeInfoNV("vibratingMotion")
pFlow::vibratingMotion::Model::numComponents
INLINE_FUNCTION_HD int32 numComponents() const
Definition: vibratingMotion.hpp:86
pFlow::vibratingMotion::Model
Definition: vibratingMotion.hpp:45
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:49
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::vibratingMotion::components_
axisVector_HD components_
Definition: vibratingMotion.hpp:96
pFlow::VectorDual::modifyOnHost
INLINE_FUNCTION_H void modifyOnHost()
Definition: VectorDual.hpp:796
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
Definition: KokkosTypes.hpp:93
pFlow::vibratingMotion::pointVelocity
INLINE_FUNCTION_H realx3 pointVelocity(label n, const realx3 &p) const
Definition: vibratingMotion.hpp:179
pFlow::vibratingMotion::numComponents_
label numComponents_
Definition: vibratingMotion.hpp:100
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:81
pFlow::vibratingMotion::~vibratingMotion
FUNCTION_H ~vibratingMotion()=default
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
pFlow::vibratingMotion::readDictionary
bool readDictionary(const dictionary &dict)
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:75
pFlow::vibratingMotion::Model::pointVelocity
INLINE_FUNCTION_HD realx3 pointVelocity(int32 n, const realx3 &p) const
Definition: vibratingMotion.hpp:69
pFlow::vibratingMotion::move
INLINE_FUNCTION_H bool move(real t, real dt)
Definition: vibratingMotion.hpp:200
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::vibratingMotion::Model::numComponents_
int32 numComponents_
Definition: vibratingMotion.hpp:50
pFlow::vibratingMotion::Model::Model
INLINE_FUNCTION_HD Model(deviceViewType1D< vibrating > comps, int32 numComps)
Definition: vibratingMotion.hpp:55
pFlow::vibratingMotion::componentName_
wordList componentName_
Definition: vibratingMotion.hpp:98
pFlow::vibratingMotion::writeDictionary
bool writeDictionary(dictionary &dict) const
Definition: vibratingMotion.cpp:88
typeInfo.hpp
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::vibratingMotion::vibratingMotion
FUNCTION_H vibratingMotion()
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
Definition: vibratingMotion.cpp:148
pFlow::vibratingMotion::getModel
Model getModel(real t)
Definition: vibratingMotion.hpp:133
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::vibratingMotion::indexToName
INLINE_FUNCTION_H word indexToName(label i) const
Definition: vibratingMotion.hpp:163
pFlow::dictionary
Definition: dictionary.hpp:38