FSpi3 = np.ones(npts+1) FSm3 = M3sup*np.ones(npts+1) plt.subplot(311) plt.plot(FSalpha, FSpi3, '-', color='#ff0000') plt.subplot(312) plt.plot(FSalpha, FSpi4, '-', color='#ff0000') plt.subplot(313) plt.plot(FSalpha, FSm3, '-', color='#ff0000') # --- (CW) conventional working state # M8 is sonic so M4 is known CWm4 = mf.Mach_Sigma(A3A2/A8A2, .1, gam) # look for subsonic value CWm3low = sw.downstream_Mn(M3sup, gam) alphamin = ray.Ti_Ticri(CWm4, gam)/ray.Ti_Ticri(CWm3low, gam) CWm3high = mf.Mach_Sigma(A3A2*mf.Sigma_Mach(sw.downstream_Mn(M2, gam), gam), .1, gam) alphamax = ray.Ti_Ticri(CWm4, gam)/ray.Ti_Ticri(CWm3high, gam) print " unstart of inlet throat for Ti4/Ti0 = %6.3f"%(alphamax) print " fully supersonic flow for Ti4/Ti0 = %6.3f"%(alphamin) CWalpha = np.log10(np.logspace(alphamin, alphamax, npts+1)) CWm3 = ray.SubMach_TiTicri(ray.Ti_Ticri(CWm4, gam)/CWalpha, gam) CWpi3 = mf.Sigma_Mach(CWm3, gam)/mf.Sigma_Mach(M2, gam)/A3A2 CWpi4 = CWpi3*ray.Pi_Picri(CWm4, gam)/ray.Pi_Picri(CWm3, gam) CWm4 = np.ones(npts+1)*CWm4 plt.subplot(311) plt.plot(CWalpha, CWpi3, '-', color='#bb0000') plt.subplot(312)
import aero.ShockWave as aerosw import numpy as np import matplotlib.pyplot as plt npoints = 100 gam = 1.4 fig=plt.figure(1, figsize=(10,8)) fig.suptitle('Polar of isentropic compression and Shock-Waves, $\gamma = %.1f$'%gam, fontsize=12, y=0.93) macharray = [ 1.2, 1.5, 2., 3., 5.] rdev = np.linspace(0., 50., npoints+1) for m in macharray: sig = np.linspace(deg.asin(1./m), 90., npoints+1) dev = aerosw.deflection_Mach_sigma(m, sig, gam) kpsw = aerosw.Ps_ratio(m*deg.sin(sig), gam) # pressure ratio only depends on normal Mach number rdev = np.linspace(0., .99*aerof.PrandtlMeyer_Mach(m, gam), npoints+1) kpis = aerof.IsentropicPsratio_Mach_deflection(m, rdev, gam) plt.plot(dev, kpsw, 'k-') plt.plot(rdev, kpis, 'k--', alpha=0.6) plt.plot(rdev[-1], kpis[-1], 'ro', alpha=0.5) plt.text(rdev[-1], kpis[-1], 'M=1', fontsize=7, clip_on='true', horizontalalignment='right') plt.text(dev[npoints/3], kpsw[npoints/3], '%.3g'%m, horizontalalignment='left', verticalalignment='top', fontsize=8, bbox=dict(facecolor='white', alpha=0.8), rotation='0') #labels.append(legends[i]+", t=%.1f"%results[i][t].time) #legend(labels, loc='upper left',prop={'size':10}) plt.xlim(0., 50.) plt.ylim(1., 50.)
import aero.CompressibleFlow as aerof import aero.ShockWave as aerosw import numpy as np import matplotlib.pyplot as plt npoints = 100 gam = 1.4 fig=plt.figure(1, figsize=(10,8)) fig.suptitle('Polar of Shock-Waves, $\gamma = %.1f$'%gam, fontsize=12, y=0.93) macharray = [ 1.05, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2., 2.2, 2.5, 3., 3.5, 4., 5., 10., 100. ] for m in macharray: sig = np.linspace(deg.asin(1./m), 90., npoints+1) dev = aerosw.deflection_Mach_sigma(m, sig, gam) plt.plot(dev, sig, 'k-') plt.text(dev[npoints/2], sig[npoints/2], '%.3g'%m, horizontalalignment='center', verticalalignment='top', fontsize=8, bbox=dict(facecolor='white', alpha=0.8), rotation='60') #labels.append(legends[i]+", t=%.1f"%results[i][t].time) #legend(labels, loc='upper left',prop={'size':10}) plt.axis([0., 50., 0., 90.]) plt.xlabel('deviation $\Delta\\theta$', fontsize=10) plt.ylabel('shock angle $\sigma$', fontsize=10) plt.minorticks_on() plt.grid(which='major', linestyle='-', alpha=0.8) plt.grid(which='minor', linestyle=':', alpha=0.5) fig.savefig('polar.png', bbox_inches='tight') #show()