Implementing Runge Kutta integrators in existing engine

Started by
14 comments, last by d000hg 19 years, 6 months ago
I've used the array states as described in one of baraffs lecture notes.

Now i have just two sets of structs and use that together with a compute force function. Chris Hecker uses an index to a target and source array. I'm just copying everything over now.

I'm no expert so i don't know if this is better or not.
Advertisement
Quote:Original post by grhodes_at_work
Not really. If you're talking about just reversing the update so that you update velocity first, then position...that's NOT implicit Euler. The velocity update is still explicit Euler. A true implicit method creates a system of simultaneous equations in which all unknowns are solved for simultaneously by solving the system of equations either via something liks Gaussian elimination or an iterative technique such as Jacobi or Gauss-Siedel iteration...not a simple change. RK2 is a way simpler change than any implicit method.


Whoops sorry - that is what I meant.
What exactly does this do then? It seems to work for me and cured the instabilities I had... probably at great expense to accuracy, although it fits my requirements.
I think this tutorial by Marco Monster is pretty good.
Achieving a stable simulator
<-Sweenie->
Quote:Original post by Sweenie
I think this tutorial by Marco Monster is pretty good.
Achieving a stable simulator


If by "pretty good" you mean "vague, confusing, and lacking important details as to how it actually works", then yes, I agree.
I read that a few dozen times in my attempts to make RK4 work, and it always confused me more. What is a CalcDerivitives function and how does it work? Why bother? What is a solutionVector? Why make things so over-complicated, especially when the goal is to teach other people how to do something? Sometimes examples seem to be more interested in creating code that looks elegant and can be used in 47,000,001 situations, instead of something solid and reliable that fits exactly what you need. Darn show offs.

here's an example of an rk4 integrator.

I've used formulas from Kreyzig, Mathematical engineering or something like that.
Well RK2 basically entails generating a new state at time=t+dt/2 from the previous one at time=t using Euler methods, then getting the forces on this state and using them to generate a state at time=t+dt from the initial state. So you do two actual world updates. Is this more accurate than just doing Euler on a dt/2 timestep - CombatWombat I'd be keen to hear what timesteps you used before/since switching to RK4.

This topic is closed to new replies.

Advertisement