def sigmaSonic(Mach, gamma=1.4): """ computes the shock angle for a downstream SONIC Mach number """ M2 = np.square(Mach) ka = gamma-3+M2*(gamma+1) kb = (gamma+1)*(np.square(M2-3)+gamma*np.square(M2+1)) return degree.asin(np.sqrt((ka+np.sqrt(kb))/(4*gamma*M2)))
def weaksigma_Mach_deflection(Mach, deflection, gamma=1.4): ka = (1. + .5*(gamma+1.)*Mach**2)*degree.tan(deflection) kb = 1. - Mach**2 kc = (1. + .5*(gamma-1.)*Mach**2)*degree.tan(deflection) kd = (ka**2/3. - kb)/3. ke = 2.*ka**3/27. - ka*kb/3. + kc if ke**2 - 4.*kd**3 > 0: print "no weak shock wave solution" return degree.asin(1./Mach) else: phi = math.acos(-.5*ke/math.sqrt(kd**3)) kf = 2.*math.sqrt(kd)*math.cos(phi/3.) - ka/3. return degree.atan(1./kf)
def sigma_Mach_deflection(Mach, deflection, gamma=1.4): def local_f(sig): return deflection_Mach_sigma(Mach, sig, gamma) return IterativeSolve.secant_solve(local_f, deflection, degree.asin(1./Mach)+deflection)
def deflection_Mach_ShockPsratio(Mach, Pratio, gamma=1.4): return deflection_Mach_sigma(Mach, degree.asin(Mn_Ps_ratio(Pratio, gamma)/Mach), gamma)