Exemple #1
0
    def test_new_propellants(self):
        card_str = """
        oxid N2O4(L)   N 2 O 4   wt%=96.5
        h,cal=-4676.0     t(k)=298.15
        oxid SIO2  SI 1 O 2    wt%=3,5
        h,cal=-216000.0     t(k)=298.15  rho.g/cc=1.48
        """
        add_new_oxidizer('GelN2O4', card_str)

        # ==========
        card_str = """
        fuel CH6N2(L)  C 1     H 6     N 2     wt%=60.00
        h,cal=12900.0     t(k)=298.15   rho=.874
        fuel   AL 1   wt%=40.00
        h,cal=0.0     t(k)=298.15   rho=.1
        """
        add_new_fuel('MMH_AL', card_str)

        C = CEA_Obj(oxName="GelN2O4", fuelName="MMH_AL", fac_CR=None)
        IspODE = C.get_Isp(Pc=1850.0, MR=0.7, eps=40.0)
        self.assertAlmostEqual(IspODE, 380.83236183365057, places=3)

        # ==========
        card_str = """
        name H2O2(L) H 2 O 2  wt%=100.00
        h,cal=-44880.0     t(k)=298.15  rho.g/cc=1.407
        """
        add_new_propellant('MyProp', card_str)
        C = CEA_Obj(propName="MyProp", fac_CR=None)
        IspODE = C.get_Isp(Pc=1850.0, eps=40.0)
        self.assertAlmostEqual(IspODE, 189.9709005711723, places=3)
        def define_oxidizer(oxidizer_table):
            """
            define_oxidizer constructs the propellant card associated to the oxidizer
            :param oxidizer_table: dict containing the oxidizer table as specified in the data-layer
            :return: nothing
            """

            # Initialize the oxidizer card
            card = []

            # Loop through the oxidizer list and generate the string associated to it
            for ox_type in oxidizer_table['components']:
                # Define the basic fields
                card.append("oxid={name}".format(name=ox_type['oxid']))
                card.append("wt={wt}".format(wt=ox_type['wt']))
                card.append("t{units}={value}".format(
                    units=ox_type['t']['units'], value=ox_type['t']['value']))

                # Check if more complex fields are present for the oxidizer
                if "h" in ox_type:
                    card.append("h,{units}={value}".format(
                        units=ox_type['h']['units'],
                        value=ox_type['h']['value']))

                if "composition" in ox_type:
                    card.append(" ".join(
                        ("{name} {value}".format(name=key, value=val)
                         for key, val in ox_type['composition'].items())))

            # Join the card
            card = " ".join(card)

            # Add the fuel to the cea_obj
            cea_obj.add_new_oxidizer(oxidizer_table['name'], card)
Exemple #3
0
def define_propellants():
    """ define the string that characterizes the fuel """

    # Introduce the fuel definition
    fuel_card = "fuel=Air  wt=0.01  t(k)=298 " \
                "fuel=ABS  wt=99.9  t(k)=298 " \
                "h,kj/mol=62.63  C 3.85 H 4.85 N 0.43"

    # Introduce the oxidizer definition
    oxidizer_card = "oxid=H2O2(L) wt=87.5  t(k)=298 " \
                    "oxid=H2O(L) wt=12.5  t(k)=298"

    # Add the new fuel and oxidizer
    cea_obj.add_new_fuel("3DPrinted_ABS", fuel_card)
    cea_obj.add_new_oxidizer("GriffonOxydizer_H2O2", oxidizer_card)
Exemple #4
0
 def cea_card(self):
     # Create cea card and rocketcea fuel/oxidizer
     self.card += self.name + " "
     self.card += self.formula + " "
     self.card += "wt%=100" + " "
     # self.card += "h,cal={:.3f}".format(self.storage_enthalpy/4.184) + " "
     self.card += "t(k)={:.3f}".format(self.storage_temperature) + " "
     self.card += ("rho={:.3f}".format(self.storage_density / 1000) + " "
                   )  # convert density to g/cc
     if self.fluid_type == "oxidizer":
         self.card = "oxid " + self.card
         add_new_oxidizer(self.name, self.card)
     elif self.fluid_type == "fuel":
         self.card = "fuel " + self.card
         add_new_fuel(self.name, self.card)
     return self.card
    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
Exemple #6
0
cal_per_mole_h2o2 = -44880.0
cal_per_mole_h2o  = -68317.

cal_per_mole = cal_per_mole_h2o2 * mole_frac_h2o2 + cal_per_mole_h2o * mole_frac_h2o
print( 'cal_per_mole:%g'%cal_per_mole )

card_str = """
oxid Peroxide_90h2o2 H %g O %g  wt%%=100.0 
h,cal=%g  t(k)=298.15 rho,g/cc = 1.395  
"""%(frac_h, frac_ox, cal_per_mole)

print( card_str )

# ============== Add the new card to RocketCEA ==============
add_new_oxidizer( 'Peroxide_90h2o2', card_str )

# ============= Make a sample run at nominal conditions ==========
#            (gives exact same results as library Peroxide90) 
C = CEA_Obj(propName="Peroxide_90h2o2")
s = C.get_full_cea_output( Pc = 1000.0,eps=2.0,short_output = 1)
print( s )

# =============== make plot ================
TvalL = []
IspL  = []
for TdegR in range(500, 660, 10):
    
    new_card = makeCardForNewTemperature(ceaName='Peroxide_90h2o2', newTdegR=TdegR, CpAve=0.66, MolWt=MolWtMixture)
    ispObj = CEA_Obj( propName=new_card )
    
  def getPerformanceParameters(self, combustionPressure, ambientPressure, oxidizerTemperature, expansionRatio, mixtureRatio):
    import CoolProp.CoolProp as CP
    from rocketcea.cea_obj import CEA_Obj, add_new_fuel, add_new_oxidizer, add_new_propellant
    from rocketcea.cea_obj_w_units import CEA_Obj as CEA_Obj_W_Units
    from rocketcea.blends import makeCardForNewTemperature

    combustionPressure = max(10, combustionPressure) # Limitation of the library...
    fuelTemperature = 293

    HMOLAR = CP.PropsSI('HMOLAR','T',oxidizerTemperature,'P',combustionPressure,"N2O") / 1e3
    oxidizerDensity = CP.PropsSI('D','T',oxidizerTemperature,'P',combustionPressure,"N2O")
    RHO = oxidizerDensity * 1e3 / (1e2 * 1e2 * 1e2)

    oxid_card_str = """
    oxid=NITROUS wt=1.0 t,K={:.2f} h,kj/mol={:.2f} rho,g/cc={:.2f} N 2 O 1
    """.format(oxidizerTemperature, HMOLAR, RHO)
    fuel_card_str = """
    fuel=C(gr) wt={:.4f} t,K={:.2f}
    fuel=SASOL907 wt={:.4f} t,K={:.2f} h,kj/mol={:.2f} rho,g/cc={:.3f} C 50 H 102
    """.format(
      assumptions.carbonBlackFraction.get(), 
      fuelTemperature, 
      1 - assumptions.carbonBlackFraction.get(),
      fuelTemperature, 
      assumptions.fuelEnthalpyOfFormation.get(), 
      assumptions.fuelDensityLiquid.get() / 1e3)

    problemString = "Pc={:.2f},Pa={:.2f},To={:.2f},Tf={:.2f},ER={:.2f},MR={:.2f},oxid={:},fuel={:}".format(
      combustionPressure,
      ambientPressure,
      oxidizerTemperature,
      fuelTemperature,
      expansionRatio,
      mixtureRatio,
      oxid_card_str,
      fuel_card_str
    )
    strHash = hashlib.md5(problemString.encode()).hexdigest()
    NasaCEA.totalHits = NasaCEA.totalHits + 1
    if options.enableCeaLookup and strHash in NasaCEA.inMemoryCache:
      # print("Hit cache")
      NasaCEA.cacheHits = NasaCEA.cacheHits + 1
      return NasaCEA.inMemoryCache[strHash]
    

    # print(HMOLAR, RHO)

    add_new_oxidizer('NITROUS_COOLPROP', oxid_card_str)
    add_new_fuel('SASOLWAX907_CARBONBLACK', fuel_card_str)

    with hiddenPrints:
      combustionPressure = round(combustionPressure, 2)
      mixtureRatio = round(mixtureRatio, 2)
      expansionRatio = round(expansionRatio, 2)
      ambientPressure = round(ambientPressure, 2)

      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_ThtMwGam(Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio)
      Cp = cea.get_Chamber_Cp(Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio)
      rho = cea.get_Chamber_Density(Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio)
      CfVac, Cf, mode = cea.get_PambCf(Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio)
      PcOvPe = cea.get_PcOvPe(Pc=combustionPressure, MR=mixtureRatio, eps=expansionRatio)
      exitPressure = combustionPressure / PcOvPe

      result = (Isp, Cp, MW, Cstar, Tc, gamma, rho, Cf, exitPressure, oxidizerDensity)
      if options.enableCeaLookup:
        NasaCEA.inMemoryCache[strHash] = result
      return result
Exemple #8
0
from rocketcea.cea_obj import CEA_Obj, add_new_fuel, add_new_oxidizer, add_new_propellant

card_str = """
oxid N2O4(L)   N 2 O 4   wt%=96.5
h,cal=-4676.0     t(k)=298.15
oxid SiO2  Si 1.0 O 2.0    wt%=3.5
h,cal=-216000.0     t(k)=298.15  rho=1.48
"""
add_new_oxidizer('GelN2O4', card_str)

# ==========
card_str = """
fuel CH6N2(L)  C 1.0   H 6.0   N 2.0     wt%=60.00
h,cal=12900.0     t(k)=298.15   rho=.874
fuel   AL AL 1.0   wt%=40.00
h,cal=0.0     t(k)=298.15   rho=0.1
"""
add_new_fuel('MMH_AL', card_str)

C = CEA_Obj(oxName="GelN2O4", fuelName="MMH_AL")

s = C.get_full_cea_output(Pc=1850.0, MR=0.7, eps=40.0, short_output=1)

print(s)