forked from Jetina/AirfoilOpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coeflift.m
90 lines (66 loc) · 1.67 KB
/
coeflift.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
function cl = coeflift(naca,alpha)
clc
%
%specify inlet conditions
%
%alpha=10; %in degrees
npanel=100; %total number of panels on the airfoil surface
%
% allocate all necessary arrays
%
x = zeros(npanel+1,1);
y = zeros(npanel+1,1);
cp = zeros(npanel+1,1);
%
% generate airfoil surface panelization
%
[x,y] = naca4(naca,npanel,x,y);
%
% generate panel geometry data for later use
%
l = zeros(npanel,1);
st = zeros(npanel,1);
ct = zeros(npanel,1);
xbar = zeros(npanel,1);
ybar = zeros(npanel,1);
[l,st,ct,xbar,ybar] = panel_geometry(x,y,npanel);
%
% compute matrix of aerodynamic influence coefficients
%
ainfl = zeros(npanel+1);
ainfl = infl_coeff(x,y,xbar,ybar,st,ct,ainfl,npanel);
%ainfl
%
% compute right hand side vector for the specified angle of attack
%
b = zeros(npanel+1,1);
al = alpha * pi / 180;
for i=1:npanel
b(i) = st(i)*cos(al) -sin(al)*ct(i);
end
b(npanel+1) = -(ct(1) *cos(al) +st(1) *sin(al)) ...
-(ct(npanel)*cos(al) +st(npanel)*sin(al));
%
% solve matrix system for vector of q_i and gamma
%
qg = inv(ainfl) * b;
%
% compute the tangential velocity distribution at the midpoint of panels
%
vt = veldis(qg,x,y,xbar,ybar,st,ct,al,npanel);
%
% compute pressure coefficient
%
cp = 1 -vt.^2;
%mincp=min(cp)
%
% compute force coefficients
%
[cl,cd] = aero_coeff(x,y,cp,al,npanel);
%
% plot the output
%
%subplot(2,1,1),plot(xbar,-cp),xlabel('x/c'),ylabel('Cp'),title('Coefficient of Pressure Distribution'),grid
%subplot(2,1,2),plot(x,y,x,y,'o'),xlabel('x/c'),ylabel('y/c'),title('Airfoil Geometry'),axis('equal'),grid
%lbyd=-cl/cd;
return