POV-Ray : Newsgroups : povray.advanced-users : Simplified fluid dynamics : Re: Simplified fluid dynamics Server Time
29 Jul 2024 04:25:58 EDT (-0400)
  Re: Simplified fluid dynamics  
From: Christopher James Huff
Date: 3 Dec 2002 20:21:05
Message: <chrishuff-87319E.20180303122002@netplex.aussie.org>
In article <3dec2da3@news.povray.org>, "Kevin Loney" <klo### [at] pt2mcom> 
wrote:

> I'm trying to implement some really simplified fluid dynamics in my particle
> system, and it's not working to well, my particles are accumulating
> velocities that exceed light :-P
> 
> This is how I'm trying to do it
> 
> v1, v2 = velocities of particle 1 and 2
> p1, p2 = locations of particle 1 and 2
> dt = the time step
> 
> Dist = vlength(p1-p2);
> v1 = v1 + Fluidity * (1-abs(vdot(v1, v2))) / (pow(Dist, 1/Fluidity)+1) * v1
> * dt;
> 
> so essentially I'm taking the and trying to change the direction the
> particle is moving based on how parrallel the velocity vectors are, to me
> this seems like the most logical thing to do, but I might be wrong. thanks
> for any help

You are trying to make a force on particles based on the speed of nearby 
particles? I did something like that in my particle system patch, I 
never did enough testing to figure out if it had much effect, but it 
didn't lead to "velocity explosions". What I did was use difference in 
the velocities of nearby particles with the particle velocity to compute 
a force (maybe weighted by distance)...a very different implementation 
from yours.

You take the absolute of the dot product and use it to weight the amount 
of speed added to the particle velocity, so even particles with opposite 
velocities will accelerate each other, and never affect each others 
directions. I think you meant "*v2*dt;". And you might try other 
distance weightings, a cosine falloff might work better than that 
exponential falloff. Otherwise, unlink the power from the Fluidity 
value. And vdot(v1, v2) is proportional to the sum of the lengths of v1 
and v2, you should normalize them to get the cosine of the angle.

nv1 = vnormalize(v1);
nv2 = vnormalize(v2);
v1 += Fluidity*(1 - abs(vdot(nv1, nv2)))/(pow(Dist, FalloffExp) + 
1)*v2*dt;

Actually, the whole idea of using the dot product seems wrong. The 
particles will have no effect on each other if their directions are at 
90 degrees to each other (if you normalize the velocity vectors). I 
think you woudl be better off using the relative velocities.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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