使用你之前说的快速模式更改下面的代码:def ign_uqgas1 temp pres fuel T_equi simtype=UV gas1TPX = temp pres 100000 fuel gas1use_fast_methods = True # here it is constant volume with IdealGasReactor if
def ign_uq(gas1, temp, pres, fuel, T_equi, simtype='UV'): gas1.TPX = temp, pres * 100000, fuel gas1.use_fast_methods = True
reactor_type = ct.IdealGasReactor if simtype == 'UV' else ct.IdealGasConstPressureReactor
r = reactor_type(gas1)
sim = ct.ReactorNet([r])
sim.rtol = 1.0e-6
sim.atol = 1.0e-15
t_end = 0.01
time = np.array([])
temp = np.array([])
states = ct.SolutionArray(gas1, extra=['t'])
while sim.time < t_end and r.T < T_equi + 1000:
sim.step()
time = np.append(time, sim.time)
temp = np.append(temp, r.T)
states.append(r.thermo.state, t=sim.time)
diff_temp = np.diff(temp) / np.diff(time)
ign_pos = np.argmax(diff_temp)
ign = time[ign_pos]
return ign
原文地址: https://www.cveoy.top/t/topic/bq2E 著作权归作者所有。请勿转载和采集!