POV-Ray : Newsgroups : povray.general : But *how* to do the constant energy solution for particle physics? : But *how* to do the constant energy solution for particle physics? Server Time
3 Aug 2024 12:17:23 EDT (-0400)
  But *how* to do the constant energy solution for particle physics?  
From: Greg M  Johnson
Date: 27 Feb 2004 10:13:21
Message: <403f5e91$1@news.povray.org>
Could someone pseudo-code it out for me.

First, I'll share my non-energy conservation system that I used in my
flocking algorithm ( http://www.geocities.com/pterandon/boids.html ), and in
planetary orbiting simulations.

dt=1  (we're stepping along povray frame by povray frame)
p= vector for current position
v=velocity
a=acceleration, or sum of forces at current position (based on gravity of
sun, "repulsion" of neighbors in flock),


----- for each frame----
p2=p1+v1 *dt
a2= constant * (sum of new forces based on new location).
v2=v1+a2
--- repeat ad nauseum ---


As I've shown before, (
http://news.povray.org/povray.binaries.images/thread/%3C3A65E429.18F2DC62%40my-dejanews.com%3E/?ttop=184334&toff=4400
)

it's impossible to have a "stable orbit" with this because this model
doesn't conserve energy.  I could however probably do a 1-D case for energy
conservation quite easily.

So, in povray, how would one pseudo-code out a model that conserves energy
and accounts for multiple fields (gravity of sun *plus* other planets,
repulsion of *all* neighbors in a flock).

----- for each frame----

p2=p1+v1 *dt
a2= constant * (sum of new forces based on new location).
v2=v1+a2
KE2=constant(vlength(v2)^2)

... I'm stumped.


Post a reply to this message

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