Esempio n. 1
0
    def calculate_combustion_parameters_at_chamber(self, phi):
        """ Uses RocketCEA, which wraps NASA CEA, to calculate 4 parameters at
        the combustion chamber:

            OF_ratio : Oxidizer/fuel mass ratio.
            k : exhaust gasses cp/cv = gamma.
            M : exhaust gasses moleculaer weight.
            To : adiabatic flame temperature.

        Parameters
        ----------
        phi : float
            Equivalence ratio: phi = (fuel-to-oxidizer ratio) /
            (fuel-to-oxidizer ratio)st.

        Returns
        -------
        OF_ratio : float
            Oxidizer/fuel mass ratio based on given phi.
        gamma : float
            Exhaust gasses cp/cv.
        molecular_weight : float
            Exhaust gasses moleculaer weight.
        flame_temperature : float
            Adiabatic flame temperature.
        """
        cea_analysis = CEA_Obj(
            oxName=self.oxidizer.name,
            fuelName=self.fuel.name,
            isp_units="sec",
            cstar_units="m/sec",
            pressure_units="bar",
            temperature_units="K",
            sonic_velocity_units="m/sec",
            enthalpy_units="kJ/kg",
            density_units="kg/m^3",
            specific_heat_units="kJ/kg-K",
            viscosity_units="millipoise",
            thermal_cond_units="W/cm-degC",
        )

        # Get OF ratio based on equivalence ratio
        OF_ratio = cea_analysis.getMRforER(ERphi=phi)

        # Calculate outputs
        area_ratio = cea_analysis.get_eps_at_PcOvPe(Pc=self.p_chamber,
                                                    MR=OF_ratio,
                                                    PcOvPe=self.p_chamber /
                                                    self.Pa)
        (
            Isp,
            cstar,
            flame_temperature,
            molecular_weight,
            gamma,
        ) = cea_analysis.get_IvacCstrTc_ChmMwGam(Pc=self.p_chamber,
                                                 MR=OF_ratio,
                                                 eps=area_ratio)

        return OF_ratio, gamma, molecular_weight, flame_temperature
Esempio n. 2
0
    def optimize_combustion_parameters_at_chamber(self):
        """ Uses RocketCEA, which wraps NASA CEA, to calculate 4 parameters at
        the combustion chamber:

            OF_ratio : Oxidizer/fuel mass ratio.
            k : exhaust gasses cp/cv = gamma.
            M : exhaust gasses moleculaer weight.
            To : adiabatic flame temperature.

        OF_ratio is calculated by optimizing the specific impulse of the motor.

        Returns
        -------
        optimal_OF_ratio : float
            Optimized oxidizer/fuel mass ratio generating optimum specific
            impulse.
        gamma : float
            Exhaust gasses cp/cv.
        molecular_weight : float
            Exhaust gasses moleculaer weight.
        flame_temperature : float
            Adiabatic flame temperature.
        """
        # ---------------Calculated Inputs----------------#
        # Calculate input parameters from oxidiser and fuel combustion
        # Initialize CEA analysis
        cea_analysis = CEA_Obj(
            oxName=self.oxidizer.name,
            fuelName=self.fuel.name,
            # Units
            isp_units="sec",
            cstar_units="m/sec",
            pressure_units="bar",
            temperature_units="K",
            sonic_velocity_units="m/sec",
            enthalpy_units="kJ/kg",
            density_units="kg/m^3",
            specific_heat_units="kJ/kg-K",
            viscosity_units="millipoise",
            thermal_cond_units="W/cm-degC",
        )

        # Get stoichiometric equivalence ratio
        stoichiometric_OF_ratio = cea_analysis.getMRforER(ERphi=1.0)

        # Find optimal specific impulse
        def minus_specific_impulse_function(OF_ratio):
            area_ratio = cea_analysis.get_eps_at_PcOvPe(Pc=self.p_chamber,
                                                        MR=OF_ratio,
                                                        PcOvPe=self.p_chamber /
                                                        self.Pa)
            Isp, cstar, To, M, k = cea_analysis.get_IvacCstrTc_ChmMwGam(
                Pc=self.p_chamber, MR=OF_ratio, eps=area_ratio)
            return -Isp

        res = minimize(
            fun=minus_specific_impulse_function,
            x0=stoichiometric_OF_ratio,
            method="Powell",
            bounds=[[
                stoichiometric_OF_ratio * 0.5, stoichiometric_OF_ratio * 2
            ]],
        )

        # Optimization sequence complete, store results
        optimal_OF_ratio = res.x[0]
        optimal_area_ratio = cea_analysis.get_eps_at_PcOvPe(
            Pc=self.p_chamber,
            MR=optimal_OF_ratio,
            PcOvPe=self.p_chamber / self.Pa)
        (
            optimal_Isp,
            cstar,
            flame_temperature,
            molecular_weight,
            gamma,
        ) = cea_analysis.get_IvacCstrTc_ChmMwGam(Pc=self.p_chamber,
                                                 MR=optimal_OF_ratio,
                                                 eps=optimal_area_ratio)

        return optimal_OF_ratio, gamma, molecular_weight, flame_temperature