POV-Ray : Newsgroups : povray.off-topic : The Unintended consequence of "fixing" a physics timestep : Re: The Unintended consequence of "fixing" a physics timestep Server Time
2 Nov 2024 16:11:58 EDT (-0400)
  Re: The Unintended consequence of "fixing" a physics timestep  
From: triple r
Date: 14 Apr 2008 14:55:00
Message: <web.4803a87847a4b4f1ae42298f0@news.povray.org>
"Chambers" <bdc### [at] yahoocom> wrote:
> So, playing with particles recently, I noticed a small* problem.
>
> "Fixing" your timestep, such that it is always processed in increments of some
> arbitrary value, greatly increases the quality of your simulation.  When dt
> seconds have passed, and your timestep is the arbitrary value ts, then
>
> while (dt > ts)
>   step(ts)
>   dt -= ts
>
> The fun part comes up when the time required to do a simulation step is greater
> than the time stepped (ts).  This situation results in a negative feedback
> loop; the greater dt is, the more steps you must take, meaning dt for the next
> frame will be even greater, meaning even more steps must be taken, meaning...

Isn't that more of a positive* feedback loop, where a perturbation reinforces
itself?

I didn't figure out the problem until the next paragraph until I figured out
we're talking real-time.  Have you thought about adaptive timestepping to
alleviate the problem of selecting an appropriate timestep?  Do an RK4 step and
an Euler step with the same initial conditions.  Compare the results, perhaps
excluding particles which have just collided.  Just (x_rk4 - x_euler) / dx.  If
the relative error is larger than some tolerance, subdivide the timestep.  If
it's too small, then double it.  Try it every ten steps, for example, and make
sure the timestep isn't much smaller than what you could be using.

- Ricky

*for some definition of positive.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.