def flowprandtlmeyer(gamma, prandtlmeyer_array, mtype='mach'): """ Calculate Prandtl-Meyer functions for expansion waves. http://www.mathworks.nl/help/aerotbx/ug/flowprandtlmeyer.html """ M, V, U = aerotbx.flowprandtlmeyer(**{'gamma':gamma, mtype:prandtlmeyer_array}) return M, V, U
def flowprandtlmeyer(gamma, prandtlmeyer_array, mtype='mach'): """ Calculate Prandtl-Meyer functions for expansion waves. http://www.mathworks.nl/help/aerotbx/ug/flowprandtlmeyer.html """ M, V, U = aerotbx.flowprandtlmeyer(**{ 'gamma': gamma, mtype: prandtlmeyer_array }) return M, V, U
plot_pres_c = True plot_regions = True plot_chars = True plot_s = True plot_pres_s = True import matplotlib # Set graph font size matplotlib.rcParams.update({'font.size': 16}) # Initialise the flow variables phi = np.zeros(n + 1 + 3 * int(round(n * (n + 1) / 2.))) nu = np.zeros(n + 1 + 3 * int(round(n * (n + 1) / 2.))) M = np.zeros(n + 1 + 3 * int(round(n * (n + 1) / 2.))) mu = np.zeros(n + 1 + 3 * int(round(n * (n + 1) / 2.))) # Compute PM angle and Mach angle in the exit M[0], nu[0], mu[0] = aerotbx.flowprandtlmeyer(gamma=gamma, M=M_e) # Compute the total pressure ratio in the exit P_eP_t = aerotbx.flowisentropic(gamma=gamma, M=M_e)[2] # Outputs [mach, T, P, rho, area] # Compute total pressure ratio in the ambient after the expansion P_aP_t = P_eP_t / P_eP_a # With the total pressure ratio, compute the Mach number behind the expansion fan (region 3) M[n] = aerotbx.flowisentropic(gamma=gamma, p=P_aP_t)[0][0] # Compute the flow angle in the region behind the expansion fan (region 3) (_, nu[n], mu[n]) = aerotbx.flowprandtlmeyer(gamma=gamma, M=M[n]) phi[n] = nu[n] - nu[0] + phi[0]
gamma = 1.4 M0 = 2.0 phi0 = 0.0 # Degrees n = 3 # Number of characteristics h = 0.1 #Plotting plot_pres_c = False plot_mach = False phi = np.zeros(n + 1 + 2 * round(n * (n + 1) / 2.)) nu = np.zeros(n + 1 + 2 * round(n * (n + 1) / 2.)) M = np.zeros(n + 1 + 2 * round(n * (n + 1) / 2.)) mu = np.zeros(n + 1 + 2 * round(n * (n + 1) / 2.)) (M[0], nu[0], mu[0]) = aerotbx.flowprandtlmeyer(gamma=gamma, M=M0) # Output: [m,nu,mu] # # First calculate the Mach number in region n using the pressure ratio since the expension is isentropic p_0_p_t = aerotbx.flowisentropic(gamma=gamma, M=M0)[2] # Output: [mach,T,P,rho,area] p_n_p_t = p_0_p_t * (1 / p0_pa ) # Calculate ratio total pressure vs pressure in 3 p_a_p_t = p_n_p_t # # # Using this total pressure ratio the mach number in section 3 can be determined M[n] = aerotbx.flowisentropic( gamma=gamma, p=p_n_p_t)[0][0] # Returns an array of mach numbers (_, nu[n], mu[n]) = aerotbx.flowprandtlmeyer(gamma=gamma, M=M[n]) phi[n] = nu[n] - nu[0] + phi[0]
import aerotbx h = 0.5 #outlet height [m] p0_pa = 2.0 gamma = 1.4 M0 = 2.0 phi0 = 0.0 # Degrees nu0 = aerotbx.flowprandtlmeyer(gamma=gamma, M=M0)[1] # Output: [m,nu,mu] # Know from common knowledge phi4 = phi7 = phi9 = 0.0 # First use 3 characteristcs solving the problem # See drawn figure # First calculate the Mach number in region 3 using the pressure ratio since the expension is isentropic p_0_p_t = aerotbx.flowisentropic(gamma=gamma, M=M0)[2] # Output: [mach,T,P,rho,area] p_3_p_t = p_0_p_t * (1 / p0_pa ) # Calculate ratio total pressure vs pressure in 3 p_a_p_t = p_3_p_t # Using this total pressure ratio the mach number in section 3 can be determined M3 = aerotbx.flowisentropic( gamma=gamma, p=p_3_p_t)[0][0] # Returns an array of mach numbers nu3 = aerotbx.flowprandtlmeyer(gamma=gamma, M=M3)[1][0] # Use MOC to obtain mu3 (gamma + from 0 to 3) phi3 = nu3 - nu0 + phi0 # No go back through expansion fan dphi_I = (phi3 - phi0) / 3.0 # Phi step over fan I