# Physics Simulation Forum

 Page 1 of 1 [ 8 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: force and torque calculation in Runge_kuttaPosted: Sat Dec 05, 2009 1:47 pm

Joined: Sat Dec 05, 2009 1:05 pm
Posts: 2
Hi there,

I'd like to write a game engine and preparing myself for it now.

I am reading Baraff's Siggraph tutorials (Rigid body simulation I -- unconstrained rigid body dynamics) now, here is my question:

when performing numeric integration of the motion equation using 4th order Runge-Kutta method, the calculation of k1, k2, k3 and k4 requires me to evaluate the force and torque, i.e.

k1 = h * f(y0, t0)
k2 = h * f(y0 + k1/2, t0 + h/2)
k3 = h * f(y0 + k2/2, t0 + h/2)
k4 = h * f(y0 + k3, t0 + h)

where, the motion equation is dy/dt = f(y, t) = (v, 0.5wq, force, torque).

My question is how to calculate the forces and torques for the state variables y0+k1/2, y0+k2/2, and yo+k3 ?

many thanks.

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Wed Dec 16, 2009 8:56 pm

Joined: Mon Oct 12, 2009 6:23 pm
Posts: 39
To be strictly correct, the forces and torques would depend on the intermediate object states, so you would have to go all the way back out and calculate the various contacts, collisions, friction, and all other forces/torques in your problem at with the new intermediate states.

Which, practically, doesn't work. So you could do something like hold your forces and torques constant across all the intermediate computations (use the initial values).

Then you really aren't solving the whole system at fourth order, but at least you will be solving the internal dynamics porition of the equations at fourth order (which will make your gyroscopic stability, for instance, much better).

Its basically a form of operator splitting....

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Fri Dec 25, 2009 8:17 pm

Joined: Tue May 06, 2008 8:23 pm
Posts: 9
I disagree dneckels. The forces and torques are not changing, or at least not changing enough to be outside the required approximation limits, they will be effectively constant over the whole t-zero to h period, so it isn't a problem to keep them so over the whole duration in the computation itself. This holds as long as your timestep is appropriate, whether fixed at short enough intervals or chosen adaptively with regards to error propagation.

If you have a contact or force change happen before time h -- that is an external influence and a single RK4 step isn't meant to deal with those. We need to determine and resolve that externally generated change, find the new forces, and then begin evaluating from that new set of states.

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Sun Dec 27, 2009 12:09 am

Joined: Mon Oct 12, 2009 6:23 pm
Posts: 39
Well, I think we're saying partially the same thing: that its ok to keep the forces and torques constant over the time step.
For contact/friction/collision forces its probably ok for another reason: these are generally non smooth forces, so higher order integration won't help anyway: it could actually hurt and introduce oscillations.

In my solver I lower the order to verlet once I have contact/collision forces, but keep the RK4 for bodies on a free trajectory. Found it helped with the gyroscopic stability quite a lot.

cheers

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Mon Dec 28, 2009 2:37 pm

Joined: Tue Feb 20, 2007 4:56 pm
Posts: 190
If you want gyroscopic stability, the best methods are by Samuel R. Buss:

http://euclid.ucsd.edu/~sbuss/ResearchW ... /paper.pdf

He shows that RK4 is actually only 2nd order accurate for rotating rigid bodies, and presents much more accurate and efficient algorithms for doing so.

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Tue Dec 29, 2009 9:47 pm

Joined: Mon Oct 12, 2009 6:23 pm
Posts: 39
Thanks, will look at the paper.
Noticed that even RK2 is enough to provide decent gyroscopic stability, so not suprised RK4 is overkill....

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Mon Jan 04, 2010 11:44 pm

Joined: Mon Jan 04, 2010 8:47 pm
Posts: 1
Lately, I have been dealing with the same question as the OP. What exactly do you mean by keep the forces and torques constant across all intermediate computations? Does this basically mean you'd only be accounting for the change in velocity? This does not sound like it would be more stable than an euler integrator. Am I missing something or is that really the case?

Top

 Post subject: Re: force and torque calculation in Runge_kuttaPosted: Wed Jan 13, 2010 3:59 pm

Joined: Mon Oct 12, 2009 6:23 pm
Posts: 39
Agreed, this method is at most first order if your forces are nonzero and depend on the bodies state.
But think of the case, for instance, of free fall. The only force is gravity, which is constant anyway. So the method would still be 4th order.
The extra stability comes from integrating the gyroscopic nonlinearity at higher order (Euler blows up if the object is spinning).

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 8 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities