-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.m
executable file
·47 lines (41 loc) · 1.23 KB
/
example.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
clear all; close all;
%% Define Parameters
Re = logspace(6,12,30);
N_CRIT = 6;
AoA = -2.5:0.25:20;
%% Generate Airfoil List
afcode = {'0012', '2412', '4415', '6409', '23012', '25112'};
airfoils = cell(size(afcode));
for ii = 1:length(afcode)
airfoils{ii} = generateNACAairfoil(afcode{ii}, 100);
end
%% Load All Airfoils
% [rootDir, ~, ~] = fileparts(mfilename('fullpath'));
% afdir = [rootDir filesep 'airfoils'];
% affiles = dir(afdir);
% affiles = affiles(3:end);
% airfoils = cell(size(affiles));
% for ii = 1:length(affiles)
% airfoils{ii} = scanAirfoil([afdir filesep affiles(ii).name]);
% end
%% Solve Airfoils
tic;
pool = gcp;
polars = XFOILbatch(airfoils, Re, N_CRIT, AoA, false, pool);
delete(pool);
toc;
%% Save Results
%save('exampleResults.mat', 'polars', 'airfoils', 'Re', 'N_CRIT', 'AoA');
%% Plot Results
cmap = hsv(size(polars,1));
h = figure;
plot(AoA, 2*pi^2*AoA/180, 'k--');
xlabel('Angle of Attack (deg)');
ylabel('Coefficient of Lift');
hold on;
for ii = 1:size(polars,1)
for jj = 1:size(polars,2)
plot(polars{ii,jj}.alpha, polars{ii,jj}.CL, '-', 'Color', cmap(ii,:));
end
end
hold off;