- #1
teknix1
- 2
- 0
Hi,
First of all, thanks for taking the time to read my post.
I have started writing my own Particle System and I'm having trouble calculating where a particle would end up over a period of time.
I have decided to use 3 foces, gravity, buoyancy and drag. I also decided to skip friction, viscosity and what else... The first two I have merged into a simple equation:
Fgravbuoy = (Mp - Mf) * g
Mp is Mass of particle (kg)
Mf is Mass of fuild displaced by particle (kg)
g is acceleration of gravity (m/s²)
Now this works quite well on its own. The problems start showing when I implement the drag force:
Fdrag = CAp(v²)/2
C is drag coefficient
A is reference area (m²)
p is density of fluid my particle is going through (kg/m^3)
v is the velocity of the object relative to the fluid (m/s)
Fdrag being always opposite of velocity.
Given all this my problem is as follows, my program is updating the particle at every 1/60th of a second, now I can go through all my calculations and update the position of my particle on the screen. But the drag equation is dependant on the velocity of my particle at a specific point in time. In other words; this particle will create this much drag at this time when going at this speed. It is not calculating the amount of accumulated drag during the 1/60th of a second period. It is only giving me the current drag AT every 1/60th of a second.
So if I run my program updating the screen at every 1/120th of a second, the particle is not ending up in the same location on the screen.
Now I have no idea what the correct thing to do here is. Does anybody have a clue?
I get the impression I need to do an integral or derivative of my drag equation and use that.
I can't remember how to do this, it's been 12 years since I touched this.
Please let me know if you have noticed any errors in my post.
Thanks a lot!
Nic
First of all, thanks for taking the time to read my post.
I have started writing my own Particle System and I'm having trouble calculating where a particle would end up over a period of time.
I have decided to use 3 foces, gravity, buoyancy and drag. I also decided to skip friction, viscosity and what else... The first two I have merged into a simple equation:
Fgravbuoy = (Mp - Mf) * g
Mp is Mass of particle (kg)
Mf is Mass of fuild displaced by particle (kg)
g is acceleration of gravity (m/s²)
Now this works quite well on its own. The problems start showing when I implement the drag force:
Fdrag = CAp(v²)/2
C is drag coefficient
A is reference area (m²)
p is density of fluid my particle is going through (kg/m^3)
v is the velocity of the object relative to the fluid (m/s)
Fdrag being always opposite of velocity.
Given all this my problem is as follows, my program is updating the particle at every 1/60th of a second, now I can go through all my calculations and update the position of my particle on the screen. But the drag equation is dependant on the velocity of my particle at a specific point in time. In other words; this particle will create this much drag at this time when going at this speed. It is not calculating the amount of accumulated drag during the 1/60th of a second period. It is only giving me the current drag AT every 1/60th of a second.
So if I run my program updating the screen at every 1/120th of a second, the particle is not ending up in the same location on the screen.
Now I have no idea what the correct thing to do here is. Does anybody have a clue?
I get the impression I need to do an integral or derivative of my drag equation and use that.
I can't remember how to do this, it's been 12 years since I touched this.
Please let me know if you have noticed any errors in my post.
Thanks a lot!
Nic