# Find CJ speed cj_speed = CJspeed(P1, T1, q, mech) print('CJspeed '+str(cj_speed)+' (m/s)'); gas = PostShock_eq(cj_speed,P1, T1, q, mech) P2 = gas.P # Evaluate overdriven detonations and reflected shocks fstart = 1.; fstop = 1.5; fstep = 0.05 fnsteps = int((fstop-fstart)/fstep) speed = []; vs = []; ps = []; pr = []; vr = [] for f in np.linspace(fstart,fstop,num=fnsteps): u_shock = f*cj_speed speed.append(u_shock) print(' Detonation Speed '+str(speed[-1])+' (m/s)') gas = PostShock_eq(u_shock,P1, T1, q, mech) # Evaluate properties of gas object vs.append(1./gas.density) ps.append(gas.P) [p3,UR,gas3] = reflected_eq(gas1,gas,gas3,u_shock) pr.append(p3) vr.append(1./gas3.density) print('-------------------------------------------'); fid.write('Zone T = rho'+str(fnsteps+1)+'\n') fid.write('Variables = "detonation speed (m/s)", "detonation pressure (Pa)", "detonation volume (m3/kg)", "reflected shock pressure (Pa)", "reflected shock volume (m3/kg)"\n') for i in range(fnsteps): fid.write(' %14.5e \t %14.5e \t %14.5e \t %14.5e \t %14.5e \n' % (speed[i], ps[i], vs[i], pr[i], vr[i])) fid.close()
print('CJ computation for '+mech+' with composition ',q) P2 = gas.P T2 = gas.T q2 = gas.X rho2 = gas.density w2 = rho1/rho2*cj_speed u2= cj_speed-w2 Umin = soundspeed_eq(gas) print('CJ speed '+str(cj_speed)+' (m/s)'); print('CJ State'); print(' Pressure '+str(P2)+' (Pa)'); print(' Particle velocity '+str(u2)+' (m/s)'); # reflected shock from CJ detonation gas3 = ct.Solution(mech); [p3,Ur,gas3] = reflected_eq(gas1,gas,gas3,cj_speed); v3 = 1./gas.density print('Reflected shock (equilibrium) computation for ',mech,' with composition ',q) print(' Reflected wave speed '+str(Ur)+' (m/s)') print(' Reflected shock pressure '+str(gas3.P)+' (Pa)') # Bounds for reflected shock speed Umax = Ur+u2 print(' Maximum reflected shock speed '+str(Umax)+' (m/s)') print(' Minimum reflected shock speed '+str(Umin)+' (m/s)') print('Compute shock adiabat and wave curve starting at the CJ state') step = 10 # approximate desired step size (will not be exactly followed) npoints = int((Umax-Umin)/step) p = []; v = []; u3 = [];
vn_rho.append(gas1.density) vn_af.append(soundspeed_fr(gas1)) # ZND Structure ZNDout = zndsolve(gas1,gas,Ucj[-1],advanced_output=True) ind_len_ZND.append(ZNDout['ind_len_ZND']) exo_len_ZND.append(ZNDout['exo_len_ZND']) # CJ state gas1 = PostShock_eq(Ucj[-1],P1, T1,x,mech) cj_T.append(gas1.T) cj_P.append(gas1.P) cj_rho.append(gas1.density) cj_af.append(soundspeed_fr(gas1)) # Reflected CJ state [ref_P[i],Uref[i],gas2] = reflected_eq(gas,gas1,gas2,Ucj[-1]) # State 3 - Plateau at end of Taylor wave # print('Generating points on isentrope and computing Taylor wave velocity') w2 = gas.density*Ucj[-1]/cj_rho[-1] S2 = gas1.entropy_mass u2 = Ucj[-1] - w2 u = [u2] P = [gas1.P] R = [gas1.density] V = [1/R[0]] #T = [gas1.T] a = [soundspeed_eq(gas1)] vv = 1/cj_rho[-1] while u[-1] > 0:
print('CJ Parameters') print(' UCJ '+str(cj_speed)+' (m/s)') print(' Pressure '+str(P2)+' (Pa)') print(' Temperature '+str(T2)+' (K)') print(' Density '+str(R2)+' (kg/m3)') print(' Entropy '+str(S2)+' (J/kg-K)') print(' w2 (wave frame) '+str(w2)+' (m/s)') print(' u2 (lab frame) '+str(u2)+' (m/s)') print(' a2 (frozen) '+str(a2_fr)+' (m/s)') print(' a2 (equilibrium) '+str(a2_eq)+' (m/s)') print(' gamma2 (frozen) '+str(gamma2_fr)+' (m/s)') print(' gamma2 (equilibrium) '+str(gamma2_eq)+' (m/s)') print('--------------------------------------') # gas3 = ct.Solution(mech) p3,UR,gas3 = reflected_eq(gas1,gas,gas3,cj_speed) print('Reflected CJ shock (equilibrium) computation for '+mech+' with composition '+q) print(' CJ speed '+str(cj_speed)+' (m/s)') print(' Reflected wave speed '+str(UR)+' (m/s)') print('Post-Reflected Shock Parameters') print(' Pressure '+str(gas3.P)+' (Pa)') print(' Temperature '+str(gas3.T)+' (K)') print(' Density '+str(gas3.density)+' (kg/m3)') print('--------------------------------------'); # print('Shock computation for '+mech+' with composition '+q) gas = PostShock_fr(cj_speed,P1,T1,q,mech) print(' shock speed '+str(cj_speed)+' (m/s)') print('Postshock State') print(' Pressure '+str(gas.P)+' (Pa)') print(' Temperature '+str(gas.T)+' (K)')
cj_speed = CJspeed(P1, T1, q, mech) # incident wave must be greater than or equal to cj_speed for # equilibrium computations UI = 1.2*cj_speed print('Incident shock speed UI = %.2f m/s' % (UI)) # compute postshock gas state object gas2 gas2 = PostShock_eq(UI, P1, T1, q, mech); P2 = gas2.P/ct.one_atm; print ('Equilibrium Post-Incident-Shock State') print ('T2 = %.2f K, P2 = %.2f atm' % (gas2.T,P2)) # compute reflected shock post-shock state gas3 [p3,UR,gas3]= reflected_eq(gas1,gas2,gas3,UI); # Outputs: # p3 - pressure behind reflected wave # UR = Reflected shock speed relative to reflecting surface # gas3 = gas object with properties of postshock state P3 = gas3.P/ct.one_atm print ('Equilibrium Post-Reflected-Shock State') print ('T3 = %.2f K, P3 = %.2f atm' % (gas3.T,P3)) print ("Reflected Wave Speed = %.2f m/s" % (UR)) # gas states print('Incident gas state') gas1() print('Post-incident-shock gas state') gas2()