|
|
"scott" <sco### [at] laptopcom> wrote:
> If I am guessing correctly, "particles_stepped" includes velocity
> information? Well you need to keep 4 separate copies of the velocity
> information just like you did with the force information.
>
> > for (int i=0; i<size; i++) {
> > forces_final[i] =
> > (forces_now[i]+2*forces_A[i]+2*forces_B[i]+forces_C[i])/6.0f;
>
> Then you need to calculate the weighted sum of the velocities in this manner
> too here, and use the weighted velocity in the final step call.
Sorry, but I have trouble believing that without seeing a proof. Intuitively,
if I am tracking the velocity information, then why do I need the force
information separate? But if I integrate the forces, why should the velocity
information be separate? What I want is a final force value that I can use to
modify my velocity value.
Anyway, looking for other sources on RK4, the Wikipedia article at
http://en.wikipedia.org/wiki/RK4 mentions something that was left out here...
that the weighted average of the forces should be multiplied by the timestep.
That would change the above line to
(forces_now[i]+2*forces_A[i]+2*forces_B[i]+forces_C[i])*dt/6.0f;
This would account for the strange scaling effect I saw. When I get home
tonight, I'll try it out.
......Chambers
www.pacificwebguy.com
Post a reply to this message
|
|