Esempio n. 1
0
def ConfigB():

    f = pylab.figure(figsize=(4, 2))
    ax = f.add_axes((0, 0, 0.5, 1))
    geo = ps.geoVals()
    ps.plotScrollSet(7 * 3.141592654 / 4, discOn=True, lw=1, geo=geo, axis=ax)
    pylab.gca().set_xlim((-0.017, 0.010))
    pylab.gca().set_ylim((-0.021, 0.006))

    ax = f.add_axes((0.5, 0, 0.5, 1))
    geo = ps.geoVals()
    ps.setDiscGeo(geo, "2Arc", 0.001)
    geo.disc_x0 = -0.00269898
    geo.disc_y0 = -0.00348883
    geo.disc_R = 0.01187952
    ps.plotScrollSet(7 * 3.141592654 / 4, discOn=True, lw=1, geo=geo, axis=ax)
    pylab.gca().set_xlim((-0.017, 0.010))
    a = -0.004
    pylab.gca().set_ylim((-0.021 - a, 0.006 - a))

    pylab.savefig("ConfigBDischargeBlockage.pdf")
    pylab.savefig("ConfigBDischargeBlockage.eps")
    pylab.savefig("ConfigBDischargeBlockage.png", dpi=400)
    pylab.close()

    path = "ConfigA\\Run 0001"
    A0 = np.loadtxt(path + "/" + "Adisc.csv", delimiter=",")
    path = "ConfigB\\Run 0001"
    A1 = np.loadtxt(path + "/" + "Adisc.csv", delimiter=",")
    path = "ConfigB\\Run 0005"
    A2 = np.loadtxt(path + "/" + "Adisc.csv", delimiter=",")
    path = "ConfigB\\Run 0009"
    A3 = np.loadtxt(path + "/" + "Adisc.csv", delimiter=",")

    pi = np.pi
    axes_size = (0.18, 0.20, 0.77, 0.74)

    fig = pylab.figure(figsize=(3.5, 2.5))
    pylab.axes(axes_size)

    pylab.plot(A0[:, 0], A0[:, 1] * 1000 ** 2, label="$p_s$")
    ##     pylab.plot(A1[:,0],A1[:,1]*1000**2,label='$p_s$')
    pylab.plot(A2[:, 0], A2[:, 1] * 1000 ** 2, label="$p_s$")
    ##     pylab.plot(A3[:,0],A3[:,1]*1000**2,label='$p_s$')

    pylab.text(0.9 * 3.14, 120, "Baseline", ha="center", va="bottom")
    pylab.text(0.8 * 3.14, 372, "Larger port", ha="center", va="bottom", rotation=7)

    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([0, 500])
    pylab.xlabel(r"$\theta $ [radians]")
    pylab.ylabel(r"Discharge Port Area [mm$^2$]")
    pylab.savefig("ConfigBAdisc.pdf")
    pylab.savefig("ConfigBAdisc.eps")
    pylab.savefig("ConfigBAdisc.png", dpi=600)
    pylab.close()

    path = "ConfigB\\Run 0005"
    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 + 0.2, 1800, "$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")
    th = 1.75 * pi
    pylab.plot(np.r_[th, th], np.r_[900, 2200], "k--")
    pylab.text(th + 0.05, 1000, "Merge", rotation=90, size=7, ha="left", va="center")
    pylab.text(3 * pi / 4, 1950, "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.ylim([300, 2200])
    pylab.xlim([0, 2 * pi])
    pylab.xlabel(r"$\theta $ [radians]")
    pylab.ylabel(r"Pressure [kPa]")
    pylab.savefig("ConfigBPressure.pdf")
    pylab.savefig("ConfigBPressure.eps")
    pylab.savefig("ConfigBPressure.png", dpi=600)
    pylab.close()
Esempio n. 2
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()