Example #1
0
def diff_blade_plot(shw=False):
    inputData = [
        51.5, 90 - 15.92, 8., 1.1817, 75.4075, 29.2, 1., .0555, .0220, 30., 2.0
    ]
    turbine1 = SuctionSide.functionOfLambda(inputData, ('affineangle', ),
                                            'param', ('affinechord', ),
                                            'average', False)
    turbine2 = PressureSide(inputData, 'param', ('chordlength', ), 'radius')
    leading, trailing = leadingEdge(inputData), trailingEdge(inputData)
    fig = plt.figure(facecolor='white')
    turbine1(3.2).plot2D(100, False, fig, False, 'k-.')
    turbine1(3.3).plot2D(100, False, fig, False, 'k:')
    turbine1(3.4).plot2D(100, False, fig, False, 'k--')
    turbine2.plot2D(100, False, fig, False)
    leading.plot2D(100, False)
    trailing.plot2D(100, False)
    ax = plt.gca()
    ax.axis([-0.01, 1.01, -0.1, 1.3])
    ax.set_frame_on(False)
    ax.axes.get_yaxis().set_visible(False)
    ax.axes.get_xaxis().set_visible(False)
    ax.set_aspect('equal')
    if not shw:
        plt.savefig('../../latex/img/diff_blade_curve.pdf',
                    format='pdf',
                    dpi=1200,
                    bbox_inches='tight',
                    pad_inches=0)
    if shw:
        plt.show()
Example #2
0
def new_der_plot(shw=False):
    inputData = [
        51.5, 90 - 15.92, 8., 1.1817, 75.4075, 29.2, 1., .0555, .0220, 30., 2.0
    ]
    lambd = 3.4
    turbine1 = SuctionSide.functionOfLambda(inputData, ('affineangle', ),
                                            'fastparam', ('uniform', ),
                                            'average', False)
    turbine2 = PressureSide(inputData, 'fastparam', ('uniform', ), 'radius')
    leading, trailing = leadingEdge(inputData), trailingEdge(inputData)
    fig = plt.figure(facecolor='white')
    turbine1(lambd).plot2D(100, True, fig)
    turbine2.plot2D(100, True, fig, False)
    leading.plot2D(100, False)
    trailing.plot2D(100, False)

    ax = plt.gca()
    ax.set_frame_on(False)
    ax.get_xaxis().tick_bottom()
    ax.get_yaxis().tick_left()
    ax.set_aspect('equal')

    xticks = ax.xaxis.get_major_ticks()
    xticks[1].label1.set_visible(False)
    xticks[2].label1.set_visible(False)
    xticks[3].label1.set_visible(False)
    xticks[4].label1.set_visible(False)
    yticks = ax.yaxis.get_major_ticks()
    yticks[0].label1.set_visible(False)
    yticks[2].label1.set_visible(False)
    yticks[3].label1.set_visible(False)
    yticks[4].label1.set_visible(False)
    yticks[5].label1.set_visible(False)
    yticks[7].label1.set_visible(False)
    yticks[8].label1.set_visible(False)

    xmin, xmax = ax.get_xaxis().get_view_interval()
    ymin, ymax = ax.get_yaxis().get_view_interval()
    ax.add_artist(
        Line2D((xmin, xmax), (ymin, ymin), color='black', linewidth=2))
    ax.add_artist(
        Line2D((xmin, xmin), (ymin, ymax), color='black', linewidth=2))

    if not shw:
        plt.savefig('../../latex/img/new_der_curve.pdf',
                    format='pdf',
                    dpi=1200,
                    bbox_inches='tight',
                    pad_inches=0)
    if shw:
        plt.show()
Example #3
0
def arcsplot(shw=False):
    #    inputData = [51.5, 90-15.92, 8., 1.1817, 75.4075, 29.2, 1., .0555, .0220, 30., 2.0]
    #    inputData = [90-44.5, 90-21.8, 14.8, .825, 24.4424, 29.2, 1., .0662, .0228, 27.5, 6.5]
    inputData = [
        51.5, 90 - 15.92, 8., 1.1817, 75.4075, 29.2, 1., .0555, .0220, 30., 2.0
    ]
    beta1, beta2, GAMMA, tau, betag, gamma, Bx, R1, R2, dbeta1, dbeta2 = inputData

    beta1 = radians(beta1)
    beta2 = radians(beta2)
    dbeta1 = radians(dbeta1)
    dbeta2 = radians(dbeta2)
    betag = radians(betag)
    gamma = radians(gamma)
    GAMMA = radians(GAMMA)
    chord = (Bx - R1 * (1 - np.cos(beta1)) - R2 *
             (1 - np.cos(beta2))) / np.cos(gamma)
    height = chord * np.sin(gamma) + R1 * np.sin(beta1) - R2 * np.sin(beta2)

    #    suct_side, cond = Turbine.by_conditions(*inputData,lambd = None)
    suct_side = SuctionSide.functionOfLambda(inputData, ('affineangle', ),
                                             'param', ('affinechord', ),
                                             'average', True)(3.4)
    pres_side = PressureSide(inputData, 'param', ('chordlength', ), 'radius')
    circle1 = Crv.Circle(R1, [R1, height])
    circle2 = Crv.Circle(R2, [Bx - R2, 0])
    tmp = 2.6
    fig = plt.figure(figsize=(tmp * 7.2727272727272727, tmp * 10))
    ax1 = fig.add_subplot(121)
    ax1.axis([-.3, 1.3, -.2, 1.5])
    ax1.set_aspect(1)
    tvals = np.linspace(0, 1, 201)
    circ1 = circle1(tvals)[:2]
    circ2 = circle2(tvals)[:2]
    suct1 = suct_side(tvals[:20])[:2]
    pres1 = pres_side(tvals[-40:])[:2]
    suct2 = suct_side(tvals[-135:])[:2]
    suct3 = suct_side(tvals[-25:])[:2]
    pres2 = pres_side(tvals[:30])[:2]
    ax1.plot(circ1[0, :], circ1[1, :], 'k')
    ax1.plot(pres1[0, :], pres1[1, :], 'k')
    ax1.plot(suct1[0, :], suct1[1, :], 'k')

    ax1.plot(circ2[0, :], circ2[1, :], 'k')
    ax1.plot(pres2[0, :], pres2[1, :], 'k')
    ax1.plot(suct2[0, :], suct2[1, :], 'k')

    ax1.plot(circ2[0, :], circ2[1, :] + tau, 'k')
    ax1.plot(pres2[0, :], pres2[1, :] + tau, 'k')
    ax1.plot(suct3[0, :], suct3[1, :] + tau, 'k')

    #plotting x and y axis
    ax1.annotate(
        "",
        xy=(-0.3, 0),
        xycoords='data',
        xytext=(1.2, -0.0),
        textcoords='data',
        arrowprops=dict(arrowstyle="<-", connectionstyle="arc3"),
    )
    ax1.annotate(
        "",
        xy=(0, -.2),
        xycoords='data',
        xytext=(-0.0, .8),
        textcoords='data',
        arrowprops=dict(arrowstyle="<-", connectionstyle="arc3"),
    )
    ax1.annotate(
        r'$x$',
        xy=(-0.15, height),
        xytext=(1.16, -0.07),
    )
    ax1.annotate(
        r'$y$',
        xy=(-0.15, height),
        xytext=(-0.07, .77),
    )

    line_y = lambda x, (x0, x1), (y0, y1): (x - x0) * (y1 - y0) / (x1 - x0
                                                                   ) + y0
    sslope1 = lambda x: line_y(x, suct1[0, :2], suct1[1, :2])
    pslope1 = lambda x: line_y(x, pres1[0, -2:], pres1[1, -2:])
    mslope1 = lambda x: line_y(x, (-0.08, R1), (pslope1(-0.08), height))
    ax1.plot(np.linspace(-.08, 0, 101), sslope1(np.linspace(-.08, 0, 101)),
             'k-.')
    ax1.plot(np.linspace(-.08, 0.1, 101), pslope1(np.linspace(-.08, .1, 101)),
             'k-.')
    ax1.plot(np.linspace(-.08, R1, 101), mslope1(np.linspace(-.08, R1, 101)),
             'k-.')
    ax1.plot(np.linspace(-.18, R1, 101), height * np.ones(101), 'k-.')

    #plotting s1 and s5
    s1tmp = suct_side.pnt3D([0])
    s5tmp = suct_side.pnt3D([1])
    ax1.plot(s1tmp[0], s1tmp[1], 'ko')
    ax1.annotate(
        r'$s_1$',
        xy=(-0.15, 0),
        xytext=(0.4 * R1, height + 0.03),
    )
    ax1.plot(s5tmp[0], s5tmp[1], 'ko')
    ax1.annotate(
        r'$s_5$',
        xy=(-0.15, 0),
        xytext=(Bx, 0.02),
    )

    #plotting p1 and p4
    p1tmp = pres_side.pnt3D([1])
    p4tmp = pres_side.pnt3D([0])
    ax1.plot(p1tmp[0], p1tmp[1], 'ko')
    ax1.annotate(
        r'$p_1$',
        xy=(-0.15, 0),
        xytext=(1.83 * R1, height - 0.05),
    )
    ax1.plot(p4tmp[0], p4tmp[1], 'ko')
    ax1.annotate(
        r'$p_4$',
        xy=(-0.15, 0),
        xytext=(Bx - 0.07, -0.04),
    )

    #plotting theta1, theta2
    theta1line = lambda x: line_y(x, (s1tmp[0], R1), (s1tmp[1], height))
    ax1.plot(R1, height, 'k.')
    ax1.plot(np.linspace(-.18, R1, 101), theta1line(np.linspace(-.18, R1,
                                                                101)), 'k-')
    ax1.annotate(
        "",
        xy=(-0.12, theta1line(-0.12)),
        xycoords='data',
        xytext=(-0.137, height),
        textcoords='data',
        arrowprops=dict(arrowstyle="<->", connectionstyle="arc3,rad=-0.1"),
    )
    ax1.annotate(
        r'$\theta_s$',
        xy=(-0.15, 0),
        xytext=(-0.18, height + 0.036),
    )

    thetaarc = Crv.Arc(1.7 * R1, [R1, height], -0.8, 0.95 * pi)
    arc1 = thetaarc(tvals)[:2]
    ax1.plot(arc1[0, :], arc1[1, :], 'k')

    theta2line = lambda x: line_y(x, (R1, p1tmp[0]), (height, p1tmp[1]))
    ax1.plot(np.linspace(R1, 0.23, 101), theta2line(np.linspace(R1, 0.23,
                                                                101)), 'k-')
    ax1.annotate(
        "",
        xy=(arc1[0, -1], height + 0.01),
        xycoords='data',
        xytext=(-0.04, height),
        textcoords='data',
        arrowprops=dict(arrowstyle="<-", connectionstyle="arc3,rad=.0"),
    )
    ax1.annotate(
        "",
        xy=(arc1[0, 0], arc1[1, 0]),
        xycoords='data',
        xytext=(0.113 - 0.005, theta2line(0.113) - 0.005),
        textcoords='data',
        arrowprops=dict(arrowstyle="<-", connectionstyle="arc3,rad=.0"),
    )
    ax1.annotate(
        r'$\theta_p$',
        xy=(-0.15, 0),
        xytext=(0.12, height + 0.09),
    )
    thetaarc = Crv.Arc(1.7 * R1, [R1, height], -0.8, 0.95 * pi)
    arc1 = thetaarc(tvals)[:2]
    ax1.plot(arc1[0, :], arc1[1, :], 'k')

    #plotting s3 and its angles
    s3tmp = suct_side.pnt3D([0.617])
    ax1.plot(s3tmp[0], s3tmp[1], 'ko')
    ax1.annotate(
        r'$s_3$',
        xy=(-0.15, height + tau / 2),
        xytext=(Bx - 0.375, tau - .125),
    )
    ax1.plot((s3tmp[0], Bx - R2), (s3tmp[1], tau), 'k-')
    ax1.plot((s3tmp[0], Bx - R2), (s3tmp[1], s3tmp[1]), 'k-')
    ax1.plot((Bx - R2, Bx - R2), (s3tmp[1], tau), 'k-')
    ax1.annotate(
        r'$A$',
        xy=(-0.15, height + tau / 2),
        xytext=(Bx - 0.175, tau - .155),
    )
    ax1.annotate(
        r'$B$',
        xy=(-0.15, height + tau / 2),
        xytext=(Bx - 0.02, tau - .069),
    )
    ax1.annotate(
        "",
        xy=(Bx - 0.14, s3tmp[1]),
        xycoords='data',
        xytext=(Bx - 0.15, s3tmp[1] + 0.07),
        textcoords='data',
        arrowprops=dict(arrowstyle="<->", connectionstyle="arc3,rad=-.1"),
    )
    ax1.annotate(
        r'$\pi/2-(\beta_2-\Gamma)$',
        xy=(Bx - 0.14, s3tmp[1] + 0.04),
        xytext=(Bx + 0.06, tau - .089),
        arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=-.1"),
    )

    ax1.set_frame_on(False)
    ax1.axes.get_yaxis().set_visible(False)
    ax1.axes.get_xaxis().set_visible(False)

    if not shw:
        fig.savefig('../../latex/img/angle_blades.pdf',
                    format='pdf',
                    dpi=1200,
                    bbox_inches='tight',
                    pad_inches=0)
    else:
        plt.show()