Curious damping

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Curious damping

Postby Shredd0r » Fri Apr 08, 2011 10:09 am

Hi everyone,
I'm new with Newton and have a problem that might be fixed very quick but I am spending some hours on it yet.

On my computer I get 3000 an more fps with the tutorial's (they are great thx for publishing). I altered one of them so that there is just one box moving with a starting velocity without gravity from left to right (not touching anything, it should be just free endless flying).
This is no problem on an old computer who gets just around 20 fps but on the new one with over 3000 the box becomes slower and slower and finally stops. The only difference is the performance of the used computer so I assumed it might have something to do with the extremely high framerate.

I also looked at the demo's code where the framerate seems to be fixed at 60fps but I couldn't get it how this is done. Maybe Qt does it?

Thanks to everyone who have read this
Shredd0r
 
Posts: 10
Joined: Fri Apr 08, 2011 9:53 am

Re: Curious damping

Postby Julio Jerez » Fri Apr 08, 2011 5:36 pm

It is the QT framework, tha is not designed for real time. basically Qt is for not real time app and I had to do few things to make it work for the realtime demos.
I too seen 3000 fpos is oen system, and then afte I chanhe my mtehboard to the new Intell CPU, I can no get hight that 4, or 500 hunder fps even wi teh same vidao car better cpu adn same win7.
It is a real mistery to me. Key controls is also a diffcul arae for Qt and real time are very tricky to get around, the implementation leads to different behavior on different systems.
It also varies greatlly for different version of Window, it may be good on win7 but not very good on win64 or xp.

Qt is great for appliciation like Game editors, browser or game utilities. But it is not very good for realtime Games.
if you do no use Qt you should no worry about that.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Curious damping

Postby Shredd0r » Mon Apr 11, 2011 8:50 am

Thanks for the answer :)

The problem appears in a standard tutorial which is not using Qt (the Tutorial_104_RayCastAndConvexCast one), with the Qt-demos it works very fine.

In the demos using Qt I could'nt find where you are controlling the framerate but I found a way that might work good. It's from a Qt demo (2D Painting) they are doing it this way

QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), glWidget, SLOT(animate()));
timer->start(50);

I dont't know what will happen using this if the framerate falls below the given interval.
Shredd0r
 
Posts: 10
Joined: Fri Apr 08, 2011 9:53 am

Re: Curious damping

Postby Shredd0r » Mon Apr 11, 2011 9:40 am

I made some tests recording the position data and even in free space there orrurs a damping effect. On the slow computer it just takes a lot more time. I want to create a physical simulation so I am using the highest accuracy level 0.

What kind of integration sceme is used there? My results are looking like some kind of implicit sceme what can of course not be.^^
Shredd0r
 
Posts: 10
Joined: Fri Apr 08, 2011 9:53 am

Re: Curious damping

Postby Julio Jerez » Mon Apr 11, 2011 11:13 am

when you refer to damp, are you talking slow down of the frame rate?
or are you taking about velocity based damping?

if it is velocity base damping, you can set angular and linear Damp on body creation, the default is 0.1 and is based of the velocity of the body not the force action on it.

if it is framerate slow down because solver mode 0, if you use solver 0 then you are using a solver that uses a my own version of Linear Search Conjugate Gradient Descend Algorithm for solving the constraint forces.
This method is very powerful and accurate but it can degenerate into a O(n3) iterations.

for faster performance you can use solver 1, that will use my own iterative RK4 Gauss Siedel solver and will lead to reliable performance and comprosied accuracy.
for better accuracy you can set solver 4 or higher, the higher the value the more passes in the internal RK4 subsets with take.
but the convergence decreases asymptotically wit teh number of passes, threfore a value larger than 8 or maybe 10 does not do much better than a value of 4 or 5
if masses ratios are within similar order of magnituds,
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Curious damping

Postby Shredd0r » Tue Apr 12, 2011 8:16 am

Ah a default damping :)

Thank you for your patience. I have some ideas about the theory behind computer simulations but not much experience with using it.
A default damping makes sense but I would'nt have thought of something like this.

I also got the framerate doing what it should, just used something like your frame logger that was disabled by default.
Shredd0r
 
Posts: 10
Joined: Fri Apr 08, 2011 9:53 am

Re: Curious damping

Postby Shredd0r » Thu Apr 14, 2011 6:23 am

Hm now without damping if I let a box just bounc with default elasticity 1.f the bouncing gets higher and higher :/

Do you know a damping value, that negates that perfectly? I'm not sure how that could be calculated but I think it had something to do with eigenvalues that can be build from the integration sceme.
Shredd0r
 
Posts: 10
Joined: Fri Apr 08, 2011 9:53 am

Re: Curious damping

Postby Julio Jerez » Thu Apr 14, 2011 6:42 am

if you set damping to zero, there is no energy extarte form teh system during the integration.
if you set Elaticity to 1.0 that mean the collison are conservative, and not moemnetum is extracted whne the body collide.
The net resutl is that the bodies will gain smal ampint of energy in each time step, it is teh penalry we must paid for integration a secund order difrencail equation with a linar approximation.

you can not solve that in any way ote hthat havein a smaller tiem step so that teh error is smaller but never zero.

The only way you can solve that is by using a close form integration, which can only be applied to very small set fo equations.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron