www.cemf.ir
vibrating.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 __vibrating_hpp__
22 #define __vibrating_hpp__
23 
24 
25 #include "timeInterval.hpp"
26 
27 #include "streams.hpp"
28 
29 namespace pFlow
30 {
31 
32 // forward
33 class dictionary;
34 
35 
65 class vibrating
66 :
67  public timeInterval
68 {
69 
70 protected:
71 
72  // rotation speed
74 
76 
78 
79  realx3 velocity_{0,0,0};
80 
82 
85  {
86  if(inTimeRange())
87  {
89  }else
90  {
91  velocity_ = {0,0,0};
92  }
93  }
94 
95 public:
96 
99 
100  FUNCTION_H
101  vibrating(const dictionary& dict);
102 
103 
105  vibrating(const vibrating&) = default;
106 
107  vibrating& operator=(const vibrating&) = default;
108 
110  void setTime(real t)
111  {
112  if( !equal(t, time()) ) velocity0_ = velocity_;
115  }
116 
119  {
120  return velocity_;
121  }
122 
125  {
126  if(!inTimeRange()) return p;
127  return p + static_cast<real>(0.5)*dt*(velocity0_+velocity_);
128  }
129 
130  // - IO operation
131  FUNCTION_H
132  bool read(const dictionary& dict);
133 
134  FUNCTION_H
135  bool write(dictionary& dict) const;
136 
137  FUNCTION_H
138  bool read(iIstream& is);
139 
140  FUNCTION_H
141  bool write(iOstream& os)const;
142 
143 };
144 
145 inline iOstream& operator <<(iOstream& os, const vibrating& obj)
146 {
147  if(!obj.write(os))
148  {
149  fatalExit;
150  }
151  return os;
152 }
153 
155 {
156  if( !obj.read(is) )
157  {
158  fatalExit;
159  }
160  return is;
161 }
162 
163 }
164 
165 
166 #endif
timeInterval.hpp
pFlow::real
float real
Definition: builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::vibrating::angularFreq_
realx3 angularFreq_
Definition: vibrating.hpp:73
pFlow::vibrating
Vibrating model for a wall.
Definition: vibrating.hpp:65
pFlow::vibrating::velocity0_
realx3 velocity0_
Definition: vibrating.hpp:81
pFlow::timeInterval::startTime
INLINE_FUNCTION_HD auto startTime() const
Definition: timeInterval.hpp:45
pFlow::sin
INLINE_FUNCTION_HD real sin(real x)
Definition: math.hpp:168
pFlow::vibrating::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(const realx3 &p, real dt)
Definition: vibrating.hpp:124
pFlow::vibrating::calculateVelocity
INLINE_FUNCTION_HD void calculateVelocity()
Definition: vibrating.hpp:84
pFlow::vibrating::operator=
vibrating & operator=(const vibrating &)=default
pFlow
Definition: demComponent.hpp:28
pFlow::vibrating::velocity_
realx3 velocity_
Definition: vibrating.hpp:79
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::timeInterval::time
INLINE_FUNCTION_HD auto time() const
Definition: timeInterval.hpp:57
pFlow::vibrating::phaseAngle_
realx3 phaseAngle_
Definition: vibrating.hpp:75
pFlow::vibrating::linTangentialVelocityPoint
INLINE_FUNCTION_HD realx3 linTangentialVelocityPoint(const realx3 &p) const
Definition: vibrating.hpp:118
pFlow::vibrating::read
FUNCTION_H bool read(const dictionary &dict)
Definition: vibrating.cpp:40
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::timeInterval::inTimeRange
INLINE_FUNCTION_HD bool inTimeRange() const
Definition: timeInterval.hpp:76
pFlow::timeInterval
Definition: timeInterval.hpp:16
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
FUNCTION_HD
#define FUNCTION_HD
Definition: pFlowMacros.hpp:57
streams.hpp
pFlow::vibrating::write
FUNCTION_H bool write(dictionary &dict) const
Definition: vibrating.cpp:55
pFlow::vibrating::setTime
INLINE_FUNCTION_HD void setTime(real t)
Definition: vibrating.hpp:110
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::timeInterval::setTime
INLINE_FUNCTION_HD void setTime(real t)
Definition: timeInterval.hpp:63
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::equal
INLINE_FUNCTION_HD bool equal(const real &s1, const real &s2)
Definition: bTypesFunctions.hpp:188
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::vibrating::vibrating
FUNCTION_HD vibrating()
Definition: vibrating.hpp:98
pFlow::vibrating::amplitude_
realx3 amplitude_
Definition: vibrating.hpp:77