# RocketCEA Functions

## CEA_Obj Functions

## CEA_Obj With Units

## User Units

This file wraps default RockeCEA units with desired user units.

rocketcea.units.add_default_unit(name='psia', akaL=None)

  Initialize unitsConvFactD for various default units.

rocketcea.units.add_user_units(default_units, user_units, multiplier, offset=0)

  Add new units to dictionary of default_units.

rocketcea.units.get_conv_factor(default_units, user_units)

  Get multiplier and offset for user_units.

class rocketcea.units.Units(default_units='psia', user_units='MPa', user_over_default=0.0068947572, user_offset=0)
  dval_to_uval(def_value)

    Given a value in RockeCEA default units, return value in user units.

  show_dval_to_uval(def_value)

    Given a value in RockeCEA default units, print conversion user units.

  show_uval_to_dval(user_value)

    Given a value in user units, print conversion to RockeCEA default units.

  uval_to_dval(user_value)

    Given a value in user units, return a value in RockeCEA default units.

## Blend Functions

Handle propellant blends. Make new input cards for various ox and fuel blends.

rocketcea.blends.addFLOX_Blend(oxName, cea_deck)

  Add new add FLOX oxidizer to the CEA_Obj.cea_deck FLOX70, for example, represents 70% F2 and 30% LOX

rocketcea.blends.addHYD_AmmoniaBlend(name, cea_deck)

  Add new N2H4 + undissociated Ammonia (UA) Blend to the CEA_Obj.cea_deck. Use name like “HYD30” to represent hydrazine with 30% dissociated ammonia.

rocketcea.blends.addMMH_N2H4_Blend(fuelName, cea_deck)

  Add new MMH + N2H4 Blend to the CEA_Obj.cea_deck Use name like M10 to represent 10% MMH and 90% N2H4

rocketcea.blends.addMON_Blend(oxName, cea_deck)

  Add new MON oxidizer Blend to the CEA_Obj.cea_deck MON15 and MON25 are in standard deck, however can make MON20, MON30 etc. “on-the-fly”

rocketcea.blends.addPeroxideBlend(oxName, cea_deck)

  Add new Peroxide Blend to the CEA_Obj.cea_deck. Use name like Peroxide95 to represent 95% Peroxide and 5% water.

rocketcea.blends.all_in_dict(nameL, D)

  If all members of nameL are keys in D, then return True, otherwise False.

rocketcea.blends.getFloatTokenFromCards(cardL, token='t(k)')

  Get the float value of the desired token. (e.g. ‘t(k)’ )

rocketcea.blends.getFuelHfCalPerMole(name)

  Get the fuel float value of the reference temperature ‘h,cal’

rocketcea.blends.getFuelRefTempDegK(name)

  Get the fuel float value of the reference temperature ‘t(k)’

rocketcea.blends.getOxHfCalPerMole(name)

  Get the ox float value of the reference temperature ‘h,cal’

rocketcea.blends.getOxRefTempDegK(name)

  Get the oxidizer float value of the reference temperature ‘t(k)’

rocketcea.blends.getPropHfCalPerMole(name)

  Get the propellant float value of the reference temperature ‘h,cal’

rocketcea.blends.getPropRefTempDegK(name)

  Get the propellant float value of the reference temperature ‘t(k)’

rocketcea.blends.get_propellant_name(Name=None, PcentL=None)

      #: Return the name of the blend defined by "Name". (string or list of strings)
      #: Might be a defined blend such as MON25 or FLOX80.
      #: Might be in the library such as "MMH" or "CLF5"
      #: Might need to create a long name from percentages Name=["N2H4","NH3"], PcentL=[90,10]
      #:   (if new name, add card to oxCards, fuelCards or propCards)

rocketcea.blends.giveCardMassPercent(card, fuelPcent)

  set the value of mass percentage (wt%) on propellant card.

rocketcea.blends.giveCardNewHfAndTref(card, newHfCalPerMole, newTrefDegR)

  Change the values of “h,cal” and “t(k)” on propellant cards.

rocketcea.blends.isAPeroxide_Blend(name)

  check if name is for a blend of peroxide and water. Peroxide98 and Peroxide90 are in standard deck, however can make Peroxide95 etc. “on-the-fly”

rocketcea.blends.isAnMMH_N2H4_Blend(name)

  check if name is for a blend of MMH + N2H4 M20 is in standard deck, however can make M10, M30 etc. “on-the-fly”

rocketcea.blends.isFLOX_Ox_Blend(name)

  check for FLOX oxidizer (e.g. FLOX70 or FLOX82.5) No FLOX blends are in standard deck, however can make FLOX70, FLOX82.5 etc. “on-the-fly”

rocketcea.blends.isMON_Ox_Blend(name)

  check for MON oxidizer (MON1 to MON40) 48% is theoretical max MON15 and MON25 are in standard deck, however can make MON20, MON30 etc. “on-the-fly”

rocketcea.blends.is_HYD_Ammonia_Blend(name)

  check if name is for a blend of N2H4 and undissociated Ammonia (UA) HYD40 is in standard deck, however can make HYD30, HYD50 etc. “on-the-fly”

rocketcea.blends.makeCardForNewTemperature(ceaName='CH4', newTdegR=536.0, CpAve=0.791, MolWt=16.04)

  Create a new propellant card that reflects a change in temperature of the propellant from the original reference temperature on the original card to the new input value of temperature, newTdegR.

  CpAve = BTU/lbm degR

rocketcea.blends.newFuelBlend(fuelL=None, fuelPcentL=None)

  create fuel blends such as M20 given the fuel names and weight percentages. e.g. fuelL=[“MMH”,”N2H4”], fuelPcentL=[20,80]

rocketcea.blends.newFuelWithNewState(name, newHfCalPerMole, newTrefDegR)

  Take name as it exists in fuelCards and change Hf and Tref to be the input values newHfCalPerMole and newTrefDegR

rocketcea.blends.newOxBlend(oxL=None, oxPcentL=None)

  create ox blends such as MON25 given the oxidizer names and weight percentages. e.g. oxL=[“N2O4”,”N2O3”], oxPcentL=[36.67,63.33]

rocketcea.blends.newOxWithNewState(name, newHfCalPerMole, newTrefDegR)

  Take name as it exists in oxCards and change Hf and Tref to be the input values newHfCalPerMole and newTrefDegR

rocketcea.blends.newPropWithNewState(cardDict, name, newHfCalPerMole, newTrefDegR)

  Take name as it exists in fuelCards or oxCards and change Hf and Tref to be the input values newHfCalPerMole and newTrefDegR

rocketcea.blends.renamePropIfNewHfOrTrefInName(cardDict, name)

  Look for “h,cal OR “t(k)”” in name. If present, then create new modified name and create new card in cardDict if necessary

  for example to tweak LH2 run might look like: “LH2 h,cal=-2155.0 t(k)=21.0”

rocketcea.blends.tightenUpEquals(card)

  make sure there’s no spaces around equal signs.

rocketcea.blends.turnCardsIntoTokenL(cardL)

  turn the card list into one long list of tokens