Example #1
0
def run_test_aero_analysis():
    timer = Timer()
    af = cst_x(np.array([0.18723832, 0.2479892, 0.26252777, 0.31606257, 0.0819584, -0.11217863, -0.14363534, -0.06480575, -0.27817776, -0.08874038]))
    af._analyze_geometry()
    af.display()
    timer.lap('read db')    
    pol1 = af.get_jfoil_polar(0.2,3e6)
    timer.lap('javafoil')
    pol2 = af.get_xfoil_polar(0.2,3e6)
    timer.stop('xfoil')
    plt.figure(1)
    plt.hold(True)
    plt.grid(True)
    plt.plot(pol1.alpha,pol1.cd)
    plt.plot(pol2.alpha,pol2.cd)
    plt.show()
def main():
    yplus = np.array([0.25, 0.5, 1.0, 5.0, 10.0, 25.0])
    gridScale = np.array([0.5, 0.75, 1.0, 2.0, 4.0, 6.0])
    zTE = 0.005
    Mach = 0.85
    alt  = 10000
    alpha = 0.0
    npts = 101
    t = Timer()
    
    fc = flight_conditions.FlightConditions(Mach, alt)
    
    A = np.array([0.06421182,0.11882206,0.12335525,0.12384311,0.11381198,
                  -0.01503971,-0.07024083,-0.04311071,0.02437696])
    
    #af = af_cfd_analysis.airfoil.cst_x(A, nPts=npts)
    af = af_cfd_analysis.airfoil.Airfoil()
    af.read_txt('N64A206.txt')
    af.display()
    #af.set_trailing_edge(zTE)
    
    fid = open('grid_convergence.txt','wt')
    fid.write('yplus\tgridSize\ttime\tcl\tcd\tcm\n')
    fid.close()
    nCase = 0
    for i,yp in enumerate(yplus):
        for j,gs in enumerate(gridScale):
            t.start()
            nCase += 1
            cl, cd, cm, gridSize = run_analysis(af, fc, alpha, yp, gs,nCase)
            duration = t.lap()
            out = '%.1f\t%d\t%.4f\t%.6f\t%.6f\t%.6f\n'%(yp,gridSize,duration,cl,cd,cm)
            fid = open('grid_convergence.txt','a')
            fid.write(out)
            fid.close()
            print out
    t.stop()