Example #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))
Example #2
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))
Example #3
0
 def testAndersonTable(self):
     # use Anderson2016 table Appendix for gamma-1.4 in order to verify function workings
     in_out = (
         (0.2894e2, 0.2e-1, False, 5),
         (0.2708e1, 0.22e0, False, 4),
         (0.1213e1, 0.58e0, False, 4),
         #(0.1000e1, 0.98e0, False, 2), # Function is extremely insensitive to results close to M=1
         #(0.1000e1, 0.102e1, True, 3),
         (0.1126e1, 0.1420e1, True, 3),
         (0.2763e1, 0.2550e1, True, 3),
         (0.3272e3, 0.9e1, True, 3),
         (0.1538e5, 0.2e2, True, 2))
     for AR, expected_M, supersonic, M_places in in_out:
         res_M = IRT.Mach_from_area_ratio(AR=AR,
                                          gamma=1.4,
                                          supersonic=supersonic)
         self.assertAlmostEqual(res_M, expected_M, places=M_places)
Example #4
0
 def testAreaRatioOne(self):
     expected_result = 1.0
     input = 1
     res = IRT.Mach_from_area_ratio(AR=input, gamma=1.4)
     self.assertEqual(res, expected_result)