Exemplo n.º 1
0
def ConfigD():
    r = prep("ConfigD\\Results.csv")

    params = {"ps.fonttype": 3}
    pylab.rcParams.update(params)

    f = pylab.figure(figsize=(3.5, 2.5))
    ax = f.add_axes((0.18, 0.15, 0.75, 0.80))
    for i in [4]:
        ax.plot(r["delta_radial"][i * 7 : (i + 1) * 7], r["eta_c"][i * 7 : (i + 1) * 7])
    ax.set_xlabel(r"$\delta_{radial}$, $\delta_{flank}$ [$\mu$m]", size=10)
    ax.set_ylabel("Overall Isentropic Efficiency [-]", size=10)
    ax.set_ylim(0.7, 0.9)
    f.savefig("ConfigDetac.pdf")
    f.savefig("ConfigDetac.eps")
    f.savefig("ConfigDetac.png", dpi=600)

    pylab.close()
Exemplo n.º 2
0
def ConfigC():

    ##     T1=278.0
    ##     p1=500.0
    ##     p2=1850.0
    ##     pratio=p2/p1
    ##     xlv=np.linspace(0,1,5000)
    ##     kstar=np.zeros_like(xlv)
    ##     Vratio=np.zeros_like(xlv)
    ##     Vratiostar=np.zeros_like(xlv)
    ##     a=np.zeros_like(xlv)
    ##     for i in range(len(xlv)):
    ##         xl=xlv[i]
    ##         a[i]=1-FP.VoidFrac('N2','Zerol',T1,p1,xl)
    ##         kstar[i]=FP.kstar_m('N2','Zerol',T1,p1,xl)
    ##         Vratiostar[i]=pratio**(1.0/kstar[i])
    ##         Vratio[i]=Vratiostar[i]/(1-a[i]+a[i]*Vratiostar[i])
    ##
    ##     def OBJECTIVE_xl(xl):
    ##         xl=xl[0]
    ##         a=1-FP.VoidFrac('N2','Zerol',T1,p1,xl)
    ##         kstar=FP.kstar_m('N2','Zerol',T1,p1,xl)
    ##         Vratiostar=pratio**(1.0/kstar)
    ##         Vratio=Vratiostar/(1-a+a*Vratiostar)
    ##         return 1/Vratio
    ##
    ##     xl=fmin(OBJECTIVE_xl,0.7)
    ##     print xl
    ##     f=pylab.figure(figsize=(3.5,2.5))
    ##     ax=f.add_axes((0.15,0.15,0.70,0.80))
    ##     ax.plot(xlv,Vratiostar,'k')
    ##     ax.plot(xlv,Vratio,'b')
    ##     ax.plot(xl,1/OBJECTIVE_xl(xl),'bo',ms=3,mew=1,mec='b',mfc='none',lw=0.3)
    ##     ax.set_xlabel('$x_l$ [-]',size=10)
    ##     ax.set_ylabel('Volume Ratios [-]',size=10)
    ##     ax.set_ylim(2.4,4.2)
    ##     ax.set_yticks(np.linspace(2.4,4.2,10))
    ##     ax2=ax.twinx()
    ##     ax2.plot(xlv,kstar,'r')
    ##     ax2.set_ylabel('$k^{*}$ [-]',size=10,color='r')
    ##     ax.text(0.7,2.7,'$k^{*}$',color='r')
    ##     ax.text(0.7,3.6,'$V_{ratio}^{*}$',color='k',rotation=21)
    ##     ax.text(0.8,3.25,'$V_{ratio}$',color='b',ha='center')
    ##     f.savefig('ConfigCVratioIdeal.pdf')
    ##     f.savefig('ConfigCVratioIdeal.eps')
    ##     f.savefig('ConfigCVratioIdeal.png',dpi=600)
    ##     pylab.close()

    def Vratio(Ref, Liq, T1, p1, xl, p2, eta=1.0):
        h1 = FP.h_m(Ref, Liq, T1, p1, xl)
        s1 = FP.s_m(Ref, Liq, T1, p1, xl)
        h2s = FP.h_sp(Ref, Liq, s1, p2, xl, T1)
        h2 = (h2s - h1) / eta + h1
        T2 = FP.T_hp(Ref, Liq, h2, p2, xl, T1)
        rho1 = FP.rho_m(Ref, Liq, T1, p1, xl)
        rho2s = FP.rho_m(Ref, Liq, T2, p2, xl)
        Vratio = rho2s / rho1
        return Vratio

    T1 = 278
    p1 = 500
    p2 = 1850
    pratio = p2 / p1
    Ref = "Nitrogen"
    fig = pylab.figure(figsize=(3.5, 2.5))
    ax = fig.add_axes(ConfigCAxes)
    ax.set_ylim((1.0, 3.5))
    # First the ideal curve for N2 and Zerol
    XL = []
    VRATIO = []
    Liq = "Zerol"
    for xl in np.linspace(0, 1.0, 100):
        XL.append(xl)
        VRATIO.append(Vratio(Ref, Liq, T1, p1, xl, p2, eta=1.0))
    pylab.plot(XL, VRATIO, "b", lw=1, label="Ideal")
    (x, y, rot) = InlineLabel(XL, VRATIO, 0.2, axis=ax)
    pylab.text(
        x,
        y,
        "Ideal",
        ha="center",
        va="center",
        rotation=rot,
        rotation_mode="anchor",
        bbox=dict(boxstyle="round", color="white", ec="none", alpha=0.9),
    )
    # Next the 60% curve for N2 and Zerol
    XL = []
    VRATIO = []
    Liq = "Zerol"
    for xl in np.linspace(0, 1.0, 100):
        XL.append(xl)
        VRATIO.append(Vratio(Ref, Liq, T1, p1, xl, p2, eta=0.6))
    pylab.plot(XL, VRATIO, "b--", label="$\eta$=0.6")
    (x, y, rot) = InlineLabel(XL, VRATIO, 0.2, axis=ax)
    pylab.text(
        x,
        y,
        "$\eta_a$ = 0.6",
        ha="center",
        va="center",
        rotation=rot,
        rotation_mode="anchor",
        bbox=dict(boxstyle="round", color="white", ec="none", alpha=0.9),
    )
    print interp1d(XL, VRATIO)(0.8796)

    pylab.xlabel("$x_l$ [-]")
    pylab.ylabel("$V_{ratio}$ [-]")
    pylab.savefig("VratioN2Zerol.pdf")
    pylab.savefig("VratioN2Zerol.eps")
    pylab.savefig("VratioN2Zerol.png", dpi=600)

    pylab.close()

    r = prep("ConfigC\\Results.csv")

    f = pylab.figure(figsize=(3.5, 2.5))
    ax = f.add_axes(ConfigCAxes)
    N = 19
    VratioList = ["1.8", "2.1", "2.4", "2.7", "3.0"]
    mt = ["-o", "-s", "-*", "-^", "-<"]
    for i in range(4, -1, -1):
        rb = r["rb"][i * N : (i + 1) * N] * 1000
        eta_c = r["eta_c"][i * N : (i + 1) * N]
        ax.plot(rb, eta_c, mt[i], ms=4, label="$V_{ratio}$ = " + VratioList[i], mec="none", mew=0.1)
    pylab.xlabel(r"Base circle radius [mm]")
    pylab.ylabel(r"Overall isentropic efficiency [-]")
    leg = pylab.legend(loc="lower center", numpoints=1)
    frame = leg.get_frame()
    frame.set_linewidth(0.5)
    pylab.savefig("ConfigCeta_c.pdf")
    pylab.savefig("ConfigCeta_c.eps")
    pylab.savefig("ConfigCeta_c.png", dpi=600)
    pylab.close()

    ##     rbv=np.linspace(0.0025,0.006,20)
    ##     Vratiov=np.linspace(1.8,3.0,20)
    ##     (RBV,VRATIOV)=np.meshgrid(rbv,Vratiov)
    ##     ETA=0.0*RBV
    ##     for i in range(len(rbv)):
    ##         for j in range(len(Vratiov)):
    ##             rb=rbv[i]
    ##             vratio=Vratiov[j]
    ##             eta_c=-4.584697022+1084.03786637*rb-321163.091505*rb**(2)-38337008.4761*rb**(3)+11489934645.8*rb**(4)+2.63651770137e+12*rb**(5)-3.85103217203e+14*rb**(6)-1.63350067385e+17*rb**(7)+3.68493663615e+19*rb**(8)-2.10073219716e+21*rb**(9)-0.211549615641*vratio+0.253758321903*vratio**(2)+0.132426017479*vratio**(3)+0.0342253390286*vratio**(4)-0.000798476328877*vratio**(5)-0.00613563590463*vratio**(6)-0.00348600045232*vratio**(7)-0.000729077772629*vratio**(8)+0.000600849416383*vratio**(9)+29.15885081*rb**(+0.2927852684)*vratio**(-1.115372635)+213.1143723*rb*vratio-32.78419709*rb*vratio**2-604.6535839*rb**2*vratio
    ##             ETA[i,j]=eta_c
    ##     fig=pylab.figure(figsize=(3.25,3.25))
    ##     CS=pylab.contour(RBV*1000,VRATIOV,ETA,[0.65,0.675,0.7,0.71,0.72],colors='k',lw=1.5)
    ##     pylab.clabel(CS,fontsize=10,inline=1,fmt='%1.3f %%')
    ##     pylab.close()

    f = pylab.figure(figsize=(3.5, 2.5))
    ax = f.add_axes(ConfigCAxes)
    i = 3
    rb = r["rb"][i * N : (i + 1) * N] * 1000
    rad = r["leakageradial"][i * N : (i + 1) * N]
    flank = r["leakageflank"][i * N : (i + 1) * N]
    ax.plot(rb, rad, "-o", ms=4, label="Radial", mec="none", mew=0.1)
    ax.plot(rb, flank, "-s", ms=4, label="Flank", mec="none", mew=0.1)
    ax.plot(rb, rad + flank, "k-", ms=4, label="Total", mec="none", mew=0.1, lw=1)
    pylab.text(4.8, 0.22, "Flank", rotation=-15, ha="center", va="center")
    pylab.text(4.8, 0.6, "Radial", rotation=27, ha="center", va="center")
    pylab.text(4.8, 0.94, "Total", rotation=15, ha="center", va="center")
    pylab.xlabel(r"Base circle radius [mm]")
    pylab.ylabel(r"Leakage terms [kW]")
    ##     pylab.legend(loc='center right',numpoints=1)
    pylab.savefig("ConfigCleakage.pdf")
    pylab.savefig("ConfigCleakage.eps")
    pylab.savefig("ConfigCleakage.png", dpi=600)
    pylab.close()

    phi_i0 = r["phi_i0"][i * N : (i + 1) * N]
    phi_is = r["phi_is"][i * N : (i + 1) * N]
    phi_ie = r["phi_ie"][i * N : (i + 1) * N]
    phi_o0 = r["phi_o0"][i * N : (i + 1) * N]
    phi_os = r["phi_os"][i * N : (i + 1) * N]
    phi_oe = r["phi_oe"][i * N : (i + 1) * N]
    rb = r["rb"][i * N : (i + 1) * N]
    h = r["hs"][i * N : (i + 1) * N]
    disc_x0 = r["x_port"][i * N : (i + 1) * N]
    disc_y0 = r["y_port"][i * N : (i + 1) * N]
    disc_R = r["r_port"][i * N : (i + 1) * N]
    radialleak = r["leakageradial"][i * N : (i + 1) * N]

    delta = 12e-6
    f = pylab.figure(figsize=(3.5, 2.5))
    ax = f.add_axes(ConfigCAxes)
    A_radial = 2 * delta * rb * (phi_ie * phi_ie / 2 - phi_is * phi_is / 2 - phi_i0 * (phi_ie - phi_is)) * 1e6
    Nfl = (phi_ie - phi_os - 2 * pi) / (2 * pi)
    A_flank = 2 * Nfl * delta * h * 1e6

    pylab.plot(rb * 1000, A_radial)
    pylab.plot(rb * 1000, A_flank)
    pylab.plot(rb * 1000, A_flank + A_radial)
    pylab.xlabel(r"Base circle radius [mm]")
    pylab.ylabel(r"Leakage area [mm$^2$]")
    pylab.savefig("ConfigCleakArea.pdf")
    pylab.savefig("ConfigCleakArea.eps")
    pylab.savefig("ConfigCleakArea.png", dpi=600)
    pylab.close()
Exemplo n.º 3
0
def EricssonLosses():
    r = prep("Validation\\Results.csv")
    ##     print r.dtype.names

    f = pylab.figure(figsize=(3.5, 3.5))
    ax = f.add_axes((0.13, 0.11, 0.82, 0.84))
    y = (
        r["leakageflank"]
        + r["leakageradial"]
        + r["suction"]
        + r["discharge"]
        + r["mechanical"]
        + r["w_adiabatic"]
        + r["q_scroll_amb"]
        + r["heattransfer"]
    )
    x = r["p_shaft"]
    ax.plot(x, y, "bo", ms=4)
    ax.plot(np.r_[0, 5], np.r_[0, 5], "k")
    ax.plot(np.r_[0, 5], np.r_[0, 5 * 0.97], "k--", lw=0.5)
    ax.plot(np.r_[0, 5], np.r_[0, 5 * 1.03], "k--", lw=0.5)
    ax.text(3.8 + 0.05, 0.97 * 3.8, "-3%", ha="left", va="top")
    ax.text(3.6 - 0.05, 1.03 * 3.6, "+3%", ha="right", va="bottom")
    ax.set_xlim(2, 5)
    ax.set_ylim(2, 5)
    ax.set_xlabel("Experimental Shaft Power [kW]")
    ax.set_ylabel("Losses+Adiabatic Power [kW]")
    f.savefig("EricssonLosses.pdf")
    f.savefig("EricssonLosses.eps")
    f.savefig("EricssonLosses.png", dpi=600)
    pylab.close()

    ind = np.arange(27)  # the x locations for the groups
    width = 0.8  # the width of the bars: can also be len(x) sequence

    xL = r["xl"]
    pratio = r["p_out"] / r["p_in"]
    flank = r["leakageflank"]
    rad = r["leakageradial"]
    suct = r["suction"]
    disc = r["discharge"]
    mech = r["mechanical"]
    adia = r["w_adiabatic"]

    f = pylab.figure(figsize=(3.5, 3.5))
    ax = f.add_axes((0.1, 0.12, 0.85, 0.83))

    tot = adia + flank + rad + suct + disc
    l6 = pylab.bar(ind, mech, width, color="k", bottom=tot, lw=0.4, label="Mechanical")
    tot = tot - disc
    l5 = pylab.bar(ind, disc, width, color="c", bottom=tot, lw=0.4, label="Discharge")
    tot = tot - suct
    l4 = pylab.bar(ind, suct, width, color="g", bottom=tot, lw=0.4, label="Suction")
    tot = tot - rad
    l3 = pylab.bar(ind, rad, width, color="yellow", bottom=tot, lw=0.4, label="Radial")
    tot = tot - flank
    l2 = pylab.bar(ind, flank, width, color="r", bottom=tot, lw=0.4, label="Flank")
    tot = tot - adia
    l1 = pylab.bar(ind, adia, width, color="b", bottom=tot, lw=0.4, label="Adiabatic")

    ax.set_xlabel("Run Number [-]")
    ax.set_ylabel("Power terms [kW]")
    ax.set_ylim(0, 5)
    leg = ax.legend(loc="lower right")
    frame = leg.get_frame()
    frame.set_linewidth(0.5)
    f.savefig("ExperimentLosses.pdf")
    f.savefig("ExperimentLosses.eps")
    f.savefig("ExperimentLosses.png", dpi=600)
    pylab.close()

    f = open("EricssonTable.tex", "w")
    head = "%Made from paperIII.py function EricssonData()\n"
    head = head + r"\begin{table}[ht]" + "\n"
    head = head + r"\setlength{\tabcolsep}{3pt}" + "\n"
    head = head + r"\renewcommand*\arraystretch{1.0}" + "\n"
    head = head + r"\centering" + "\n"
    head = (
        head
        + r"\caption{Irreversibility generation components for each experimental testing point from LFEC experimental testing}"
        + "\n"
    )
    head = head + r"\label{tab:EricssonLosses}" + "\n"
    head = head + r"\begin{tabular}{*{%d}{c}}" % 9 + "\n"
    head = head + r"\hline\hline" + "\n"
    head = head + r"Run& $p_r$ & $x_l$ & $\dot W_{ad}$  & Rad. & Flank  & Suct. & Disc.& Mech." + r"\\" + "\n"
    head = head + r"\#& - & - & kW  & kW & kW  & kW & kW& kW" + r"\\" + "\hline\n"
    f.write(head)

    for i in range(len(flank)):
        flank = r["leakageflank"][i]
        rad = r["leakageradial"][i]
        suct = r["suction"][i]
        disc = r["discharge"][i]
        mech = r["mechanical"][i]
        adia = r["w_adiabatic"][i]
        xL = r["xl"][i]
        pratio = r["p_out"][i] / r["p_in"][i]
        data = "%d & %0.2f & \multicolumn{1}{c|}{%0.2f} & %0.2f & %0.2f & %0.2f & %0.2f & %0.2f & %0.2f" % (
            i + 1,
            pratio,
            xL,
            adia,
            rad,
            flank,
            suct,
            disc,
            mech,
        )
        f.write(data + r"\\" + "\n")

    f.write(r"\hline\hline" + "\n")
    f.write(r"\end{tabular}" + "\n")
    f.write(r"\end{table}" + "\n")
    f.close()

    def ThreeD():
        N1 = 0
        N2 = 9
        xL = r["xl"][N1:N2]
        pratio = r["p_out"][N1:N2] / r["p_in"][N1:N2]
        flank = r["leakageflank"][N1:N2]
        rad = r["leakageradial"][N1:N2]
        suct = r["suction"][N1:N2]
        disc = r["discharge"][N1:N2]
        mech = r["mechanical"][N1:N2]
        adia = r["w_adiabatic"][N1:N2]
        f = pylab.figure(figsize=(3.5, 3.5))
        ax = f.add_subplot(111, projection="3d")

        dx = 0.01 * np.ones_like(pratio)
        dy = 0.03 * np.ones_like(pratio)

        tot3 = adia + flank + rad + suct + disc
        ##     print xL,pratio,tot3,dx,dy,mech
        l6 = ax.bar3d(xL, pratio, tot3, dx, dy, mech, color="k", lw=0.4, label="Mechanical", alpha=1.0)
        tot3 = tot3 - disc
        l5 = ax.bar3d(xL, pratio, tot3, dx, dy, disc, color="c", lw=0.4, label="Discharge", alpha=1.0)
        tot3 = tot3 - suct
        l5 = ax.bar3d(xL, pratio, tot3, dx, dy, suct, color="yellow", lw=0.4, label="Suction", alpha=1.0)
        tot3 = tot3 - rad
        l5 = ax.bar3d(xL, pratio, tot3, dx, dy, rad, color="g", lw=0.4, label="Radial", alpha=1.0)
        tot3 = tot3 - flank
        l5 = ax.bar3d(xL, pratio, tot3, dx, dy, flank, color="r", lw=0.4, label="Flank", alpha=1.0)
        tot3 = tot3 - adia
        l5 = ax.bar3d(xL, pratio, tot3, dx, dy, adia, color="b", lw=0.4, label="Adiabatic", alpha=1.0)

        ax.set_xlabel("Oil Mass Fraction [-]")
        ax.set_zlabel("Pressure Ratio [-]")
        ax.set_zlabel("Power terms [kW]")
        ##     ax.set_ylim(0,5)
        ax.legend(loc="lower right")
        f.savefig("ExperimentLosses3D.pdf")
        f.savefig("ExperimentLosses3D.eps")
        f.savefig("ExperimentLosses3D.png", dpi=600)
        pylab.close()
Exemplo n.º 4
0
def ConfigA():
    r = prep("ConfigA\\Results.csv")

    ##     print r.dtype.names
    w = 3.5
    h = 3.5
    d = 0.15
    f = pylab.figure(figsize=(3.5, 3.5))
    ax = f.add_axes((0.1, 0.1, 0.8, 0.8))
    data = np.r_[r["leakageflank"], r["leakageradial"], r["suction"], r["discharge"], r["mechanical"]]
    labels = ["Leakage\n(flank)", "Leakage\n(radial)", "Suction", "Discharge", "Mechanical"]
    (path, labelText, pcts) = ax.pie(data, labels=labels, autopct="%0.1f%%", colors=["yellow", "g", "r", "c", "m"])
    [t.set_size(8) for t in labelText]
    [p.set_size(8) for p in pcts]
    [p.set_linewidth(0.5) for p in path]
    f.savefig("ConfigALossPie.pdf")
    f.savefig("ConfigALossPie.eps", set_bbox="tight")
    f.savefig("ConfigALossPie.png", dpi=600)
    pylab.close()

    path = "ConfigA\\Run 0001"
    pi = np.pi
    axes_size = (0.15, 0.18, 0.8, 0.77)
    theta = np.loadtxt(path + "/" + "theta.csv", delimiter=",")
    p = np.loadtxt(path + "/" + "p.csv", delimiter=",")
    p = np.where(p < 1e-10, np.nan, p)
    # Plot data
    fig = pylab.figure(num=1, figsize=(3.5, 2.5))
    pylab.axes(axes_size)
    ##pylab.subplot(131)
    pylab.plot(theta, p[1, :], label="$p_s$")
    pylab.plot(theta, p[9, :], label="$p_{c1-1}$")
    pylab.plot(theta, p[2, :], label="$p_{d1}$")
    pylab.plot(theta, p[6, :], label="$p_{ddd}$")
    pylab.plot(theta, p[5, :], label="$p_{dd}$")
    pylab.plot(theta, p[7, :], "k--", label="$p_{dd}$")
    pylab.plot(theta, p[8, :], "k--")
    pylab.text(3 * pi / 2.0, 500 + 10, "Suction", ha="center", va="bottom", size=8)
    pylab.text(pi / 2.0, 1850 - 10, "Discharge", ha="center", va="top", size=8)
    pylab.text(7 * pi / 4.0, 440, "$s_1$", ha="center", va="top", size=10, color="b")
    pylab.text(pi, 830, "$c_1$", ha="left", va="top", size=10, color="g")
    pylab.text(3 * pi / 2, 1150, "$d_1$", ha="left", va="top", size=10, color="r")
    pylab.text(3 * pi / 2, 1700, "$dd$", ha="center", va="top", size=10, color="m")
    pylab.plot(np.r_[1.36 * pi, 1.36 * pi], np.r_[900, 2200], "k--")
    pylab.text(1.36 * pi - 0.05, 1450, "Discharge Angle", rotation=90, size=7, ha="right", va="center")
    pylab.plot(np.r_[1.72 * pi, 1.72 * pi], np.r_[900, 2200], "k--")
    pylab.text(1.72 * pi + 0.05, 1000, "Merge", rotation=90, size=7, ha="left", va="center")
    pylab.text(3 * pi / 4, 2050, "ddd", color="c", ha="center", va="center")

    pylab.xticks([0, pi / 2, pi, 3 * pi / 2, 2 * pi], ("0", "$\pi$/2", "$\pi$", "3$\pi$/2", "2$\pi$"))
    pylab.xlim([0, 2 * pi])
    pylab.ylim([300, 2200])
    pylab.xlabel(r"$\theta $ [radians]")
    pylab.ylabel(r"Pressure [kPa]")
    pylab.savefig("ConfigAPressure.pdf")
    pylab.savefig("ConfigAPressure.eps")
    pylab.savefig("ConfigAPressure.png", dpi=600)
    pylab.close()

    geo = ps.geoVals()
    ps.plotScrollSet(theta=3 * pi / 2.0, discOn=True, lw=1)
    pylab.savefig("ConfigAScrollSet.pdf")
    pylab.savefig("ConfigAScrollSet.eps")
    pylab.savefig("ConfigAScrollSet.png", dpi=600)
    pylab.close()