def _getCPXPos(self, Mach): ''' Finds the chordwise position of the center of pressure, relative to the tip of the root chord (self.position) Methods from Tactical missile design by Fleeman through Niskanen ''' if Mach < 0.5: XF = self.XMACLeadingEdge + 0.25 * self.MACLength #As per open rocket documentation elif Mach >= 2.0: beta = AeroParameters.getBeta(Mach) CPCalc = lambda AR, B: (AR * B - 0.67) / ( 2 * AR * B - 1 ) #Eq 3.35 of open rocket documentation (greater than M = 2) XF = self.MACLength * CPCalc( self.aspectRatio, beta) + self.XMACLeadingEdge #As per open rocket documentation else: #Between the two extremes is a polynomial curve fit #Fifth order polynomial fit as per Niskanen Eqn 3.36 (Originally from Fleeman) # Old code: XF = np.polyval(self.x, Mach)*self.MACLength + self.XMACLeadingEdge # Evaluate polynomial manually for maximum speed (8.5x improvement for 6 coeffs) # Speed test in test/speedTests/PolyvalSpeed.py polyval = 0 nTerms = len(self.x) for i in range(nTerms): polyval += self.x[i] * Mach**(nTerms - 1 - i) XF = polyval * self.MACLength + self.XMACLeadingEdge # Polyval defines the fraction of the MAC that the Cp is behind the leading edge return XF
def subsonicNormalForce(Mach): # Subsonic linear method tempBeta = AeroParameters.getBeta(Mach) CnAlpha = getFinCnAlpha_Subsonic_Barrowman(self.span, self.planformArea, tempBeta, self.midChordSweep) return getSubsonicFinNormalForce(airVelRelativeToFin, unitSpanTangentialAirVelocity, finNormal, self.spanwiseDirection, self.CPSpanWisePosition.length(), CnAlpha, self)
def supersonicNormalForce(Mach): # Supersonic Busemann method gamma = AeroFunctions.getGamma() tempBeta = AeroParameters.getBeta(Mach) K1, K2, K3, Kstar = getBusemannCoefficients(Mach, tempBeta, gamma) # Mach Cone coords machAngle = asin(1 / Mach) machCone_negZPerRadius = 1 / tan(machAngle) machConeEdgeZPos = [] outerRadius = self.spanSliceRadii[-1] for i in range(len(self.spanSliceRadii)): machConeAtCurrentRadius = ( outerRadius - self.spanSliceRadii[i] ) * machCone_negZPerRadius + self.tipPosition machConeEdgeZPos.append(machConeAtCurrentRadius) return getSupersonicFinNormalForce( airVelRelativeToFin, unitSpanTangentialAirVelocity, finNormal, machConeEdgeZPos, self.spanwiseDirection, self.CPSpanWisePosition.length(), K1, K2, K3, Kstar, self)
def test_getBeta(self): self.assertAlmostEqual(AeroParameters.getBeta(0.5), 0.86602540) self.assertAlmostEqual(AeroParameters.getBeta(1.5), 1.118033989)