Esempio n. 1
0
def flap_objective(x):
    af = Airfoil()
    af.read_txt('GA37A315mod_reworked.txt')
    flapRatio = 0.3 
#    lipLen    = 0.13 #0.1 - 0.27 
#    leRad     = 0.15 #0.05 - 0.25
#    gap       = 0.02 #0.005;0.02
#    overlap   = -0.02 #-0.02 0.02
    defl      = 35
#    vratio1   = 0.73 #0.5 0.95
#    vratio2   = 1.3 #1.05 1.5
#    vratio3   = 0.55 #0.2 0.9
    lipLen = x[0]
    leRad = x[1]
    gap = x[2]
    overlap = x[3]
    vratio1 = x[4]
    vratio2 = x[5]
    vratio3 = x[6]
    try:
        Flap  = flap_geometry(af,flapRatio,lipLen, leRad, gap, overlap, defl,vratio1,vratio2,vratio3)
        polar = calc_Jpolar(0.06,3e6,Flap)
        clmax = ny.max(polar.cl)
        #print clmax
        return -clmax,[],[]
    except:
        return 100,[],[]
Esempio n. 2
0
def plot_results():
#    xBest =[0.18978,0.24883,0.00824,0.02996,0.50002,1.37683,0.20097]
    #xBest =[0.18913399,0.13287908,0.00548619,0.02999233,0.50557791,1.49805884,0.20113115]
    xBest=[0.19417077,0.24936138,0.01010853,0.0299996,0.50077753,1.39159708,0.2021984]
    af = Airfoil()
    af.read_txt('GA37A315mod_reworked.txt')
    FlapOpt = flap_geometry(af, 0.3, xBest[0], xBest[1],xBest[2],xBest[3],35,xBest[4],xBest[5],xBest[6])
    mainSec, flap, flap0 = FlapOpt
    flap1 = Curves.rotate2D(flap,[0.785,-0.135],-35)
    mainSec, flap, flap0 = FlapOpt
   # write_txt(FlapOpt,'KLA100flap_20121213.txt')
    plt.figure(1)
    plt.hold(True)
    plt.plot(mainSec[:,0],mainSec[:,1])
    plt.plot(flap[:,0],flap[:,1])
    plt.plot(flap0[:,0],flap0[:,1])
    #plt.axis([0,1.1,-.5,.5])
    plt.axis('equal')
    plt.grid(True)
    plt.show()
Esempio n. 3
0
def test_func():
    af = Airfoil()
    af.read_txt('GA37A315mod_reworked.dat')
    print af.up, af.coord
    flapRatio = 0.3 
    lipLen    = 0.1643088
    leRad     = 0.14054948
    gap       = 0.0157
    overlap   = -0.02
    defl      = 35
    vratio1   = 0.77033947
    vratio2   = 1.39164569
    vratio3   = 0.55
    Flap = flap_geometry(af, 0.3, lipLen, leRad,gap,overlap,35,vratio1,vratio2,vratio3)
    mainSec, flap = Flap
    polar = calc_Jpolar(0.06,3e6,Flap)
    
    plt.figure(1)
    plt.hold(True)
    plt.plot(mainSec[:,0],mainSec[:,1])
    plt.plot(flap[:,0],flap[:,1])
    plt.axis([0,1.1,-.5,.5])
    plt.grid(True)
    plt.show()
Esempio n. 4
0
def create_propeller(x,afOld):
    diameter = 1.75
    hubDiameter = 0.3
    hubX = hubDiameter / diameter
    baseAfPath = 'clark-Y.txt'

    chordX = array([hubX,0.35,0.5,0.75,0.95])
    pitchX = array([hubX,0.35,0.5,0.75,0.95])
    thickX = array([hubX,0.35,0.5,0.75,0.95])
    xnew = linspace(hubX,0.95,10)
    betaSet = pitchX[3]
    n1,n2,n3 = len(chordX), len(pitchX), len(thickX)
    chordY = x[0:n1]
    pitchY = x[n1:n1+n2]
    thickY = x[n1+n2:]

    method = 'spline'
    chord = _interpolate(chordX,chordY,xnew,method)
    pitch = _interpolate(pitchX,pitchY,xnew,method)
    thick = _interpolate(thickX,thickY,xnew,method)
    
    prop = propeller()
    if afOld==None:
        af = list()
        for tc in thick:
            afnew = Airfoil()
            afnew.read_txt(baseAfPath)
            afnew.analyze_geometry()
            afnew.scale_thickness(tc,False)
            afnew.build_aero_table(alphaSeq=[-40.0,40.0,1.0])
            af.append(afnew)
        prop.airfoil = af
    else:
        prop.airfoil = afOld

    prop.name = 'MDO_project'
    prop.diameter = diameter
    prop.hubDiameter = hubDiameter
    prop.chord = chord
    prop.beta = pitch
    prop.x = xnew
    prop.r = xnew*diameter/2.0
    prop.radius = diameter/2.0
    prop.numBlades = 3.0
    prop.thickness = thick
    prop.numStations = len(xnew)
    prop.analyze_geometry()
    prop.set_beta(betaSet)
    
#    if show:
#        fig = plt.figure(1)
#        ax1 = fig.add_subplot(311)
#        ax1.grid(True)
#        ax1.hold(True)
#        ax1.plot(xnew,chord)
#        ax2 = fig.add_subplot(312)
#        ax2.grid(True)
#        ax2.plot(xnew,pitch)
#        ax3 = fig.add_subplot(313)
#        ax3.grid(True)
#        ax3.plot(xnew,thick)
#        plt.show()
    return prop
Esempio n. 5
0
def flap_geometry2(x=None,args=1):
    
    if x==None:
        x = ny.array([0.15, 0.3, 0.05, 0.5, 0.1, 0.5, 0.02, 0.02])
    
    flapRatio = 0.7
    defl = 35.0
    airfoil = Airfoil()
    airfoil.read_txt('aiaa_cfd_final_optimum.txt')
    offset = 0.005 # main section flap offset
    lipTe  = 0.0033 # trailing edge thickness
    rTe    = 0.01 # trailing edge radius

    exitLipLen   = x[0]
    leRadPos     = x[1]
    entryLipLen  = x[2]
    v1           = x[3]
    v2           = x[4]
    v3           = x[5]
    gap          = x[6]
    overlap      = x[7]
    
    upNode = ny.zeros([4,2])
    loNode = ny.zeros([4,2])

    upCurve = Curves.xyCurve(airfoil.upPts)
    loCurve = Curves.xyCurve(airfoil.loPts)

    thickness = upCurve(flapRatio)-loCurve(flapRatio) #local thickness
    leRad = v2 * thickness # V2 length
    leRadPos = leRadPos * thickness + loCurve(flapRatio)

    upNode[0,0] = flapRatio + exitLipLen
    upNode[0,1] = upCurve(upNode[0,0])
    
    tan0 = upCurve.tan(upNode[0,0])
    upNode[1,0] = upNode[0,0] - exitLipLen*v1
    upNode[1,1] = -(upNode[0,0]-upNode[1,0])*tan0 + upNode[0,1]
    
    loNode[0,0] = flapRatio + entryLipLen
    loNode[0,1] = loCurve(loNode[0,0])
    
    tan1 = loCurve.tan(loNode[0,0])
    loNode[1,0] = loNode[0,0] - entryLipLen*v3
    loNode[1,1] = loNode[0,1] - (loNode[0,0]-loNode[1,0])*tan1
    
    upNode[2,0] = flapRatio
    loNode[2,0] = flapRatio
    upNode[3,0] = flapRatio
    loNode[3,0] = flapRatio
    
    upNode[3,1] = leRadPos
    loNode[3,1] = leRadPos
    upNode[2,1] = upNode[3,1] + leRad
    loNode[2,1] = loNode[3,1] - leRad
    
    curve3 = Curves.BezierCurve(upNode,10)
    curve4 = Curves.BezierCurve(loNode,10)
    curve4e = ny.flipud(curve4)
    curve4e[:,2] = curve4[:,2]
    curve4e = curve4e[1:]
    curve4e[:,2] = curve4e[:,2]+1.0
    curve11 = ny.vstack([curve3,curve4e])
    
    curve11offset = Curves.xytCurveOffset(curve11,-offset)
    curve6 = Curves.xyCurveSplit(upCurve.pts,upNode[0,0])
    curve7 = Curves.xyCurveSplit(loCurve.pts,0,loNode[0,0])
    curve8 = Curves.xyCurveSplit(loCurve.pts,loNode[0,0])
    
    curve9, curve10 = Curves.trimTe(airfoil.upPts,curve11offset,lipTe)
    curve7, curve10 = Curves.splitCurveSimple(curve7,curve10,[0,0])

    curve12, circle1, curve13 = Curves.roundCorner(curve7,curve10,rTe)
    
    mainSec = ny.vstack([ny.flipud(curve9),curve12,circle1,ny.flipud(curve13[:,0:2])])
    flapSec1 = ny.vstack([ny.flipud(curve6)[:-1,:],curve11[:-1,0:2],curve8])
    #flapSec0 = flapSec1

    flapSec1 = Curves.rotate2D(flapSec1,[0.7,-.1],defl)
    flapAdd = Curves.rotate2D(curve11,[0.7,-.1],defl)
    
    refPt = mainSec[-1]
    moveX1 = ny.min(flapSec1[:,0]) - refPt[0] + overlap
    flapSec1[:,0] = flapSec1[:,0] - moveX1
    flapAdd[:,0]  = flapAdd[:,0]  - moveX1
    #gap
    dy = Curves.adjustGap(flapAdd,refPt,gap)
    flapSec1[:,1] = flapSec1[:,1] + dy

    return mainSec, flapSec1