Simulation frequency
2 posts • Page 1 of 1
Simulation frequency
Just a couple of observations on the simulation frequency.
The code from this post: http://www.algodoo.com/forum/viewtopic.php?f=16&t=10066 seems to be an example that doesn't work at all with frequency 60 but works fine with frequency 100.
This code requires frequency around 10000 to get an approximation to the closed trajectory (I know that it can be simulated using the attraction property):
Also, it's difficult to model a conservative system that involves a wheel rolling without slipping or a solid swinging on a hinge. If I just have a rectangle on a hinge, turn off the air friction, let the rectangle swing freely and plot its total energy, it shows a linearly decreasing trend. A higher frequency makes the linear decrease coefficient smaller.
The code from this post: http://www.algodoo.com/forum/viewtopic.php?f=16&t=10066 seems to be an example that doesn't work at all with frequency 60 but works fine with frequency 100.
This code requires frequency around 10000 to get an approximation to the closed trajectory (I know that it can be simulated using the attraction property):
- Code: Select all
Scene.Clear;
Sim.gravitySwitch=false;
Sim.airSwitch=false;
Scene.my.atan2=(v)=>{
v(0)==0?
{math.pi*(v(1)>0?(.5):(-.5))}:
{math.atan(v(1)/v(0))+(v(0)>0?0:math.pi)}};
Scene.my.sun=Scene.addCircle({pos=[0,0];radius=.1;geomID=1});
Scene.addFixJoint({geom0=1;geom1=0;geom0pos=[0,0]});
Scene.my.earth=Scene.addCircle({pos=[2,0];radius=.1;density=1/(.01*math.pi);vel=[0,1];geomID=2});
Scene.addThruster({geom=2;relPoint=[0,0];followGeometry=false;
_r = {Scene.my.sun.pos-Scene.my.earth.pos};
rotation={Scene.my.atan2(_r)};
force={5/(_r(0)^2+_r(1)^2)}});
Scene.addPen({geom=2;relPoint=[0,0];size=.01;fadeTime=30})
Also, it's difficult to model a conservative system that involves a wheel rolling without slipping or a solid swinging on a hinge. If I just have a rectangle on a hinge, turn off the air friction, let the rectangle swing freely and plot its total energy, it shows a linearly decreasing trend. A higher frequency makes the linear decrease coefficient smaller.
- lancelot
- Posts: 5
- Joined: Wed May 29, 2013 3:17 am
Re: Simulation frequency
energy is lost in the stretching of the hinge as it swings, a higher sim frequency reduces the amount of stretch required to hold the object to the hingelancelot wrote:Also, it's difficult to model a conservative system that involves a wheel rolling without slipping or a solid swinging on a hinge. If I just have a rectangle on a hinge, turn off the air friction, let the rectangle swing freely and plot its total energy, it shows a linearly decreasing trend. A higher frequency makes the linear decrease coefficient smaller.
- jon_joy_1999
- Posts: 233
- Joined: Fri Dec 09, 2011 12:51 am
2 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest