This repository has been archived by the owner on Jan 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathexampleXFOIL.m
60 lines (45 loc) · 1.62 KB
/
exampleXFOIL.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
%% Create a new instance of the XFOIL class, and set some properties
xf = XFOIL;
xf.KeepFiles = true; % Set it to true to keep all intermediate files created (Airfoil, Polars, ...)
xf.Visible = true; % Set it to false to hide XFOIL plotting window
%% Create a NACA 5-series airfoil
xf.Airfoil = Airfoil.createNACA5('23012',150);
% To create a NACA 4-series, use >> xf.Airfoil = Airfoil.createNACA4('0012');
% To load an existing airfoil, use >> xf.Airfoil = Airfoil('naca0012.dat');
%% Setup the action list
%Add five filtering steps to smooth the airfoil coordinates and help convergence
xf.addFiltering(5);
%Switch to OPER mode, and set Reynolds = 3E7, Mach = 0.1
xf.addOperation(3E7, 0.1);
%Set maximum number of iterations
xf.addIter(100)
%Initializate the calculations
xf.addAlpha(0,true);
%Create a new polar
xf.addPolarFile('Polar.txt');
% %Calculate a sequence of angle of attack, from 0 to 25 degrees, step size of 0.1 degrees
xf.addAlpha(0:0.1:25);
%Another option is to keep all the CP curves, replace the previous line with this:
%for alpha = 0:0.1:25
% xf.addAlpha(alpha);
% xf.addActions(sprintf('CPWR alpha_%f.txt',alpha));
%end
%Close the polar file
xf.addClosePolarFile;
%And finally add the action to quit XFOIL
xf.addQuit;
%% Now we're ready to run XFOIL
xf.run
disp('Running XFOIL, please wait...')
%% Wait up to 100 seconds for it to finish...
%It is possible to run more than one XFOIL instance at the same time
finished = xf.wait(100);
%% If successfull, read and plot the polar
if finished
disp('XFOIL analysis finished.')
xf.readPolars;
figure
xf.plotPolar(1);
else
xf.kill;
end