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
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
def getPerformanceParameters(self, combustionPressure, ambientPressure, oxidizerTemperature, expansionRatio, mixtureRatio): CpAve = CP.PropsSI('CP0MOLAR', 'T', oxidizerTemperature, 'P', combustionPressure, "N2O") MolWt = CP.PropsSI('M', 'T', oxidizerTemperature, 'P', combustionPressure, "N2O") * 1e3 HMOLAR = CP.PropsSI('HMOLAR', 'T', oxidizerTemperature, 'P', combustionPressure, "N2O") / 1e3 RHO = CP.PropsSI('D', 'T', oxidizerTemperature, 'P', combustionPressure, "N2O") * 1e3 / (1e2 * 1e2 * 1e2) # print(HMOLAR, RHO) card_str = """ oxid=NITROUS wt=1.0 t,K={:.4f} h,kj/mol={:.4f} rho,g/cc={:.4f} N 2 O 1 """.format(oxidizerTemperature, HMOLAR, RHO) add_new_oxidizer('NITROUS_COOLPROP', card_str.format(oxidizerTemperature)) fuelTemperature = 293 card_str = """ fuel=C(gr) wt=0.02 t,K={:.4f} fuel=SASOL907 wt=0.98 t,K={:.4f} h,kj/mol=-1438.200 rho,g/cc=0.720 C 50 H 102 """.format(fuelTemperature, fuelTemperature) add_new_fuel('SASOLWAX907_CARBONBLACK', card_str) # cea = CEA_Obj( # oxName="NITROUS_COOLPROP", # fuelName="SASOLWAX907_CARBONBLACK" # ) # s = cea.get_full_cea_output(Pc=combustionPressure/1e5, MR=mixtureRatio, eps=expansionRatio, pc_units="bar", output='siunits') # print(s) # # pass with hiddenPrints: cea = CEA_Obj_W_Units(oxName="NITROUS_COOLPROP", fuelName="SASOLWAX907_CARBONBLACK", pressure_units='Pa', cstar_units='m/s', temperature_units='K', sonic_velocity_units='m/s', enthalpy_units='J/kg', density_units='kg/m^3', specific_heat_units='J/kg-K', viscosity_units='poise', thermal_cond_units="W/cm-degC") Isp, mode = cea.estimate_Ambient_Isp(Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio, Pamb=ambientPressure) IspVac, Cstar, Tc, MW, gamma = cea.get_IvacCstrTc_ChmMwGam( Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio) # cea = CEA_Obj( # oxName=oxidizerCard, # fuelName="SASOLWAX907_CARBONBLACK" # ) # s = cea.get_full_cea_output(Pc=combustionPressure/1e5, MR=mixtureRatio, eps=expansionRatio, pc_units="bar", output='siunits') # print(s) return Isp, CpAve, MolWt, Cstar, Tc, gamma