Friday, October 20, 2017

newtonian mechanics - Update velocity or position first in computation?


I am trying to make a simulation of a vibrating string. The string is divided into n points, and each point along the string is acted upon by a force due to the positioning of its neighbors.


I eventually have to update both velocity due to acceleration, and position due to velocity at each point, but the two are dependent on each other.


Is there a physically correct order in which to update position and velocity?



Answer



The physically correct order would be at the same time. This can be done via xn+1=xn+vnΔt+12anΔt2vn+1=vn+12(an+an+1)Δt

where an=F(xn) with n the time-step index.


However, what is done more often is called the Leapfrog scheme in which you update positions and velocities at offset intervals: xn+1=xn+vn+12Δtan+1=F(xn+1)vn+32=vn+12+an+1Δt

Here, the fractional n can be thought of the "cell wall" value (e.g., xi+12=12(xi+xi+1)) but in time instead of space.



No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...