def initFromAerodynFile(cls, aerodynFile): """convenience method for initializing with AeroDyn formatted files Parameters ---------- aerodynFile : str location of AeroDyn style airfoiil file Returns ------- af : CCAirfoil a constructed CCAirfoil object """ af = Airfoil.initFromAerodynFile(aerodynFile) alpha, Re, cl, cd, cm = af.createDataGrid() return cls(alpha, Re, cl, cd)
def __init__(self, path): fp = open(path) lines = fp.readlines() self.NumFoil = int(splitLine(lines[17])[0]) self.foils = [] for i in range(self.NumFoil): tt = splitLine(lines[18+i])[0][1:-1] path_af = os.path.join(os.path.dirname(path), tt) af = Airfoil.initFromAerodynFile(path_af) self.foils.append(af) nodeNum = int(splitLine(lines[22])[0]) self.cols = splitLine(lines[23]) _data = [] for i in range(nodeNum): values = self.splitLine(lines[24+i]) _data.append(values) self.nodeData = pd.DataFrame(_data, columns=self.cols)
import os basepath = os.path.join(os.path.expanduser("~"), "Dropbox", "NREL", "5MW_files", "5MW_AFFiles") os.chdir(basepath) # just to temporarily change PYTHONPATH without installing import sys sys.path.append(os.path.expanduser("~") + "/Dropbox/NREL/SysEng/TWISTER/src/twister/rotoraero") # 1 --------- from airfoilprep import Polar, Airfoil import numpy as np airfoil = Airfoil.initFromAerodynFile("DU21_A17.dat") # 1 --------- # 2 --------- # first polar Re = 7e6 alpha = [ -14.50, -12.01, -11.00, -9.98, -8.12, -7.62, -7.11,
'5MW_files', '5MW_AFFiles') os.chdir(basepath) # just to temporarily change PYTHONPATH without installing import sys sys.path.append( os.path.expanduser('~') + '/Dropbox/NREL/SysEng/TWISTER/src/twister/rotoraero') # 1 --------- from airfoilprep import Polar, Airfoil import numpy as np airfoil = Airfoil.initFromAerodynFile('DU21_A17.dat') # 1 --------- # 2 --------- # first polar Re = 7e6 alpha = [ -14.50, -12.01, -11.00, -9.98, -8.12, -7.62, -7.11, -6.60, -6.50, -6.00, -5.50, -5.00, -4.50, -4.00, -3.50, -3.00, -2.50, -2.00, -1.50, -1.00, -0.50, 0.00, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.50, 10.00, 10.50, 11.00, 11.50, 12.00, 12.50, 13.00, 13.50, 14.00, 14.50, 15.00, 15.50, 16.00, 16.50, 17.00, 17.50, 18.00, 18.50, 19.00, 19.50, 20.00, 20.50 ]