← Back to team overview

yade-users team mailing list archive

Re: How to reset a body's velocity?

 

> What/why do you want to do exactly?
Unloaded particles (from hopper, silo, etc...) should be loaded back with 0 initial velocity.

> I don't really understand the problem. Can't you just set p->velocity = 
> 0 somwhere in the code

No, because a integrator will set back the old value.
Currently, the veloctiy can not be changed outside integrator.

I propose the following (inspired by Lionel):

To declare the parameter /bool resetVelocity/ in 
"ParticleParameter". If resetVelocity=true a intergator should set the velocity as first time.
And add these lines in LeapFrogPositionIntergator" and "NewtonsDampedLaw":

    ParticleParameters * p = YADE_CAST<ParticleParameters*>(b.get());

/    if (p->resetVelocity)
    {
	firsts[id]=true;
	p->resetVelocity=false
    }/

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

We can even abandon "firsts" and use resetVelocity instead...
For angular velocity similar flag should be added in RigidBodyParameters...

Are there any thoughts about this?

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



Follow ups

References