29#ifndef PARTICLE_MOTION_FUNCTIONS_H
30#define PARTICLE_MOTION_FUNCTIONS_H
44template<
typename T,
typename PARTICLETYPE>
48 using namespace descriptors;
49 constexpr unsigned D = PARTICLETYPE::d;
51 static_assert(PARTICLETYPE::template providesNested<GENERAL,POSITION>(),
"Field POSITION has to be provided");
52 static_assert(PARTICLETYPE::template providesNested<MOBILITY,VELOCITY>(),
"Field VELOCITY has to be provided");
53 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ACCELERATION_STRD>(),
"Field ACCELERATION_STRD has to be provided");
55 Vector<T,D> position( particle.template getField<GENERAL,POSITION>()
56 + particle.template getField<MOBILITY,VELOCITY>() * delTime
57 + (0.5 * particle.template getField<MOBILITY,ACCELERATION_STRD>() * delTime2) );
58 Vector<T,D> avgAcceleration( .5*(particle.template getField<MOBILITY,ACCELERATION_STRD>() + acceleration) );
59 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() + avgAcceleration * delTime );
61 particle.template setField<GENERAL,POSITION>( position );
62 particle.template setField<MOBILITY,VELOCITY>( velocity );
63 particle.template setField<MOBILITY,ACCELERATION_STRD>( acceleration );
66template<
typename T,
typename PARTICLETYPE>
70 using namespace descriptors;
71 constexpr unsigned D = PARTICLETYPE::d;
74 static_assert(PARTICLETYPE::template providesNested<SURFACE,ANGLE>(),
"Field SURFACE:ANGLE has to be provided");
75 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ANG_VELOCITY>(),
"Field MOBILITY:ANG_VELOCITY has to be provided");
76 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ANG_ACC_STRD>(),
"Field MOBILITY:ANG_ACC_STRD has to be provided");
79 + particle.template getField<MOBILITY,ANG_VELOCITY>() * delTime
80 + (0.5 * particle.template getField<MOBILITY,ANG_ACC_STRD>() * delTime2) );
81 Vector<T,Drot> avgAngularAcceleration( .5*(particle.template getField<MOBILITY,ANG_ACC_STRD>() + angularAcceleration) );
82 Vector<T,Drot> angularVelocity( particle.template getField<MOBILITY,ANG_VELOCITY>() + avgAngularAcceleration * delTime );
86 particle.template setField<SURFACE,ANGLE>(
88 particle.template setField<MOBILITY,ANG_VELOCITY>(
90 particle.template setField<MOBILITY,ANG_ACC_STRD>(
95template<
typename T,
typename PARTICLETYPE>
98 using namespace descriptors;
99 constexpr unsigned D = PARTICLETYPE::d;
102 static_assert(PARTICLETYPE::template providesNested<SURFACE,ANGLE>(),
"Field SURFACE:ANGLE has to be provided");
103 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ANG_VELOCITY>(),
"Field MOBILITY:ANG_VELOCITY has to be provided");
104 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ANG_ACC_STRD>(),
"Field MOBILITY:ANG_ACC_STRD has to be provided");
106 Vector<T,Drot> angle( particle.template getField<SURFACE,ANGLE>() + angVel * delTime);
112 particle.template setField<SURFACE,ANGLE>(
114 particle.template setField<MOBILITY,ANG_VELOCITY>(
116 particle.template setField<MOBILITY,ANG_ACC_STRD>(
121template<
typename T,
typename PARTICLETYPE>
127 T delTime2 = delTime*delTime;
141template<
typename T,
typename PARTICLETYPE>
146 using namespace descriptors;
147 constexpr unsigned D = PARTICLETYPE::d;
149 static_assert(PARTICLETYPE::template providesNested<GENERAL,POSITION>(),
"Field POSITION has to be provided");
150 static_assert(PARTICLETYPE::template providesNested<MOBILITY,VELOCITY>(),
"Field VELOCITY has to be provided");
152 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() + acceleration * delTime );
153 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() + velocity * delTime );
155 particle.template setField<GENERAL,POSITION>( position );
156 particle.template setField<MOBILITY,VELOCITY>( velocity );
161template<
typename T,
typename PARTICLETYPE>
166 using namespace descriptors;
167 constexpr unsigned D = PARTICLETYPE::d;
169 static_assert(PARTICLETYPE::template providesNested<GENERAL,POSITION>(),
"Field POSITION has to be provided");
170 static_assert(PARTICLETYPE::template providesNested<MOBILITY,VELOCITY>(),
"Field VELOCITY has to be provided");
172 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() + acceleration * delTime );
173 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() + velocity * delTime );
174 Vector<T,3> velocity_tmp ( particle.template getField<MOBILITY,VELOCITY>());
175 Vector<T,3> position_tmp (particle.template getField<GENERAL,POSITION>());
176 if(periodicity[0] == 1)
179 position[0] = position_tmp[0];
187 else if (periodicity[1] == 1)
190 position[1] = position_tmp[1];
198 else if (periodicity[2] == 1)
201 position[2] = position_tmp[2];
210 std::cout <<
"No discrete normal in direction of coordinate axis" <<std::endl;
212 particle.template setField<GENERAL,POSITION>( position );
213 particle.template setField<MOBILITY,VELOCITY>( velocity );
217template<
typename T,
typename PARTICLETYPE>
222 using namespace descriptors;
223 constexpr unsigned D = PARTICLETYPE::d;
226 static_assert(PARTICLETYPE::template providesNested<SURFACE,ANGLE>(),
"Field SURFACE:ANGLE has to be provided");
227 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ANG_VELOCITY>(),
"Field MOBILITY:ANG_VELOCITY has to be provided");
229 Vector<T,Drot> angularVelocity( particle.getMobility().getAngularVelocity()
230 + angularAcceleration * delTime );
231 Vector<T,Drot> angle( particle.getSurface().getAngle() + angularVelocity * delTime );
233 particle.template setField<SURFACE,ANGLE>( angle );
234 particle.template setField<MOBILITY,ANG_VELOCITY>( angularVelocity );
237template<
typename T,
typename PARTICLETYPE>
252template<
typename T,
typename PARTICLETYPE>
255 Vector <T,PARTICLETYPE::d> fluid_vel )
258 using namespace descriptors;
259 constexpr unsigned D = PARTICLETYPE::d;
261 static_assert(PARTICLETYPE::template providesNested<GENERAL,POSITION>(),
"Field POSITION has to be provided");
262 static_assert(PARTICLETYPE::template providesNested<MOBILITY,VELOCITY>(),
"Field VELOCITY has to be provided");
264 if (acceleration[0]!=0){
265 T tau_p0 = 1./(acceleration[0])*(fluid_vel[0]-particle.template getField<MOBILITY,VELOCITY>()[0]);
266 Vector<T,D> velocity( fluid_vel+ std::exp((-delTime/tau_p0))*(particle.template getField<MOBILITY,VELOCITY>()- fluid_vel));
267 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() + delTime*(fluid_vel) + tau_p0*(1- std::exp((-delTime/tau_p0)))*(particle.template getField<MOBILITY,VELOCITY>()-fluid_vel));
269 particle.template setField<GENERAL,POSITION>( position );
270 particle.template setField<MOBILITY,VELOCITY>( velocity );
272 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() + delTime*particle.template getField<MOBILITY,VELOCITY>());
274 particle.template setField<GENERAL,POSITION>( position );
constexpr bool providesSurface()
Provides group SURFACE.
void eulerIntegration(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > acceleration, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angularAcceleration)
void velocityVerletRotor(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > angVel)
void eulerIntegrationRotation(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angularAcceleration)
void velocityVerletTranslation(Particle< T, PARTICLETYPE > &particle, T delTime, T delTime2, Vector< T, PARTICLETYPE::d > acceleration)
void analyticalTranslation(Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > acceleration, T delTime, Vector< T, PARTICLETYPE::d > fluid_vel)
void velocityVerletRotation(Particle< T, PARTICLETYPE > &particle, T delTime, T delTime2, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angularAcceleration)
void eulerIntegrationTranslation(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > acceleration)
Euler integration.
void velocityVerletIntegration(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > acceleration, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angularAcceleration)
void eulerIntegrationTranslationPeriodic(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > acceleration, Vector< int, PARTICLETYPE::d > periodicity)
Euler integration.
ADf< T, DIM > fmod(const ADf< T, DIM > &a, const ADf< T, DIM > &b)
Top level namespace for all of OpenLB.
Converts dimensions by deriving from given cartesian dimension D.