Exemplo n.º 1
0
def plot_condensation_curve(AR_min, AR_max, p_c, fp, T_ref):
    gamma = fp.get_specific_heat_ratio(T=T_ref,
                                       p=p_c)  # [-] Specific heat ratio

    # Determine maximum Mach number at exit
    M_exit_max = IRT.Mach_from_area_ratio(
        AR=AR_max, gamma=gamma)  # [-] Max. Mach number at exit
    M_exit_min = IRT.Mach_from_area_ratio(
        AR=AR_min, gamma=gamma)  # [-] Min. Mach number at exit
    M_exit = np.linspace(start=M_exit_min, stop=M_exit_max,
                         num=50)  # [-] Range of exit Mach numbers to evalulate

    # Determine pressure at exit
    PR_exit = IRT.pressure_ratio(M=M_exit,
                                 gamma=gamma)  # [-] Pressure ratio at exit
    p_exit = p_c / PR_exit  # [-] Exit pressure

    # Determine saturation temperature at exit
    T_sat_exit = fp.get_saturation_temperature(
        p=p_exit)  # [K] Saturation temperature at exit
    # print(p_exit)
    # print(T_sat_exit)
    TR_exit = IRT.temperature_ratio(
        M=M_exit, gamma=gamma)  # [-] Temperature ratio at exit
    T_chamber = T_sat_exit * TR_exit  # [K] Chamber temperature that would result precisely in saturation temperature at nozzle exit

    AR = IRT.area_ratio(
        M=M_exit, gamma=gamma
    )  # [-] Area ratios corresponding to all specified mach numbers

    plt.plot(
        AR,
        T_chamber,
        label="$p_c ={:2.0f}$ bar , $T_c={:3.0f}$ K, $\\gamma={:1.3f}$".format(
            p_c * 1e-5, T_ref, gamma))
Exemplo n.º 2
0
 def test_Anderson_table(self):
     # Anderson2016 has a table in the back of his book for area ratio vs. Mach numbers
     in_out = ((0.2e-1, 0.2894e2, 2), (0.1, 0.5822e1, 3), (0.5, 0.134e1, 3),
               (0.78, 0.1047e1, 3), (1.22, 0.1037e1, 3), (2.45, 0.2517e1,
                                                          3),
               (5.2, 0.2928e2, 2), (7.9, 0.1795e3, 1), (50, 0.1455e7, -3))
     for input, output, places in in_out:
         res = IRT.area_ratio(M=input, gamma=1.4)
         self.assertAlmostEqual(res, output, places)
Exemplo n.º 3
0
def plot_pressure_curve(AR_min, AR_max, p_c, fp, T_ref):
    gamma = fp.get_specific_heat_ratio(T=T_ref,
                                       p=p_c)  # [-] Specific heat ratio

    # Determine maximum Mach number at exit
    M_exit_max = IRT.Mach_from_area_ratio(
        AR=AR_max, gamma=gamma)  # [-] Max. Mach number at exit
    M_exit_min = IRT.Mach_from_area_ratio(
        AR=AR_min, gamma=gamma)  # [-] Min. Mach number at exit
    M_exit = np.linspace(start=M_exit_min, stop=M_exit_max,
                         num=50)  # [-] Range of exit Mach numbers to evalulate

    # Determine pressure at exit
    PR_exit = IRT.pressure_ratio(M=M_exit,
                                 gamma=gamma)  # [-] Pressure ratio at exit
    p_exit = p_c / PR_exit  # [-] Exit pressure

    AR = IRT.area_ratio(
        M=M_exit, gamma=gamma
    )  # [-] Area ratios corresponding to all specified mach numbers

    plt.plot(AR,
             p_exit * 1e-5,
             label="{:2.0f} bar , $\\gamma={:1.2f}$".format(p_c * 1e-5, gamma))
Exemplo n.º 4
0
 def test_one(self):
     # Mach number is 1 in the throat so area ratio must be 1.
     expected_result = 1
     res = IRT.area_ratio(M=1, gamma=1.4)
     self.assertEqual(res, expected_result)