[ODE] Large mass and accuracy

SJS ode at pulsecode.net
Wed Jun 16 04:39:04 MST 2004


With ODE I, and I'm sure others, have verified that there is definitely a
problem of magnitude, NOT just ratios-- at least when using a single
precision build as I do.

Because I cannot easily scale my entire world (masses and sizes) to match
ODE's range of stability, I have partially worked around the problem as
follows:

My masses are large relative to 1.0, but rather than changing my masses,
I've modified the section of ODE that combines masses and the inertia tensor
to fold in a mass scale factor.  I also did similar modifications in the
joints where forces and torques are used ('fmax') and where the LCP results
are reconverted to net forces and torques.  Since the scaling can be
intercepted very early in the process, the added computation is trivial
(really-- usually a few scalar multiplies per mass in an island).  I also
store the inertia tensors with the mass divided out (kind of "normalized" by
the mass-- same as if each object's mass were 1.0) so the scaling factor can
be easily modified on the fly without really changing anything (during each
island step when the world inertia tensor is computed, it folds in the mass
and scaling factor simultaneously so the added benefit of a dynamic mass
scaling factor doesn't really cost anything).  This internal mass scaling
greatly helps the stability of my systems.  I'm currently using masses of
roughly 1000 rather than 1.0.  Without the scaling factor the system is
completely unstable, but using the scaling factor everything looks fine.

These techniques could probably be included into ODE-- I wish they weren't
necessary, but they seem very helpful to me at the moment (at least for
single precision).  Of course, this only addresses the problem due to mass
magnitude, NOT mass ratios or distance magnitudes or ratios.

I have NOT been able to find a reasonable workaround for distance magnitudes
or  ratios.  My distances are very large relative to 1.0.  This seems to be
somewhat less of an issue than large mass values, but I believe I've seen
some unphysical results due to my large distance scales.  Sadly, I don't
think rescaling all distance factors at runtime would be as computationally
trivial as rescaling the masses/forces as I described above.  If anyone HAS
tried it and succeeded, please let us know!

I'd be very interested in any ideas on how to addess these precision-related
issues, and I'll give any feedback that I can.

SJS


-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
Ignacio.Garcia at uv.es
Sent: Wednesday, June 16, 2004 2:41 AM
To: ode at q12.org
Subject: RE: [ODE] Large mass and accuracy



Hi!

The problem you're dealing with is the solution of a 'stiff system' of
differential equations.

I quoted 'stiff system' because it is the technical term for these
kind of systems.

It is definitely not a problem of magnitude, but a problem of
ratios, as someone pointed before. Notice that if both mass and force
are large, when you divide them they give you reasonable values. There
is not high loss of accuracy. But if you have one or more very small
masses compared with the largest, the the application of the forces
that arise due to the large mass lead to numerical instability. Try to
use wheels of mass 10.000 kg for a 50.000 kg car, and youls find the
problem vanishes.

I advance that the problem is an open problem. You can find many
journal articles an PhD thesis on the subject and there is not a
'good' solution.

My advice is to add another diff. eq. solver to ODE that works better
with stiff systems. Which one? well I would first perform a search in
google, then in elsevier, acm, ieee, siam... and select a proper
method.

I'm starting some research on the subject. If things go as I expect,
in a few months I'll be able to give some technical ideas on how to
solve this problem. However I insist that it is an open problem and
what works well in some cases does not in others.

Regards.

Ignacio



_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list