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;
131 if constexpr ( access::providesSurface<PARTICLETYPE>() ) {
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 );
159template<
typename T,
typename PARTICLETYPE>
164 using namespace descriptors;
165 constexpr unsigned D = PARTICLETYPE::d;
168 static_assert(PARTICLETYPE::template providesNested<SURFACE,ANGLE>(),
"Field SURFACE:ANGLE has to be provided");
169 static_assert(PARTICLETYPE::template providesNested<MOBILITY,ANG_VELOCITY>(),
"Field MOBILITY:ANG_VELOCITY has to be provided");
171 Vector<T,Drot> angularVelocity( particle.getMobility().getAngularVelocity()
172 + angularAcceleration * delTime );
173 Vector<T,Drot> angle( particle.getSurface().getAngle() + angularVelocity * delTime );
175 particle.template setField<SURFACE,ANGLE>( angle );
176 particle.template setField<MOBILITY,ANG_VELOCITY>( angularVelocity );
179template<
typename T,
typename PARTICLETYPE>
187 if constexpr ( access::providesSurface<PARTICLETYPE>() ) {
194template<
typename T,
typename PARTICLETYPE>
197 Vector <T,PARTICLETYPE::d> fluid_vel )
200 using namespace descriptors;
201 constexpr unsigned D = PARTICLETYPE::d;
203 static_assert(PARTICLETYPE::template providesNested<GENERAL,POSITION>(),
"Field POSITION has to be provided");
204 static_assert(PARTICLETYPE::template providesNested<MOBILITY,VELOCITY>(),
"Field VELOCITY has to be provided");
206 if (acceleration[0]!=0){
207 T tau_p0 = 1./(acceleration[0])*(fluid_vel[0]-particle.template getField<MOBILITY,VELOCITY>()[0]);
208 Vector<T,D> velocity( fluid_vel+ std::exp((-delTime/tau_p0))*(particle.template getField<MOBILITY,VELOCITY>()- fluid_vel));
209 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));
211 particle.template setField<GENERAL,POSITION>( position );
212 particle.template setField<MOBILITY,VELOCITY>( velocity );
214 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() + delTime*particle.template getField<MOBILITY,VELOCITY>());
216 particle.template setField<GENERAL,POSITION>( position );
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)
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.