#!/usr/bin/python3 from xfoil import XFoil import matplotlib.pyplot as plt xf = XFoil() xf.load("revclarky.dat") xf.Re = 1e5 xf.M = 0 xf.max_iter = 100 a, cl, cd, cm, cp = xf.aseq(-2, 2, 0.5) plt.plot(a, cl) plt.title("alfa vs cl") plt.show() #plt.plot(xf.airfoil.x,xf.airfoil.y) #plt.axis('equal') #plt.show()
try: for i in range(int(len(airfoils)/2)): xf = XFoil() aa = airfoils[2*j] b = airfoils[2*j+1] archive3 = open('load.txt', 'w') for line in range(len(aa)): aux = [aa[line],b[line]] string = str(aux).replace("["," ").replace(","," ").replace("]"," ").replace("'"," ") archive3.writelines(string+ '\n') aux.clear # Calculates the aerodynamic coeff using Xfoil archive3.close() xf.load('load.txt') xf.Re = 1e3 xf.max_iter = 100 ann, cl, cd, cm, co = xf.aseq(1, 11, 1) an = np.linspace(1,10,10) # Calculates the geometric position of the center of gravity for an airfoil Xstruct[:,0] = aa Xstruct[:,1] = b Surf,Iben,Itor,Xcg,Ycg = Struct.ArfoilProperties(1.0,Xstruct) # Stores the data in an external file if i==0: for z in range(len(an)): archive2.write( "Cl(A="+str(an[z]).replace("["," ").replace("]"," ") +");")
aa = Xwing_aero1[:, 0] b = Xwing_aero1[:, 1] archive3 = open('lt.txt', 'w') for line in range(len(aa)): aux = [aa[line], b[line]] string = str(aux).replace("[", " ").replace(",", " ").replace("]", " ").replace("'", " ") archive3.writelines(string + '\n') aux.clear # Calculates the aerodynamic coeff using Xfoil archive3.close() xf.load('lt.txt') xf.Re = 1e3 xf.max_iter = 100 ann, cl, cd, cm, co = xf.aseq(1, 11, 1) an = np.linspace(1, 10, 10) desired = np.zeros(31) desired[0:10] = cl desired[10:20] = cd desired[20:30] = cm Surf, Iben, Itor, Xcg, Ycg = Struct.ArfoilProperties(1.0, Xwing_struct1) desired[30] = Xcg #2.Initialize Aero and Structural Models #2.a. Aero Model Elements, Xc, Xn, Xt, DL, A = Aero.InitializeAeroModel(Xwing_aero) AoA, Vnorm = 0.0, 6.0
from xfoil import XFoil import matplotlib.pyplot as plt xf = XFoil() xf.load("clarky.dat") plt.plot(xf.airfoil.x, xf.airfoil.y) plt.axis('equal') plt.show()