Coverage for rocketisp\nozzle\nozzle.py : 77%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Nozzle contour object holds both a dimensionless and absolute dimension representation of the nozzle. It includes interpolators for entire contour.
:param CR: contraction ratio of chamber (Ainj / Athroat) :param eps: nozzle area ratio (Aexit / Athroat) :param pcentBell: nozzle percent bell (Lnoz / L_15deg_cone) :param Rt: in, throat radius :param Nsegs: number of segments to hold in array of nozzle contour :param Rup: radius of curvature just upstream of throat (Rupstream / Rthroat) :param Rd: radius of curvature just downstream of throat (Rdownstream / Rthroat) :param cham_conv_ang: deg, half angle of convergent section of chamber :param Rc: radius of curvature at start of convergent section (Rconvergent / Rthroat) :param theta: deg, entrance angle of nozzle (tangent to Rd circular curve) :param exitAng: deg, exit angle of nozzle :param forceCone: flag to force nozzle to be a conical nozzle instead of bell nozzle. :param use_huzel_angles: flag to force use of Huzel entrance and exit angle correlation :type CR: float :type eps: float :type pcentBell: float :type Rt: float :type Nsegs: int :type Rup: float :type Rd: float :type cham_conv_ang: float :type Rc: float :type theta: float :type exitAng: float :type forceCone: bool :type use_huzel_angles: bool :return: Nozzle object :rtype: Nozzle """
Rt=1.5, Nsegs=20, Rup=2.0, Rd=1.0, cham_conv_ang=30.0, Rc=1.0, theta=None, exitAng=None, forceCone=0, use_huzel_angles=False):
eps = 1.00001
self.theta, self.exitAng = getHuzelEntranceExitAngles(eps=eps, pcBell=pcentBell) else: else: self.theta = theta # entrance angle of skewed parabola self.exitAng = exitAng # exit angle of skewed parabola
# contour is dimensionless... r=r/Rt, z=z/Rt ref_nozzle( Rup=Rup, Rd=Rd, eps=eps, theta=self.theta, alphaExit=self.exitAng, pcBell=pcentBell, Nsegs=self.Nsegs, cham_conv_ang=cham_conv_ang, Rc=Rc, CR=CR, forceCone=forceCone )
"""Use throat radius to create an absolute contour from the dimensionless contour."""
# make a z and r contour in absolute unites (scaled by Rt) # ............. create interpolators for nozzle contour .........
# make contour interpolators # ...NOTE... Z,R and area are in ABSOLUTE UNITS .....
# NOTICE sqrt of eps for interpolators #self.z2_logarea_terp = InterpProp( self.abs_zContour, [log(self.At*e) for e in self.epsContour] )
# NOTICE sqrt of eps for interpolators # make interpolators for convergent and divergent sections of nozzle self.abs_zContour[:self.i_throat+1], extrapOK=False ) self.abs_zContour[self.i_throat:], extrapOK=False )
# interpolation can fall below 1.0 if not careful return max(1.0, self.z2_eps_terp( z ))
return self.z2area_terp( z )
return self.z2area_terp.deriv( z )
""" Returns 2 lists for the convergent contour, the z contour and the area ratio contour starting at the injector and going to the throat, but NOT including Throat """ return self.abs_zContour[:self.i_throat], self.epsContour[:self.i_throat]
""" Returns 2 lists for the divergent nozzle contour, the z contour and the area ratio contour starting at the throat and going to the nozzle exit, but NOT including Throat """ return self.abs_zContour[self.i_throat+1:], self.epsContour[self.i_throat+1:]
log_eps = log(eps) return self.div_logeps2z_terp( log_eps )
log_eps = log(eps) return self.conv_logeps2z_terp( log_eps )
if gas.M <= 1.0: return self.get_z_from_conv_eps( eps ) else: return self.get_z_from_div_eps( eps )
return self.abs_zContour[0]
return self.abs_zContour[-1]
"""return (zmin, zmax)""" return self.abs_zContour[0], self.abs_zContour[-1]
title = "Absolute Dimension Conical Contour\n(eps=%g, %%Bell=%g, ConeAng=%.1f deg)"%\ ( self.eps, self.pcentBell, self.angCone) else: ( self.eps, self.pcentBell, self.theta, self.exitAng)
else: zL = [-Lchamber] + self.abs_zContour rL = [self.Rcham] + self.abs_rContour eL = [self.CR] + self.epsContour
plt.savefig( 'nozzle_geom.png' ) plt.show()
eps = 1.00001
alphaExit=10., pcBell=80., Nsegs=30, forceCone=0, cham_conv_ang=30.0, Rc=1.0, CR=2.5 ): '''DIMENSIONLESS Parabolic Nozzle Contour (Rthroat = 1.0)'''
eps = 1.00001
(tanDeg(theta)-tanDeg(alphaExit)) else: # can't make a parabola, so make a cone angConeMin = atan( (rE-Rt)/zE ) * 180.0 / pi # solve for cone angle angConeMax = atan( rE/zE ) * 180.0 / pi for i in range(20): angCone = (angConeMin + angConeMax) / 2.0 zT = Rd * sinDeg(angCone) rT = Rt + Rd*(1.-cosDeg(angCone)) angConeTest = atan( (rE-rT)/(zE-zT) ) * 180.0 / pi if angConeTest<angCone: angConeMax = angCone else: angConeMin = angCone zQ = zT + (zE-zT)/2. rQ = rT + (rE-rT)/2. imaCone = 1
# ......... start countour at tangent point (zT, rT) .........
# this approach is more efficient, than the obvious, brute-force approach. # (see parabola_v1.py for brute-force approach) # ...works for both parabola and cone using (z1L, r1L, z2L, r2L)
# append portion past tangent point (zT, rT)
# ........ set integer angle steps .........
# ........ create convergent section .........
# radii are too big for CR... reduce radii htSeg = 0.1 * (Rchm - Rt) # let linear segment be 10% of ht
hr = 0.9 * (Rchm - Rt) / 2.0 # make radii equal Rup = hr / (1.0-cosA) Rc = Rup
# make a short linear section
#print( 'zconvL:', zconvL) #print( 'rconvL:', rconvL)
# ......... create throat section (Rup and Rd) ......... throat_angle = angCone else:
# start at throat
#print( '\nzthrtL:', zthrtL) #print( 'rthrtL:', rthrtL)
# ......... connect all the pieces .........
#print( 'i_throat=%i, R at i_throat=%g'%(i_throat, rContour[i_throat]) ) print( 'R out of sequence at i=%i, R[i-1]=%g, R[i]=%g '%(i,rContour[i-1], rContour[i] ))
print( 'Z out of sequence at i=%i, Z[i-1]=%g, Z[i]=%g '%(i,zContour[i-1], zContour[i] ))
print( 'R out of sequence at i=%i, R[i-1]=%g, R[i]=%g '%(i,rContour[i-1], rContour[i] ))
print( 'Z out of sequence at i=%i, Z[i-1]=%g, Z[i]=%g '%(i,zContour[i-1], zContour[i] ))
noz = Nozzle(CR=2.5, eps=60.0, pcentBell=80.0, Rt=2.54, Nsegs=20, Rup=2.0, Rd=1.0, cham_conv_ang=30.0, Rc=1.0, theta=None, exitAng=None, forceCone=0, use_huzel_angles=False)
noz.plot_geom( do_show=True, save_to_png=True )
|