예제 #1
0
def get_max_cl(Re, r):
    """
    Analyze airfoil at a fixed Re,
    changing aoa from 10 to 15 by 0.1
    and returns cl, cd, aoa that makes maximum cl
    """
    xf = XFoil()
    if r <= 0.175:
        xf.airfoil = naca6409
    else:
        xf.airfoil = naca2412
    xf.Re = Re
    xf.Re = Re
    xf.max_iter = 200
    xf.n_crit = 9.00
    xf.xtr = [1.00, 1.00]
    xf.M = 0
    a_seq, cl_seq, cd_seq, cm_seq, cp_seq = xf.aseq(10, 15, 0.1)
    # ignore nan by making it 0
    cl_seq = np.nan_to_num(cl_seq)
    # find the maximum cl
    cl_maxi = np.max(cl_seq)
    # index of the maximum cl
    idx = np.argmax(cl_seq)
    return round(cl_maxi, 2), round(a_seq[idx], 2), round(cd_seq[idx], 2)
예제 #2
0
def alpha_inv_analysis(airfoil, alpha_i, alpha_f, alpha_step, max_iter, id):
    """Inviscid analysis over range of angle of attacks."""
    # Initializes airfoil and assigns NACA
    xf = XFoil()
    xf.naca(airfoil)
    xf.max_iter = max_iter
    # Collects values
    a, cl, cd, cm, cp = xf.aseq(alpha_i, alpha_f, alpha_step)
    x, cp_0 = xf.get_cp_distribution()
    # Plots all the data
    plot(a, cl, cd, cm, cp, x, cp_0, id)
예제 #3
0
def getCoefficients(naca,
                    reynolds=1e6,
                    iterations=20,
                    angle=10,
                    angle_step=.5):
    xf = XFoil()
    xf.naca(f"{naca:04d}")
    xf.Re = reynolds
    xf.max_iter = 20
    a, cl, cd, cm, cp = xf.aseq(0, angle, .5)
    ratio = cl / cd
    max_idx = np.nanargmax(ratio)
    return (ratio[max_idx], a[max_idx]), a, cl, cd, max_idx
예제 #4
0
    # XFOIL #######

    from xfoil import XFoil
    xf = XFoil()

    # Import an airfoil
    from xfoil.test import XXXXX
    xf.airfoil = XXXXX

    # Setting up the analysis parameters
    xf.Re = re
    xf.max_iter = 100
    xf.M = 0.7

    # Obtaining the angle of attack, lift coefficient, drag coefficient and momentum coefficient of the airfoil
    a, cl, cd, cm = xf.aseq(0, 30, 0.5)














예제 #5
0
#!/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()
예제 #6
0
klist = [1]

for k in range(1):
    print(k)
    x = aifoils[k]['x'].values
    y = aifoils[k]['y'].values

    ang_low = -32
    ang_high = 32
    ang_spacing = 2

    xfc = XFoil()
    xfc.airfoil = Airfoil(x, y)
    xfc.Re = re[k]
    xfc.max_iter = 40
    ac, clc, cdc, cmc, cpminc = xfc.aseq(ang_low, ang_high, ang_spacing)

    df = aifoils_cfd[k].where(aifoils_cfd[k]['alpha [deg]'] >= aoa_l)
    df = df.where(aifoils_cfd[k] <= aoa_h)
    df = df.dropna()  #.values

    cl_panel = []
    cdp_panel = []

    for aoa in df['alpha [deg]']:
        data_xy = aifoils[k].values
        CL, CDP, Cp, pp = panel(data_xy[:, :], alfader=aoa)
        cl_panel.append(CL)
        cdp_panel.append(CDP)

    cl_panel = np.array(cl_panel)
예제 #7
0
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
Vinf = np.array([np.cos(AoA / 57.3), np.sin(AoA / 57.3)]) * Vnorm  #wind speed
#Vinf=Vinf*Vnorm
Vc = Xc * 0.0
from xfoil import XFoil
from xfoil.test import naca0012

xf = XFoil()
xf.airfoil = naca0012
xf.Re = 1e6
xf.max_iter = 40
a, cl, cd, cm, co = xf.aseq(-20, 20, 0.5)