-
Notifications
You must be signed in to change notification settings - Fork 0
/
runAF_sweeps.m
176 lines (146 loc) · 2.89 KB
/
runAF_sweeps.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
clear all
format compact
close all
% Cases of interest
% runAF_fun( 0.05, .16, 0, true );
% Airfoil type
% 1 NACA 4-digit
% 2 VR12
% 3 VKT
aftype = 2;
th = 5;
nx = [1 2 3]*25;
ny = [1 2 3]*26;
xmin = [-2 -1.5 -1.07];
xmax = [2 1.3 1.07];
ymin = [-2 -0.5 -0.13];
ymax = [2 0.5 0.13];
xv = [];
yv = [];
for i=1:length(xmin)
xgrd = linspace( xmin(i), xmax(i), nx(i) );
ygrd = linspace( ymin(i), ymax(i), ny(i) );
[xg, yg] = meshgrid( xgrd, ygrd );
xvi = reshape( xg, 1, [] );
yvi = reshape( yg, 1, [] );
xv = [xv xvi];
yv = [yv yvi];
end
zv = -0.1 * ones(size(xv));
% yv = yv + rand( size(yv) ) * 0.001 - 0.0005;
DT = delaunayTriangulation( xv', yv' );
tri = DT.ConnectivityList;
for i=1:length(xv)
[CLi, CDi] = runAF_fun( xv(i), yv(i), th, false, aftype );
CLis(i,:) = cell2mat( CLi );
CDis(i,:) = cell2mat( CDi );
end
[~, ~, xep, yep] = runAF_fun( 10, 10, th, false, aftype );
CLtot = sum(CLis,2);
CDtot = sum(CDis,2);
figure(1)
trisurf(tri,xv,yv,zv,CLtot,'EdgeColor','none','FaceColor','interp')
view(0,90)
axis equal
ax=axis;
hold on
if ( max(CLtot) > 0 && min(CLtot) < 0 )
[c,h]=tricontour(tri,xv,yv,CLtot,[0 0]);
set(h,'EdgeColor','k')
end
fill(xep,yep,'k')
hold off
view(0,90)
if ( th > 3 )
caxis([0.5,1.5])
else
caxis([-0.3 0.3])
end
colorbar
axis equal
axis(ax)
axis off
title('Total C_L')
figure(2)
trisurf(tri,xv,yv,zv,CLis(:,1),'EdgeColor','none','FaceColor','interp')
view(0,90)
axis equal
hold on
[c,h]=tricontour(tri,xv,yv,CLis(:,1),[0 0]);
set(h,'EdgeColor','k')
fill(xep,yep,'k')
hold off
view(0,90)
caxis([-6,6])
colorbar
axis equal
axis(ax)
axis off
title('C_L Fixed AF')
figure(3)
trisurf(tri,xv,yv,zv,CDis(:,1),'EdgeColor','none','FaceColor','interp')
view(0,90)
axis equal
ax=axis;
hold on
[c,h]=tricontour(tri,xv,yv,CDis(:,1),[0 0]);
set(h,'EdgeColor','k')
fill(xep,yep,'k')
hold off
caxis([-.3 .3])
colorbar
axis equal
axis(ax);
axis off
title('C_D Fixed AF')
figure(4)
trisurf(tri,xv,yv,zv,CDtot','EdgeColor','none','FaceColor','interp')
hold on
fill(xep,yep,'k')
hold off
view(0,90)
caxis([0 .0001])
colorbar
axis equal
axis(ax);
axis off
title('Total C_D')
figure(5)
trisurf(tri,xv,yv,zv,nan(size(xv)),'EdgeColor','none','FaceColor','interp')
hold on
plot(xep,yep,'k','LineWidth',1.5)
hold off
view(0,90)
caxis([0 .0001])
colorbar
axis equal
axis(ax);
axis off
title('Foil')
figure(6)
trisurf(tri,xv,yv,zv,CLtot-2*0.602829261927623,'EdgeColor','none','FaceColor','interp')
view(0,90)
axis equal
ax=axis;
hold on
if ( max(CLtot-2*0.602829261927623) > 0 && min(CLtot-2*0.602829261927623) < 0 )
[c,h]=tricontour(tri,xv,yv,CLtot-2*0.602829261927623,[0 0]);
set(h,'EdgeColor','k')
end
fill(xep,yep,'k')
hold off
view(0,90)
if ( th > 3 )
caxis([0.5,1.5]-1.2)
else
caxis([-0.3 0.3])
end
colorbar
axis equal
axis(ax)
axis off
title('Total C_L- 2 C_L^*')
for i=1:6
figure(i)
print('-dpng','-r300',['af_int_' num2str(i) '.png']);
end