M = np.asarray(M); rho = np.asarray(rho) integrand = -1*np.sqrt(M**2-1)/M**2/rho omega = [theta_det] for n in range(1,vstep): omega.append(omega[n-1] +(integrand[n-1] + integrand[n])*(rho[n]-rho[n-1])/2) ## # compute shock polar # 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
s = scj * .98 deltas = 0.01 * scj jmax = 4 PR = np.asarray(PR) # initialize arrays Ps_f = np.zeros((len(PR), jmax)) Ps_e = np.copy(Ps_f) vs_f = np.copy(Ps_f) vs_e = np.copy(Ps_f) for j in range(jmax): for i, pp in enumerate(PR * ct.one_atm): # frozen (CJ composition) gas.SPX = s, pp, qcj Ps_f[i, j] = gas.P / ct.one_atm vs_f[i, j] = 1 / gas.density # equilibrium gas.equilibrate('SP') Ps_e[i, j] = gas.P / ct.one_atm vs_e[i, j] = 1 / gas.density s = s + deltas print('Isentropes created') ## plot creation maxP = max(PR) minP = min(PR) maxV = max(vR) minV = min(vR)