from rocketprops.line_supt import calc_line_id_dp, calc_line_vel_dp from rocketprops.rocket_prop import get_prop pObj = get_prop('hydrazine') ID, deltaP = calc_line_id_dp( pObj, TdegR=530.0, Ppsia=240.0, wdotPPS=0.5, velFPS=13, roughness=5.0E-6, Kfactors=5.0, len_inches=50.0) print( 'Inside Diam=%g inches, Pressure Drop =%g psid'%(ID, deltaP) ) vel, dp = calc_line_vel_dp( pObj, TdegR=530.0, Ppsia=240.0, wdotPPS=0.5, IDinches=ID, roughness=5.0E-6, Kfactors=5.0, len_inches=50.0) print( 'Velocity = %g ft/sec, Pressure Drop =%g psid'%(vel, deltaP) )
from rocketprops.rocket_prop import get_prop from rocketprops.injector_supt import calc_inj_velocity, calc_orifice_flow_rate """ Calculate the injection velocity of an injector orifice and its mass flow rate """ pObj = get_prop('N2O4') ft_per_sec = calc_inj_velocity(pObj, dPpsia=50.0, TdegR=530.0, Ppsia=1000.0) print('velocity =', ft_per_sec, 'ft/s') wdot = calc_orifice_flow_rate(pObj, CdOrf=0.75, DiamInches=0.01, dPpsia=50.0, TdegR=530.0, Ppsia=1000.0) print('Orifice flow rate =', wdot, 'lbm/sec')
import matplotlib.pyplot as plt from rocketprops.rocket_prop import get_prop from engcoolprop.ec_fluid import EC_Fluid from rocketprops.unit_conv_data import get_value name = 'Oxygen' name = 'Propane' #name = 'Methane' #name = 'Methanol' #name = 'Ethanol' #name = 'Ammonia' ec = EC_Fluid(name) p = get_prop(name) Tmin, Tmax = p.T_data_range() Tmin += 5 Tmax = min( Tmax, ec.Tc ) - 5.0 print( 'p.Tc=%g, ec.Tc=%g'%(p.Tc, ec.Tc) ) fig = plt.figure() COLORL = ['g','c','b','orange','m','r'] i = 0 errLL = [] plt.title( p.pname ) for P in [100, 200, 500, 1000, 2000]: tL = [] sg_rpL = [] sg_ecL = [] errL = [] terrL = []
""" This example demonstrates the proper use of project: rocketprops """ import sys import os sys.path.insert(0, os.path.abspath( "../../")) # needed to find rocketprops development version from rocketprops.rocket_prop import get_prop p = get_prop('c3h8') p.summ_print() p.plot_sat_props(save_figures=True)
from rocketprops.rocket_prop import get_prop from rocketprops.valve_supt import cv_valve_dp, kv_valve_dp """ Calculate the pressure drop across an MMH valve with given mass flow rate """ pObj = get_prop( 'MMH' ) # Imperial valve flow coefficient, Cv dp = cv_valve_dp( pObj, Cv=1.0, wdotPPS=0.5, TdegR=530.0, Ppsia=1000.0) print('Cv = 1.0 deltaP = %g psid'%dp) # Metric valve flow coefficient, Kv Kv = 1.0 / 1.1560992283526375 # Conversion factor for Cv to Kv dp = kv_valve_dp( pObj, Kv=Kv, wdotPPS=0.5, TdegR=530.0, Ppsia=1000.0) print('Kv = 1.0/convFact deltaP = %g psid'%dp)
from rocketprops.tank_supt import calc_tank_volume from rocketprops.rocket_prop import get_prop """ Calculate the required volume of a Hydrazine (N2H4) tank. Assume: required usable propellant is 50 kg vehicle max operating/storage/transport temperature is 50 deg C. minimum ullage volume is 3%. expulsion efficiency = 98%. """ pObj = get_prop('N2H4') cc_Total, kg_loaded, kg_residual = calc_tank_volume(pObj, kg_expelled=50.0, TmaxC=50.0, expPcent=98.0, ullPcent=3.0) print('cc_Total = %g cc' % cc_Total) print('loaded propellant mass = %g kg' % kg_loaded) print('residual propellant mass = %g kg' % kg_residual)
def __init__(self, coreObj, # CoreStream object Tox=None, Tfuel=None, elemEm=0.8, fdPinjOx=0.25, fdPinjFuel=0.25, dpOxInp=None, dpFuelInp=None, setNelementsBy='acoustics', # can be "acoustics", "elem_density", "input" elemDensInp=5, NelementsInp=100, OxOrfPerEl=1.0, FuelOrfPerEl=1.0, lolFuelElem=False, setAcousticFreqBy='mode', # can be "mode" or "freq" desAcousMode='3T', desFreqInp=5000, CdOxOrf=0.75, CdFuelOrf=0.75, dropCorrOx=0.33, dropCorrFuel=0.33, DorfMin=0.008, LfanOvDorfOx=20.0, LfanOvDorfFuel=20.0): """ Injector object holds basic information about the injector. Injector design features are calculated including chamber losses due to the injector, Em, Mix and Vap. """ self.coreObj = coreObj self.geomObj = coreObj.geomObj # build propellant objects self.oxProp = get_prop( self.coreObj.oxName ) self.fuelProp = get_prop( self.coreObj.fuelName ) self.TminOx, self.TmaxOx = self.oxProp.T_data_range() self.TminFuel, self.TmaxFuel = self.fuelProp.T_data_range() self.Tox_warning = '' self.Tfuel_warning = '' if Tox is None: Tox = min(530.0, self.oxProp.Tnbp) else: Tox, self.Tox_warning = temperature_clamp(Tox, 'Tox', self.TminOx, self.TmaxOx) self.Tox = Tox if Tfuel is None: Tfuel = min(530.0, self.fuelProp.Tnbp) else: Tfuel,self.Tfuel_warning = temperature_clamp(Tfuel, 'Tfuel', self.TminFuel, self.TmaxFuel) self.Tfuel = Tfuel self.elemEm = min(1.0, elemEm) # intra-element mixing parameter for injector self.fdPinjOx = fdPinjOx self.fdPinjFuel = fdPinjFuel self.dpOxInp = dpOxInp self.dpFuelInp = dpFuelInp self.setNelementsBy = setNelementsBy.lower() # just in case user screw up. self.used_Nelem_criteria = self.setNelementsBy # assume for now that intention is satisfied self.elemDensInp = elemDensInp self.NelementsInp = NelementsInp self.OxOrfPerEl = OxOrfPerEl self.FuelOrfPerEl = FuelOrfPerEl self.lolFuelElem = lolFuelElem if lolFuelElem: self.strouhal_mult = 0.1 # LOL element uses 0.1 strouhal multiplier else: self.strouhal_mult = 0.2 # unlike element uses 0.2 strouhal multiplier self.desAcousMode = desAcousMode if desAcousMode in modeSvnD: self.desAcousMult = modeSvnD[ desAcousMode ] else: self.desAcousMult = float( desAcousMode ) # let it raise exception if not a float self.desFreqInp = desFreqInp self.setAcousticFreqBy = setAcousticFreqBy.lower() # can be "mode" or "freq" self.CdOxOrf = CdOxOrf self.CdFuelOrf = CdFuelOrf self.dropCorrOx = dropCorrOx self.dropCorrFuel = dropCorrFuel self.DorfMin = DorfMin self.LfanOvDorfOx = LfanOvDorfOx self.LfanOvDorfFuel = LfanOvDorfFuel # get oxidizer propellant properties self.sgOx = self.oxProp.SG_compressed( Tox, self.coreObj.Pc ) # g/ml self.dHvapOx = self.oxProp.HvapAtTdegR( Tox ) # BTU/lbm self.surfOx = self.oxProp.SurfAtTdegR( Tox ) # lbf/in self.viscOx = self.oxProp.ViscAtTdegR( Tox ) # poise self.viscOx = get_value( self.viscOx, 'poise', 'lbm/s/ft') self.MolWtOx = self.oxProp.MolWt #print('sgOx=',self.sgOx) # get fuel propellant properties self.sgFuel = self.fuelProp.SG_compressed( Tfuel, self.coreObj.Pc ) # g/ml self.dHvapFuel = self.fuelProp.HvapAtTdegR( Tfuel ) # BTU/lbm self.surfFuel = self.fuelProp.SurfAtTdegR( Tfuel ) # lbf/in self.viscFuel = self.fuelProp.ViscAtTdegR( Tfuel ) # poise self.viscFuel = get_value( self.viscFuel, 'poise', 'lbm/s/ft') self.MolWtFuel = self.fuelProp.MolWt #print('sgFuel=',self.sgFuel) # --------- start vaporization calcs -------- self.rhoOx = rho = get_value( self.sgOx, 'SG', 'lbm/in**3' ) self.rhoFuel = rho = get_value( self.sgFuel, 'SG', 'lbm/in**3' ) self.calc_element_attr() # e.g. Nelements, injection velocities, elements diam, etc. #self.evaluate() # get input descriptions and units from doc string self.inp_descD, self.inp_unitsD, self.is_inputD = get_desc_and_units( self.__doc__ )
def setUp(self): unittest.TestCase.setUp(self) self.myclass = get_prop('N2O4')