gas = PostShock_eq(U, P, T1, X, mech) PostShock_T.append(gas.T) plt.plot(P1, PostShock_T, label="phi=%.2f" % (phi / 100)) plt.legend() plt.xlabel('Initial pressure [bar]') plt.ylabel('Post shock temperature [K]') plt.title('Post shock temerature of hydrogen-air mixture', fontweight='bold') plt.grid() plt.savefig('hydrogen_T(P1).png', dpi=1000) plt.show() for phi in range(50, 175, 25): P1 = [] X = 'O2:0.5, N2:1.88, H2:' + str(phi / 100) PostShock_P = [] for P in range(100000, 1250000, 250000): gas.TPX = T1, P, X P1.append(P / 100000) U = CJspeed(P, T1, X, mech) gas = PostShock_eq(U, P, T1, X, mech) PostShock_P.append(gas.P / 100000) plt.plot(P1, PostShock_P, label="phi=%.2f" % (phi / 100)) plt.legend() plt.xlabel('Initial pressure [bar]') plt.ylabel('Post shock pressure [bar]') plt.title('Post shock pressure of hydrogen-air mixture', fontweight='bold') plt.grid() plt.savefig('hydrogen_P(P1).png', dpi=1000) plt.show()
gas = PostShock_eq(U, P1, T, X, mech) PostShock_T.append(gas.T) plt.plot(T1, PostShock_T, label="phi=%.2f" % (phi / 100)) plt.legend() plt.xlabel('Initial temperature [Kelvins]') plt.ylabel('Post shock temperature [K]') plt.title('Post shock temerature of methane-air mixture', fontweight='bold') plt.grid() plt.savefig('methane_T(T1).png', dpi=1000) plt.show() for phi in range(50, 175, 25): T1 = [] X = 'O2:2, N2:7.52, CH4:' + str(phi / 100) PostShock_P = [] for T in range(250, 2500, 250): gas.TPX = T, P1, X T1.append(T) U = CJspeed(P1, T, X, mech) gas = PostShock_eq(U, P1, T, X, mech) PostShock_P.append(gas.P / 100000) plt.plot(T1, PostShock_P, label="phi=%.2f" % (phi / 100)) plt.legend() plt.xlabel('Initial temperature [Kelvins]') plt.ylabel('Post shock pressure [bar]') plt.title('Post shock pressure of methane-air mixture', fontweight='bold') plt.grid() plt.savefig('methane_P(T1).png', dpi=1000) plt.show()
# Set up gas object gas1 = ct.Solution(mech) gas1.TPX = T1, P1, q # Find equilibrium post shock state for given speed gas = PostShock_eq(cj_speed, P1, T1, q, mech) u_cj = cj_speed * gas1.density / gas.density # Find frozen post shock state for given speed gas = PostShock_fr(cj_speed, P1, T1, q, mech) # Solve ZND ODEs, make ZND plots out = zndsolve(gas, gas1, cj_speed, t_end=1e-3, advanced_output=True) # Find CV parameters including effective activation energy gas.TPX = T1, P1, q gas = PostShock_fr(cj_speed, P1, T1, q, mech) Ts = gas.T Ps = gas.P Ta = Ts * 1.02 gas.TPX = Ta, Ps, q CVout1 = cvsolve(gas) Tb = Ts * 0.98 gas.TPX = Tb, Ps, q CVout2 = cvsolve(gas) # Approximate effective activation energy for CV explosion taua = CVout1['ind_time'] taub = CVout2['ind_time'] if taua == 0 and taub == 0: theta_effective_CV = 0 else:
PH1[i + 1] = gas.P / ct.one_atm vH1[i + 1] = 1 / gas.density i = i + 1 print('Reactant Hugoniot Array Created') gas = PostShock_eq(U1, P1, T1, q, mech) veq = 1.0 / gas.density Peq = gas.P / ct.one_atm # PRODUCT HUGONIOT # The method used for finding the product hugoniot is not # quite as robust as for reactants so some care must be taken # at large overdrives. # Get the first point on the product Hugoniot - CV combustion gas.TPX = T1, P1, q gas.equilibrate('UV') Ta = gas.T Pcv = gas.P / ct.one_atm va = 1.0 / gas.density n = np.int((va - 0.4 * vcj) / 0.01) PH2 = np.zeros(n + 1, float) vH2 = np.zeros(n + 1, float) PH2[0] = gas.P / ct.one_atm vH2[0] = va i = 0 vb = va while (i < n):
# First compute upstream state for RDE model, expand detonation products to ambient pressure # Set freesteam velocity to expansion speed. Accounts for shear across upstream contact P = np.asarray(P) if EQ: gas.SPX = s2,P1,x gas.equilibrate('SP') a4 = soundspeed_eq(gas) U4fun = pchip(P/P1,u) U4 = U4fun(1) else: # alternative state upstream: reactants (need to use frozen shock calculation with this) #qs = 'C2H4:1.00 O2:3'; %ethylene oxygen qs = 'O2:1.00,N2:3.76' # combustion air Ts = 300. gas.TPX = Ts,P1,qs a4 = soundspeed_fr(gas) U4 = u_tp # no shear between bounding gas and reacting layer ## # states upstream of shock rho4 = gas.density P4 = gas.P T4 = gas.T s4 = gas.entropy_mass x4 = gas.X h4 = gas.enthalpy_mass gamma4 = a4**2*rho4/P4 beta_min = np.arcsin(a4/U4) # Mach angle print('State 4 - upstream of oblique shock')
vmin = 0.3 * vcj vmax = 1.7 * vcj vinc = .01 * vcj vsteps = int((vmax - vmin) / vinc) for v2 in np.linspace(vmin, vmax, num=vsteps): vR.append(v2) PRpa = (P1 - r1**2 * U1**2 * (v2 - v1)) PR.append(PRpa / ct.one_atm) # Pressure in atmospheres print('Rayleigh Line Array Created') ## Compute product Hugoniot # Use CV combust as initial state gas.TPX = T1, P1, q gas.equilibrate('UV') Ta = gas.T va = 1 / gas.density PH2 = [gas.P / ct.one_atm] vH2 = [va] Grun = [gruneisen_eq(gas)] gamma = [(soundspeed_eq(gas))**2 / (vH2[0] * gas.P)] denom = [1 + Grun[0] * (vH2[0] - v1) / (2 * vH2[0])] i = 0 vb = va while vb > vmin: i = i + 1 vb = va - i * .01