← Back to team overview

yade-users team mailing list archive

Re: How to reset a body's velocity?

 

> Your solution would do the job, but it will add useless operations for 
> all users.
> 
No, if replaced

/     if (!firsts[id])/
         p->velocity = prevVelocities[id]+((Real)0.5)*dt*p->acceleration;
     ... 
     prevVelocities[id] = p->velocity+((Real)0.5)*dt*p->acceleration;
     ...
/     firsts[id]=false/

by

 /    if (!p->resetVelocity)/
         p->velocity = prevVelocities[id]+((Real)0.5)*dt*p->acceleration;
     ... 
     prevVelocities[id] = p->velocity+((Real)0.5)*dt*p->acceleration;
     ...
/     p->resetVelocity=false/

and the array "firsts" is unnecessary...
and appears a simple mechanism for re-initializing any integrator...

>Actually, the fact that prevVelocities are inside the integrator could 
>be considered a flaw in design...

Hmm... As me seems, prevVelocities is specific for leapfrog method.
For another integrator may be another implementation (Gear predictor-corrector as example...)

-- 
Best regards, Sergei D.
_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users



Follow ups

References