Пример #1
0
 def _get_point_distribution(self,nPts=30,distribution=None):
     if distribution==None:
         distribution = self._distribution
     if distribution=='sin':
         return geom.get_sine_distribution(nPts)
     elif distribution=='cos':
         return geom.get_cosine_distribution(nPts)
Пример #2
0
def get_bezier_airfoil(x=None,nPts=30,show=False):
    if x==None:
        x = np.array([0.03,0.04,0.06,0.04,  0.01,0.01,-0.03])
    nodesP = np.zeros([6,2])
    nodesC = np.zeros([5,2])
    
    nodesP[1:,0] = np.array([0.0,0.1,0.4,0.75,1.0])
    nodesP[1:-1,1] = x[:4]
    
    nodesC[1:,0] = np.array([0.3,0.6,0.9,1.0])
    nodesC[1:-1,1] = x[4:]

    curveUp = BezierCurve(nodesP)
    curveCamber = BezierCurve(nodesC)
    t = get_sine_distribution(nPts)
    
    
    ptsCamber = curveCamber(np.linspace(0,1,nPts))
    curveCamber2 = interp1d(ptsCamber[:,0],ptsCamber[:,1],'cubic')
    
    _ptsUp = curveUp(t)
    ptsUpX = _ptsUp[:,0]
    ptsUpY = _ptsUp[:,1] + curveCamber2(_ptsUp[:,0])
    ptsLoY = -_ptsUp[:,1] + curveCamber2(_ptsUp[:,0])
    ptsUp = np.transpose(np.vstack([ptsUpX,ptsUpY]))
    ptsLo = np.transpose(np.vstack([ptsUpX,ptsLoY]))

    if show:
        plt.figure()
        plt.hold(True)
        plt.plot(nodesP[:,0],nodesP[:,1],'rs--')
        plt.plot(nodesC[:,0],nodesC[:,1],'bs--')
        plt.plot(ptsUpX,ptsUpY,'k-')
        plt.plot(ptsUpX,ptsLoY,'k-')
        plt.plot(ptsCamber[:,0],ptsCamber[:,1],'g-')
        plt.axis('equal')
        plt.show()
    
    return ptsUp, ptsLo