使用scipy求解ODE方程时,时间步太小导致程序不停运行

问题描述 投票:0回答:0

我使用scipy,intergrate.ode,最大时间设置为100,但是时间步长很小(2e-6),导致整个程序运行时间很长

solver = ode(f).set_integrator('isoda', method='BDF', rtol=RelTol, atol=AbsTol, max_step=100).set_f_params(chemsys)
solver.set_initial_value(y0, 0)
tspan = 100
t = [0]
y = [y0]
while solver.successful() and solver.t < tspan:
    solver.integrate(tspan, step=True)
    t.append(solver.t)
    y.append(solver.y)

我设置min_step为0.1,但是没有用。然而,ODE15s 方法在 matlab 中的时间步长可能会变大。

scipy ode
© www.soinside.com 2019 - 2024. All rights reserved.