Jump to content
  • Advertisement
Sign in to follow this  
Numsgil

Drag in a liquid

This topic is 4881 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a simulation where the user can set different rates for friction and drag for spheres moving through an undetermined medium. The friction works as though the spheres were sliding across the medium, and I have equations and controls for that all worked out. Where I'm having difficulty is in working out a model for drag. I'm assuming drag through a liquid. I'd like the user to be able to set the basic constants for an equation. So far I've managed to find Stokes Drag Equation (?) which is Force = 6pi *(viscosity)* Radius * velocity. But I understand this doesn't work under all circumstances (something about Oseen's equation?) And I get incredibly large values for the force when I plug it in, so I need to know a good range for viscosity. Most resources I can find for this are practice tests, so you can imagine I'm feeling a little confused and overwhelmed. Does anyone have any experience in this area?

Share this post


Link to post
Share on other sites
Advertisement
Stoke's Equation for laminar motion, where the force that is resisting motion is given as you stated, yes. When a resistive force felt is porportional to speed the equation of motion is ma(t) = -bv(t). However you could make things a bit easier for yourself. For example we have a(t) = -b/m*v(t) when we divide through by mass. Working this into a body in motion through a viscous liquid we have a(t) = g - b/m * v(t) or a(t) + b/m *v(t) = g. This sets it up for a method that is very similar to what is in Lengyel's book but not as simple. So I will simply borrow from him.

In Lengyel's book an approximation for the forces felt and the resulting motion through a resistive medium is given by:

mg - mkv(t) = ma(t). Simple, the solving of the differential equation results in:

x(t) = g/k * t + (kv0 - g / k2 )(1 - e-kt) + x0 where you can modify k to adjust the resistance felt and v(t) = g/k + (v0 - g/k)e-kt. Ive not implemented this so I suggest you experiment. Notice that his k is my b/m and is the damping constant.

Note also that the reason this is an ideal case is because there will always be other influencing forces invloved and such a simple scenario is practically unencouterable.

Share this post


Link to post
Share on other sites
Thanks for your help. Is the g gravity? Perhaps you could define some of the variables you used (just so I'm sure I understand what your equations are talking about).

Since the simulation is run in discrete steps, how should I simulate the order of action and reaction.

For instance, say one of the circles tries to move with a force of X in one cycle. Should drag be considered for the end velocity of the impulse before the velocity is actually finalized?

Share this post


Link to post
Share on other sites
I apologize for being so terse.

When a moving object feels a force that is in oppisition to its motion and porportional to its velocity then equation of motion can be given as ma = -bv or ma + bv = 0. b here is a property of the object that tells about the surface of that object and how fluids move around it. This property can be measured in wind tunnels. For an object in a gravitational field this can be further rewritten as ma + bv = mg or ma = mg - bv. Where mg is the gravitational force. Dividing through by the mass we get a = g - (b/m) * v thus we can rewrite this as the differential equation: a + (b/m) * v = g.

Lengyel gives the solution as:

x(t) = (g/k) * t + ((kv0 - g) / k2 )(1 - e-kt) + x0 where k, the damping constant, can be adjusted to affect the resistance felt and x(t) is position based on an input time. As I said it looks like k = b/m and b is based on the nature of the surface of the object and can be found by placing the object in a wind tunnel. Fortunatley though, using stoke's equation for laminar motion through a viscous liquid for the sphere, I believe b = 6πηr.

No need to calculate impulses as we are doing the simple case. You can use that equation for position as is.

Share this post


Link to post
Share on other sites
Actually, in liquids, aside of drag, there's also effect of so-called added mass (unsure if it's correct English term). It is especially essential for convincing object-fall-into-water simulation, but could be important there as well. For example if you simulate things with very small own mass (bubble), and don't take added mass into account, you get insane values for acceleration at first step.

Also, don't forget about buoyancy, too.

So, equation becomes:
m*a + volume*density*addedmass_constant*a + velocity*drag_constant = external_forces + m*g - volume*density*g
so we have
a = (external_forces + m*g - volume*density*g - velocity*drag_constant) / (m + volume*density*addedmass_constant)

where m*g - volume*density*g is just weight force plus buoyant force, g is vector pointing down equal to free fall acceleration, and a is acceleration of our object.

Addedmass_constant is around 1.something , I believe .

When using some solution, you could need to use (m + volume*density*addedmass_constant) as mass of object.

(no analitic equation about liquid are really precise in real world, of course, and this added mass thing is approximation as well.)

There was thread on similar topic some time ago.

Additional note: Drag proportional to velocity could lead to simulation instabilities, but fortunately it is simple enough to compute that semi-analitically.
If dv/dt=-o*v , then v=v0*exp(-o*t)
there, o is drag_constant/mass
So, for timestep dt instead of doing
v-=dt*v*drag_constant/mass
you can
v*=exp(-dt*drag_constant/mass)
(It's assuming you have some other forces and will have to inegrate it)

Share this post


Link to post
Share on other sites
Looking at my fluid dynamics notes, the added mass is m* = 1/2*(density of fluid)*(volume of sphere)

In my notes it's derived by calculating the velocity potential, then the pressure and then integrating across the sphere. Although before I looked at my notes I would have just done it by considering the energy of the system.

Either way, the effect of 'added mass' is more important than drag in most cases. But then I would say that because in the course I've done it's all inviscid flows.

Share this post


Link to post
Share on other sites
Yes, my 1 or 1.5 was probably exaggregated... I remember some homework problem with cocentric spheres and liquid between 'em.
Speaking of effect of added mass, it is very important for accelerating body but not for body that is moving with constant velocity.

Share this post


Link to post
Share on other sites
So for the algorithm, this would be a good order: (?) (keep in mind for friction I'm pretending the bots are in a flat world with gravity pointing in towards the screen, and for drag I'm pretending they're in a fishbowl like environment with gravity pointing along the y axis of the screen. It's a magic medium.)

1. Calculate Drag and Friction and other resistive forces based on current relative velocity. Store these in an acceleration vector.
2. Add external forces to the acceleration vector.
3. Calculate added mass and static friction (only if velocity = <0,0>) to see if the sphere has sufficient force to change velocity. If it does, then change the sphere's velocity with acceleration vector - static and added mass forces.
4. Zero out the acceleration vector.
5. Check for and correct collisions between spheres.
6. Move the spheres.

Is that right? Or am I missing a step or placing something out of order?

Share this post


Link to post
Share on other sites
since the added mass is due to the mass of boundary layers that get dragged along, i think the most important factor to take into account is surface area.

Quote:

Looking at my fluid dynamics notes, the added mass is m* = 1/2*(density of fluid)*(volume of sphere)

that surprises me. what does the inner goemerty have to do with the outside flow?

also, using surface area is plausible cuase it has the desired effect of being significant on small objects whilst being insignificant on large objects.

area*mu*rho*someconstant would most probably do fine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!