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)
def cl_visc_analysis(airfoil, cl_i, cl_f, cl_step, re, mach, max_iter, id): """Viscous analysis over range of lift coefficients.""" # Initializes airfoil and assigns NACA xf = XFoil() xf.naca(airfoil) xf.max_iter = max_iter xf.Re = re xf.M = mach # Collects values a, cl, cd, cm, cp = xf.cseq(cl_i, cl_f, cl_step) x, cp_0 = xf.get_cp_distribution() # Plots all the data plot(a, cl, cd, cm, cp, x, cp_0, id)
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