# Simple fluid dynamics

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

## Recommended Posts

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.

##### Share on other sites
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.

##### Share on other sites
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.

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631722
• Total Posts
3001892
×