def __design_angelino_nozzle(self, design_alt, truncate_ratio, CEA, r_e):
        """ Can be a class function, will edit going forwards
		"""
        (p_atm, T_atm, rho_atm) = gd.standard_atmosphere([design_alt])

        PR = CEA.p_c / p_atm

        M_e = gd.PR_expansion_mach(PR, CEA.gamma)

        expansion_ratio = gd.expansion_ratio(1, M_e, CEA.gamma)  #6.64 #8.1273
        # print('Exp. ratio: ' + str(expansion_ratio))
        # print('PR: ' + str(PR))

        A_t = r_e**2 * np.pi / expansion_ratio  # max expansion (r_b = 0, r_e**2 >= A_t*expansion_ratio/np.pi)

        return plug_nozzle(expansion_ratio,
                           A_t,
                           r_e,
                           CEA.gamma,
                           CEA.T_c,
                           CEA.p_c,
                           CEA.a_c,
                           CEA.rho_c,
                           1500,
                           truncate_ratio=truncate_ratio)
예제 #2
0
r_e = 0.067 / 2  #0.034 # likely too large
expansion_ratio = 6.64  #8.1273
A_t = r_e**2 * np.pi / expansion_ratio  # max expansion (r_b = 0, r_e**2 >= A_t*expansion_ratio/np.pi)
gamma = 1.2381  #np.mean([1.2534,1.2852])
T_c = 2833.63
p_c = 34.474 * 10**5
rho_c = 3.3826
R = (1 - 1 / gamma) * 1.8292 * 1000  #1.8292 1.6196
a_c = np.sqrt(gamma * (1 - 1 / gamma) * 200.07 * T_c)
n = 1000

spike = plug_nozzle(expansion_ratio,
                    A_t,
                    r_e,
                    gamma,
                    T_c,
                    p_c,
                    a_c,
                    rho_c,
                    n,
                    truncate_ratio=1.0)
alts = np.linspace(0, 15000, 100)
p_atms, T_atms, rho_atms = gd.standard_atmosphere(alts)

thrusts = np.zeros(p_atms.shape)

for i in range(len(p_atms)):
    thrusts[i] = spike.calc_ideal_thrust(p_atms[i])

plt.plot(alts, thrusts)

# MOC_mesh = chr_mesh(spike,gamma,0,50,downstream_factor=1.2,plot_chr=1)
def COST_FNC(design_alt, truncate_ratio, T_w, CEA, r_e, alpha, beta, n):

    ### DESIGNING NOZZLE
    (p_atm, T_atm, rho_atm) = gd.standard_atmosphere([design_alt])

    PR = CEA.p_c / p_atm

    M_e = gd.PR_expansion_mach(PR, CEA.gamma)

    expansion_ratio = gd.expansion_ratio(1, M_e, CEA.gamma)  #6.64 #8.1273
    # print('Exp. ratio: ' + str(expansion_ratio))
    # print('PR: ' + str(PR))

    A_t = r_e**2 * np.pi / expansion_ratio  # max expansion (r_b = 0, r_e**2 >= A_t*expansion_ratio/np.pi)

    spike = plug_nozzle(expansion_ratio,
                        A_t,
                        r_e,
                        CEA.gamma,
                        CEA.T_c,
                        CEA.p_c,
                        CEA.a_c,
                        CEA.rho_c,
                        n,
                        truncate_ratio=truncate_ratio)

    ### CALCULATING COST
    ##	thurst estimation over altitude
    alt_range = np.linspace(0, 12000, 30)
    (p_atm_r, T_atm_r, rho_atm_r) = gd.standard_atmosphere(alt_range)
    #print(CEA.p_c/p_atm_r)
    thrust_range = np.zeros(alt_range.shape)
    for i in range(alt_range.shape[0]):
        if i == 10:
            MOC_mesh = MOC.chr_mesh(spike,
                                    gamma,
                                    alt_range[i],
                                    50,
                                    downstream_factor=1.2,
                                    plot_chr=0)
        else:
            MOC_mesh = MOC.chr_mesh(spike,
                                    gamma,
                                    alt_range[i],
                                    50,
                                    downstream_factor=1.2,
                                    plot_chr=0)

        thrust_range[i] = MOC_mesh.compute_thrust('nearest', 10)

    work = np.trapz(thrust_range, alt_range)
    plt.plot(alt_range, thrust_range, 'o')
    plt.show()
    ## heat transfer required

    total_heat_flux = heat_flux(CEA.Pr, CEA.cp, CEA.gamma, CEA.c, CEA.w,
                                CEA.T_c, T_w, spike)

    # print('Work*alpha: ' + str(work*alpha))
    # print('Heat flux*beta: ' + str(total_heat_flux*beta))
    return -alpha * work + total_heat_flux * beta