-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
40 lines (29 loc) · 1.04 KB
/
Copy pathexample.py
File metadata and controls
40 lines (29 loc) · 1.04 KB
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
"""
Author: @cc-aero
This script demonstrates the usage of the pythonxfoil module to:
1. Load airfoil coordinates from a .dat file (NACA 2412 in this example).
2. Parse the coordinates using Utils.parse_coords.
3. Create an Airfoil object with the parsed data.
4. Set analysis parameters (Re, Mach, alpha range).
5. Run an XFOIL analysis and print the resulting aerodynamic coefficients.
Usage:
python example_naca2412.py
Prerequisites:
- pythonxfoil must be installed or accessible in your Python environment.
- An example-airfoils/naca2412.dat file containing valid airfoil coordinates.
"""
from pythonxfoil import Airfoil
from pythonxfoil import Utils
airfoil_file = open("example-airfoils/naca2412.dat")
airfoil_file = airfoil_file.read()
coords = Utils.parse_coords(airfoil_file)
airfoil = Airfoil(name="airfoil",coords=coords)
airfoil.set_analysis_params(
Re=50000,
alpha_start=-1,
M = 0.0, # Incompressible flow
alpha_end=3,
alpha_step=0.1
)
results = airfoil.run_analysis()
print(results)