# Drag and Lift per triangle (boat simulation)

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

## Recommended Posts

Hi I am doing high speed boat simulation (as i wrote in some threads before). For bouyancy forces calculation i use spherical approximation it works OK. But for drag and lift I found out that spherical approx. in not enough... I decided to use triangular convex hull for lift and drag calculation. For now i do it like this: Every frame i cut predefined triangular approximation hull(boat hull) by water plane so i get new hull that is completly under water and store each triangle in array pWSubTriHull. This also works OK. Calculation of lift and drag:
//---------------------------------------------------------------------------
void JrsBoat::UpdateLiftAndDrag(JrsWater *pWater)
{
// Loop through every submerged triangle...
for(int i=0; i<iNumOfSubTri; i++)
{
// I need to find out if boat "vVelocity" vector is in positive half space defined
// by triangle plane. If is than triangle will be used for calculation.
Plane pPlane(pWSubTriHull.vA,pWSubTriHull.vB,pWSubTriHull.vC);
if (pPlane.WhichSide(vVelocity) > 0)
{
// Get area of this submerged triangle...
float fArea = AreaOfTri(pWSubTriHull.vA,pWSubTriHull.vB,pWSubTriHull.vC);

// Direction of lift force is (vVelocity X vN) X vVelocity
Vector3 vDirrOfLift = Cross(Cross(vVelocity,pPlane.Normal()),vVelocity);
vDirrOfLift.Normalize();
// Drag acts opposite of boat velocity vector.
Vector3 vDirrOfDrag = -vVelocity;
vDirrOfDrag.Normalize();

// Angle between lift and drag vector
float fDot = Dot(vDirrOfLift,pPlane.Normal());

// Formula: F = 1/2 * Area * Ang * Coeff * Density * speed^2
// fLCoeff is lift coef, fDCoeff is drag coeff
float fSPwTwo = vVelocity.Length() * vVelocity.Length();
float fFl = 0.5f * fArea * fAngOfAttack * fLCoeff * pWater->fDensity * fSPwTwo;
float fFd = 0.5f * fArea * fAngOfAttack * fDCoeff * pWater->fDensity * fSPwTwo;

// The force acts through this point. Average of all triangle vertexes???
Vector3 vAppPoint = (pWSubTriHull.vA+pWSubTriHull.vB+pWSubTriHull.vC)/3.0f;

// Lift
// Drag
}
}
}


This seems not to work... So questions: Can somebody explain me how to calculate drag and lift per triangle? (best on this example...) And to calculate angle of attack for lift of boat in 3D? How to make this work? A searched internet for this topic but found allmost nothing...or nothing realy usable... Thanks

##### Share on other sites
1. Compute velocity vector at FluidSample point: vel
2. Angle of attack (angle) is: velNormalized dot surfaceNormal. This value should be positive, if not, skip this fluid sample. You'll get velSquaredScalar when you normalize vel.
3. Flat plate lift + induced drag is: force = (angle*area*density*.5*velSquaredScalar)*surfaceNormal. Note the .5 can be precomputed into the density constant, and area*density*.5 could also be precomputed as scale.
4. addWorldForce(force,sampleLocation). sampleLocation can be the center of the triangle.

Once you have 1-4 working (note no cross products, just one dot product), you can project the velocity vector to the plane defined by surfaceNormal and sampleLocation (this involves dot product, not cross product) to compute skin drag.

To make the surface more "efficient" (less induced drag), you can use a lookup table based on angle, or subtract away part of the induced drag vector component (at very high angles of attack, you can also simulate stall (drop in total force due to energy loss through turbulence). You don't need this step to get the sytem working (you can even skip it for a boat simulation), though. Get 1-4 above working first, then try improving/tweaking behavior.

If you are still having problems after trying to implement 1-4, draw real-time lines showing the vectors for your normals, sampleLocations, computed velocity vectors, and resulting force magnitudes. Any errors in sign/direction/location will become apparent when visualizing the process real-time.

##### Share on other sites
Hi

Thank you very much.
I have done those steps 1-4, and it works great.

I am also interested in step 5 (simulate stall,...)

Once again, thank you very much.

##### Share on other sites
Quote:
 Original post by JaresoHiThank you very much. I have done those steps 1-4, and it works great.I am also interested in step 5 (simulate stall,...) Can you please tell me more about that. Once again, thank you very much.

This can be applied to the rudder/wings (as opposed to the boat hull): as the angle of attack increases, so does lift/force. At some maximum angle, the lift will begin to drop, and if the angle of attack increases further, the fluid will break up and become turbulent, resulting in a loss of net force against the surface. This is a stall condition. This simplest implementation cuts force when the stall condition occurs. See google and search for "flat plate stall". One example here.

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

• 10
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632922
• Total Posts
3009223
• ### Who's Online (See full list)

There are no registered users currently online

×