w3 = cj_speed*rho4/driver_gas.density u3 = [w3-cj_speed] ## Evaluate initial state for expansion computation rho3 = [driver_gas.density] P3 = [driver_gas.P] T3 = [driver_gas.T] S4 = driver_gas.entropy_mass ## compute unsteady expansion (frozen) print('Generating points on isentrope P-u curve') vv = 1/rho3[0] while u3[-1] < u2[-1]: vv = vv*1.01 driver_gas.SVX = S4,vv,driver_gas.X if EQ_EXP: # required for equilibrium expansion driver_gas.equilibrate('SV') a3.append(soundspeed_eq(driver_gas)) else: # use this for frozen expansion a3.append(soundspeed_fr(driver_gas)) P3.append(driver_gas.P) T3.append(driver_gas.T) rho3.append(driver_gas.density) u3.append(u3[-1] - 0.5*(P3[-1]-P3[-2])*(1/(rho3[-1]*a3[-1]) + 1./(rho3[-2]*a3[-2]))) ## Input limits for finding intersection of polars
# estimate maximum speed wmax = np.sqrt(2*h0) # initialize variables for computing PM properties and plotting rho = []; a = []; P = []; T = []; h = []; mu = []; M = []; Me = []; u = []; ue = []; v1 = 1/rho2 # lower limit to specific volume in PM fan v2 = 50*v1 # upper limit to specific volume in PM fan vstep = 1000 ## # Compute expansion conditions over range from minimum to maximum specific volume. # User can adjust the increment and endpoint to get a smooth output curve and reliable integral. # Could also try a logarithmic range for some cases. for v in np.linspace(v1,v2,num=vstep): rho.append(1/v) x = gas.X # update mole fractions based on last gas state gas.SVX = s2,v,x gas.equilibrate('SV') # required for equilibrium expansion h.append(gas.enthalpy_mass) u.append(np.sqrt(2*(h0-h[-1]))) # flow speed within expansion # Need to explicitly upcast to complex, otherwise get NaN: ue.append(np.real(np.sqrt(2*(np.asarray(h1-h[-1],dtype=complex))))) # ideal axial velocity for RDE model a.append(soundspeed_eq(gas)) # use this for equilibrium expansion, almost always the case for detonation products #a.append(soundspeed_fr(gas)) # use this for frozen expansion Me.append(ue[-1]/a[-1]) M.append(u[-1]/a[-1]) if M[-1] < 1: # Sometimes the first M value has been observed to be ~0.999 which leads to errors # in the arcsin and sqrt functions that follow M[-1] = 1.00001 mu.append(np.arcsin(1/M[-1])) T.append(gas.T)
# stagnation enthalpy h0 = h1 + U1**2/2 # estimate maximum speed wmax = np.sqrt(2*h0) # initialize variables for computing PM properties and plotting v2 = 200*v1 rho = []; a = []; h = []; u = []; M = []; mu = []; T = []; P = []; streamwidth = []; ## # Compute expansion conditions over range from minimum to maximum specific volume. # User can adjust the increment and endpoint to get a smooth output curve and reliable integral. # Could also try a logarithmic range for some cases. for v in np.linspace(v1,v2,num=1000): rho.append(1/v) x = gas.X # update mole fractions based on last gas state gas.SVX = s1,1/rho[-1],x if EQ: # required for equilibrium expansion gas.equilibrate('SV') a.append(soundspeed_eq(gas)) else: # use this for frozen expansion a.append(soundspeed_fr(gas)) h.append(gas.enthalpy_mass) u.append(np.sqrt(2*(h0-h[-1]))) M.append(u[-1]/a[-1]) if M[-1] < 1: # Sometimes the first M value has been observed to be ~0.999 which leads to errors # in the arcsin and sqrt functions that follow M[-1] = 1.00001
a = np.zeros(npoints, float) u = np.zeros(npoints, float) T = np.zeros(npoints, float) V[1] = V2 P[1] = P2 D[1] = D2 a[1] = a2_eq u[1] = u2 T[1] = T2 print('Generating points on isentrope and computing Taylor wave velocity') i = 1 while u[i] > 0 and i < npoints: i = i + 1 vv = vv * 1.01 x = gas.X gas.SVX = S2, vv, x gas.equilibrate('SV') P[i] = gas.P D[i] = gas.density V[i] = 1 / D[i] T[i] = gas.T a[i] = soundspeed_eq(gas) u[i] = u[i - 1] + 0.5 * (P[i] - P[i - 1]) * (1. / (D[i] * a[i]) + 1. / (D[i - 1] * a[i - 1])) # estimate plateau conditions by interpolation on last two points nfinal = i P3 = P[nfinal] + u[nfinal] * (P[nfinal - 1] - P[nfinal]) / (u[nfinal - 1] - u[nfinal]) a3 = a[nfinal] + u[nfinal] * (a[nfinal - 1] - a[nfinal]) / (u[nfinal - 1] - u[nfinal]) V3 = V[nfinal] + u[nfinal] * (V[nfinal - 1] - V[nfinal]) / (u[nfinal - 1] -