ZNDout = zndsolve(gas,gas1,cj_speed[i],advanced_output=True) ind_time_ZND[i] = ZNDout['ind_time_ZND'] ind_len_ZND[i] = ZNDout['ind_len_ZND'] exo_time_ZND[i] = ZNDout['exo_time_ZND'] exo_len_ZND[i] = ZNDout['exo_len_ZND'] Tf_ZND[i] = ZNDout['T'][-1] ##Calculate CJstate Properties### gas = PostShock_eq(cj_speed[i],P1[i], T1,x, mech) T2[i] = gas.T P2[i] = gas.P rho2[i] = gas.density #Approximate the effective activation energy using finite differences Ta = Ts[i]*(1.02) gas.TPX = Ta,Ps[i],x CVout1 = cvsolve(gas,t_end=1e-4) taua = CVout1['ind_time'] Tb = Ts[i]*(0.98) gas.TPX = Tb,Ps[i],x CVout2 = cvsolve(gas,t_end=1e-4) taub = CVout2['ind_time'] #Approximate effective activation energy for CV explosion if taua == 0 and taub == 0: theta_effective_CV[i] = 0 else: theta_effective_CV[i] = 1.0/Ts[i]*((np.log(taua)-np.log(taub))/((1.0/Ta)-(1.0/Tb))) # Approximate effective activation energy for ZND Detonation gas = PostShock_fr(cj_speed[i]*1.02,P1[i],T1,x, mech) Ta = gas.T
P3.append(P[-1] + u[-1]*(P[-2]-P[-1])/(u[-2]-u[-1])) # Tune dt for quicker solving of ODEs. For these parameters, Case 1 has a much longer timescale # than the other cases. if i == 0: t_end = 1e-3 dt = 1e-5 else: t_end = 5e-5 dt = 1e-7 # Approximate the effective activation energy using finite differences gas = PostShock_fr(Ucj[-1], P1, T1, x, mech) Ts = gas.T; Ps = gas.P Ta = Ts*(1.02) gas.TPX = Ta,Ps,x CVout1 = cvsolve(gas,t_end=t_end,max_step=dt) Tb = Ts*(0.98) gas.TPX = Tb,Ps,x CVout2 = cvsolve(gas,t_end=t_end,max_step=dt) # Approximate effective activation energy for CV explosion taua = CVout1['ind_time'] taub = CVout2['ind_time'] if taua==0 and taub==0: theta_effective_CV.append(0) else: theta_effective_CV.append(1/Ts*((np.log(taua)-np.log(taub))/((1/Ta)-(1/Tb)))) print('--------------------------------------');
# Find post shock state for given speed gas.TPX = T1,P1,x gas = PostShock_fr(cj_speed*overdrive[i], P1, T1, x, mech) Ts[i] = gas.T # frozen shock temperature Ps[i] = gas.P # frozen shock pressure ### Constant Volume Explosion Data ### # Solve constant volume explosion ODEs CVout = cvsolve(gas) exo_time_CV[i] = CVout['exo_time'] ind_time_CV[i] = CVout['ind_time'] ### ZND Detonation Data ### gas.TPX = T1,P1,x gas = PostShock_fr(cj_speed*overdrive[i], P1, T1, x, mech) # Solve znd detonation ODEs ZNDout = zndsolve(gas,gas1,cj_speed*overdrive[i],advanced_output=True) exo_time_ZND[i] = ZNDout['exo_time_ZND'] exo_len_ZND[i] = ZNDout['exo_len_ZND'] ind_time_ZND[i] = ZNDout['ind_time_ZND'] ind_len_ZND[i] = ZNDout['ind_len_ZND'] Tf_ZND[i] = ZNDout['T'][-1] ### Calculate CJ state properties ### gas = PostShock_eq(cj_speed*overdrive[i], P1, T1, x, mech); T2[i] = gas.T P2[i] = gas.P rho2[i] = gas.density