Skip to main content
GameDev.net gamedev.net
🔒 Locked

Simple fluid dynamics

Started by Plasmadog Nov 23, 2006 at 9:25 PM 1 replies 2.5k views
Original Post
Plasmadog
Plasmadog
Hi all. I came across this old thread that intrigued me: http://www.gamedev.net/community/forums/topic.asp?topic_id=313131&whichpage=1� I'd really like to try out the system that John Schultz describes there, but the description is a bit high level, and it loses me at step 6d. Can anyone point me to any source code that implements a system like that? Or failing that, could someone elaborate on step 6d? Thanks.
You are not the one beautiful and unique snowflake who, unlike the rest of us, doesn't have to go through the tedious and difficult process of science in order to establish the truth. You're as foolable as anyone else. And since you have taken no precautions to avoid fooling yourself, the self-evident fact that countless millions of humans before you have also fooled themselves leads me to the parsimonious belief that you have too.--Daniel Rutter
erissian
erissian
Quote:
6d. Given the curPos velocity and curNormal, you can now compute fluid interaction: e.g. flat plate force => 1/2*rho*V^2*angle applied in the direction of curNormal, surface/parasitic drag (in the direction of velocity projected to the plane defined by curPos and curNormal). This step will introduce drag/damping so that more complicated methods (such as dealing with rotational fluid effects and associated energy loss) aren't necessary for realistic looking behavior. Forces are added for each FluidSample (point of application: curPos):


Fluid resistance is usually taken against the cross sectional area of an object. The cross section is taken on the plane perpendicular to the velocity. In this case, it looks like he is dividing the hull into several equal chunks of area, in other words the polygons of the mesh.

Assuming that each polygon has an area of 1, you can find it's cross sectional area by taking the dot product of the polygon's normal and the velocity's normal.

In general, fluid resistance can be defined as the force:
F = -c1V -c2V2 ...
The force is applied in the direction of V.

There is a point in most fluids where the fluid becomes turbulent due to the velocity of the object, at which point V2 strongly dominates the force. Below that point (Reynolds Number,) the V term dominates. In the case of a boat in water, it's very likely to be the square term.

In this case the constant is represented by:
c2 = ½ρV2A

But because he's assuming that the polygons are all of equal area, he let's that term become:
A = N⋅V/|V|
Where N is the polygon's normal, and V/|V| is the velocity's normal.

ρ is the density of the fluid, in this case water.

"angle" was probably a little misleading as a variable name.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
John Schultz
John Schultz
Example code here.

angle is a dot product between the fluid velocity at the sample point and the surface normal. The force direction in the simple case is applied in the direction of the surface normal. The example code includes an efficiency term to allow elimination of induced drag. Skin or surface drag can also be added: the force is applied opposite fluid velocity in the plane of the surface normal at the sample point. In the case of a simple boat, applying skin drag regardless of angle will also work OK: force direction is opposite sample point velocity.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.