-
Notifications
You must be signed in to change notification settings - Fork 43
/
LOAD_AIRFOIL_SELIG.py
44 lines (38 loc) · 1.43 KB
/
LOAD_AIRFOIL_SELIG.py
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
# FUNCTION - LOAD AIRFOIL (SELIG FORMAT)
# Written by: JoshTheEngineer
# YouTube : www.youtube.com/joshtheengineer
# Website : www.joshtheengineer.com
# Started : 01/23/19
# Updated : 01/23/19 - Started code in MATLAB
# - Works as expected
# : 02/03/19 - Transferred to Python
# - Works as expected
#
# PURPOSE
# - Load the X and Y coordinates for airfoil from fileName
# - Data comes from files on UIUC website
# - Loads every airfoil except naca23015.dat (has weird data)
# - Checked to make sure the loaded data works with panel method codes
#
# INPUTS
# - fileName : File name of the airfoil without extension (must be .dat)
#
# OUTPUTS
# - dataX : Airfoil X-coordinate data array [Nx1]
# - dataY : Airfoil Y-coordinate data array [Nx2]
import numpy as np
def LOAD_AIRFOIL_SELIG(fileName):
# Define the number of header lines in the file
hdrlns = 1
if (fileName == 'nasasc2-0714'):
hdrlns = 3
elif (fileName == 's1020'):
hdrlns = 2
# Load the data from the text file
flpth = "C:/Users/Josh/Documents/MATLAB/Panel_Methods/Panel_Method_Complete/Airfoil_DAT_Selig/"
flnm = flpth + fileName + ".dat"
dataBuffer = np.loadtxt(flnm,delimiter=' ', skiprows=hdrlns)
# Extract data from the loaded dataBuffer array
dataX = dataBuffer[:,0]
dataY = dataBuffer[:,1]
return dataX, dataY