Example #1
0
def costFcn(X):
    airfoilPath = 'GA37A315mod.dat'
    nodes1 = ny.zeros([3,2])
    nodes2 = ny.zeros([3,2])
    vectLen1 = ny.zeros([3])
    
    nodes1[0,0] = X[0]
    
    nodes1[1,1] = X[1]
    nodes1[2,0] = X[2]
    nodes2[0,0] = X[3]
    vectLen1[0] = X[4]
    vectLen1[1] = X[5]
    vectLen1[2] = X[6]
    theta       = X[7]
    overlap     = X[8]
    gap         = X[9]
    
    teThickness = 0.002
    deflection = 35
    nodes1[1,0] = 0.7 #flap chord ratio
    Mach = 0.16
    Re = 4e6
    alphaStart = -20
    alphaEnd = 20
    alphaStep = 1
    try:
        airfoil = flapGeom.getFlap(airfoilPath, nodes1,nodes2, vectLen1, theta, gap, overlap, deflection,teThickness)
        polar = afAnalysis.polar(airfoil)
        polar.calcJpolar(Mach,Re,alphaStart,alphaEnd,alphaStep,True)
        f = -polar.CLmax
        g = 10. - polar.ClmaxAlpha
    except: f,g = 100,1
    h = []
    return f,g,h
Example #2
0
def costFcn(X):
    airfoilPath = 'FinalOptimum20120720.dat'
    node1 = ny.zeros([3,2])
    node2 = ny.zeros([3,2])
    vectLenRatio1 = ny.zeros([3])
    
    node1[0,0] = X[0]
    node1[1,1] = X[1]
    node1[2,0] = X[2]
    node2[0,0] = X[3]
    vectLenRatio1[0] = X[4]
    vectLenRatio1[1] = X[5]
    vectLenRatio1[2] = X[6]
    theta       = X[7]
    overlap     = X[8]
    gap         = X[9]
    
    zTE = 0.002
    deflection = 35
    node1[1,0] = 0.7 #flap chord ratio
    Mach = 0.0955
    Re =  2285283
    alphaStart = -10
    alphaEnd = 15
    alphaStep = 1
    try:
        airfoil = flapGeom2.getFlap(airfoilPath, node1,node2, vectLenRatio1, theta, gap, overlap, deflection,zTE)
        polar = afAnalysis.polar(airfoil)
        polar.calcJpolar(Mach,Re,alphaStart,alphaEnd,alphaStep,True)
        f = -polar.CLmax
        #g = 5. - polar.ClmaxAlpha
    except: f = 100
    h = []
    g = []
    return f,g,h
Example #3
0
def CostFcn(X):
    Au = X[0:3]
    Al = X[4:6]
    Al = ny.hstack([-Au[0],Al])
    Mach = 0.16
    Re = 4.17e6
    alphaStart = -10
    alphaEnd = 20
    alphaStep = 1.0
    clreq = 0.2
    
    af = CST.CSTairfoil(Au,Al,ny.array([0.5,1.0]),80)
    tc = ny.max(af.up[:,1]-af.lo[:,1])
    
    g = ny.zeros([4])
    
    polar = afAnalysis.polar(af)
    polar.calcXpolar(Mach,Re,alphaStart,alphaEnd,alphaStep,50,False)
    
    g[0] = 0.13 - tc
    g[1] = tc - 0.18
    g[2] = 1.6 - polar.CLmax
    f,alpha = polar.cdAtcl(clreq)
    g[3] = -alpha

    h = []
    return f, g,h
Example #4
0
def costFcn(X,deflection):
    airfoilPath = 'GA37A315mod.dat'
    node1 = ny.zeros([3,2])
    node2 = ny.zeros([3,2])
    vectLenRatio1 = ny.zeros([3])
    
    node1[0,0] = X[0]
    node1[1,1] = X[1]
    node1[2,0] = X[2]
    node2[0,0] = X[3]
    vectLenRatio1[0] = X[4]
    vectLenRatio1[1] = X[5]
    vectLenRatio1[2] = X[6]
    theta       = X[7]
    overlap     = X[8]
    gap         = X[9]
    
    zTE = 0.002
    #deflection = 35
    node1[1,0] = 0.7 #flap chord ratio
    Mach = 0.16
    Re = 4e6
    alphaStart = -20
    alphaEnd = 10
    alphaStep = 1
    try:
        airfoil = flapGeom2.getFlap(airfoilPath, node1,node2, vectLenRatio1, theta, gap, overlap, deflection,zTE)
        polar = afAnalysis.polar(airfoil)
        #polar.calcJpolar(Mach,Re,alphaStart,alphaEnd,alphaStep,True)
        #f = -polar.CLmax
        #g = 5. - polar.ClmaxAlpha
    except: f = 100
    f = []
    h = []
    g = []
    
    wdir = r'D:\Documents\My Documents\1. Classes\5 Sem - Human Computer Interaction for MDO\term project\DoE'
    filename1 = ('flap overlap%.2f gap%.2f defl%.2f.txt'%(100*X[8],100*X[9],deflection))
    filename2 = ('flap overlap%.2f gap%.2f defl%.2f.iges'%(100*X[8],100*X[9],deflection))
    filepath1 = wdir + '\\' + filename1
    filepath2 = wdir + '\\' + filename2
    afLib.writeFlap(filepath1,airfoil)
    polar.saveAsIgs(filepath2,airfoil,True)
    
    plt.figure(1)
    plt.axis([0,1.2,-.5,.5])
    plt.grid(True)
    plt.hold(True)
    plt.plot(airfoil.mainSec[:,0],airfoil.mainSec[:,1])
    plt.plot(airfoil.flap[:,0],airfoil.flap[:,1])
    
    plt.show()
    
    return f,g,h
Example #5
0
def final_result(X):
    airfoilPath = 'FinalOptimum20120720.dat'
    node1 = ny.zeros([3,2])
    node2 = ny.zeros([3,2])
    vectLenRatio1 = ny.zeros([3])
    
    node1[0,0] = X[0]
    node1[1,1] = X[1]
    node1[2,0] = X[2]
    node2[0,0] = X[3]
    vectLenRatio1[0] = X[4]
    vectLenRatio1[1] = X[5]
    vectLenRatio1[2] = X[6]
    theta       = X[7]
    overlap     = X[8]
    gap         = X[9]
    
    zTE = 0.002
    deflection = 35
    node1[1,0] = 0.7 #flap chord ratio
    Mach = 0.0955
    Re =  2285283
    alphaStart = -10
    alphaEnd = 15
    alphaStep = 1
    airfoil = flapGeom2.getFlap(airfoilPath, node1,node2, vectLenRatio1, theta, gap, overlap, deflection,zTE)
    polar = afAnalysis.polar(airfoil)
    polar.calcJpolar(Mach,Re,alphaStart,alphaEnd,alphaStep,True)
    print polar.CLmax
    afAnalysis.afLib.writeFlap('optimized flap.dat', airfoil)
    plt.figure(2)
    plt.plot(airfoil.mainSec[:,0],airfoil.mainSec[:,1])
    plt.hold(True)
    plt.grid(True)
    plt.plot(airfoil.flap[:,0],airfoil.flap[:,1])
    plt.axis([0,1.2,-.5,.5])
    plt.show()