# Code for finding the lift coefficient of NACA

#### max1546

I'm trying to code a method to find the lift coefficient of a NACA airfoil using panel method.
(Coding mentioned below is MATLAB)
There are two things I am stuck at:

1) Finding the coordinates of NACA
Usually we use the given general formula for camber. However as we all know, if we compute the equation, the "actual" calculated coordinates do not meet at the trailing edge.
In other words, if the camber is 1, the trailing edge is located at slightly beyond 1 and the y-axis is smaller than 0.
Would I have to re-scale the output airfoil so that the trailing edge is located at x=1? If so, should I assume that the trailing edge is less than 0 for more accurate analysis?
So is there any method to accurately compute out the coordinates of NACA airfoil?

2) Finding the Cl from Cp
If I divide the airfoil as following:
12 panels. Starting point from trailing edge, then through the lower edge, then the leading edge, then the upper edge and the 13th point being back at point 1.
Then I obtained the values:
I X Y THETA S GAMA V CP
1.0000 0.9665 -0.0025 -3.0656 0.0672 0.0145 -0.8445 0.2868
2.0000 0.8415 -0.0115 -3.0713 0.1835 -0.1411 -0.9612 0.0761
3.0000 0.6250 -0.0257 -3.0800 0.2505 -0.1548 -1.0071 -0.0143
4.0000 0.3750 -0.0378 -3.1065 0.2502 -0.1635 -1.0525 -0.1077
5.0000 0.1585 -0.0380 3.0962 0.1832 -0.1720 -1.1071 -0.2256
6.0000 0.0335 -0.0169 2.6735 0.0751 -0.1850 -0.8112 0.3420
7.0000 0.0335 0.0231 0.6032 0.0813 -0.0042 0.8040 0.3536
8.0000 0.1585 0.0613 0.1647 0.1855 0.1947 1.2136 -0.4729
9.0000 0.3750 0.0744 -0.0170 0.2500 0.1989 1.2014 -0.4434
10.0000 0.6250 0.0583 -0.1112 0.2516 0.1873 1.1309 -0.2789
11.0000 0.8415 0.0290 -0.1670 0.1856 0.1722 1.0423 -0.0863
12.0000 0.9665 0.0068 -0.1993 0.0683 0.1505 0.8674 0.2477
13.0000 0 0 0 0 -0.0145 0 0

how would I find the lift coefficient?
For the Area, do I need the area of the airfoil or the area surrounded by panels?

This is my MATLAB code (gives highly strange values...)
The angle of attack was 0 degrees
x,y,theta,s... are all vectors
x= x coordinates of panels
y= y coordinates of panels
s= panel lengths
v= dimensionless velocity at control panel
cp= pressure coefficient at control panel
ρ,μ,v were arbitrary values I gave.
The lift comes out as 3.2365, Although from what I know that it should be around 0.2

Code:
l=sum(cp.*s.*sin(theta)); %Lift
ro=1.225;
A=0;
for jjj=1:m
if jjj==1
A=A+abs((x(jjj)-x(end))*(y(jjj)+y(end)));
else
A=A+abs((x(jjj)-x(jjj-1))*(y(jjj)+y(jjj-1)));
end
end
A=A/2;
c=1; %camber length
mu=1.78*10^-5;
Re=25000;
v=Re*mu/(ro*c);
cl=l/(0.5*ro*v^2*A)
Where did go wrong? What should I have done? I'm completely lost...

Related Mechanical Engineering Workshop News on Phys.org