0
$\begingroup$

Currently, my problem requires me to solve a system a large system of non-linear ODEs (up to ~5000). So far, I have been using scipy.integrate.odeint as my workhorse.

A simpler subset of my problem only involves ~50 non-linear ODEs. Solving the system over an interval $[0, 10]$ takes about 3 times longer than solving the system over $[0, 1]$. Not bad!

However, solving the system over $[0, 1000]$ takes about 1500 times longer than solving over $[0, 1]$. Not so nice!

An obvious reason why this might be the case is because at some points between $[0, 1000]$, the solution takes far longer to converge than usual -- so, the average time taken to solve the system at each time step is greater over $[0, 1000]$ then over $[0, 1]$. Is my intuition correct over here?

What other things might be issues?

$\endgroup$
2
  • $\begingroup$ I'm assuming this is an initial value problem rather than a boundary value problem? There are different reasons this would happen in either case. $\endgroup$ Oct 7, 2014 at 13:21
  • $\begingroup$ @DougLipinski That's right -- it's an IVP. $\endgroup$
    – bzm3r
    Oct 7, 2014 at 13:46

1 Answer 1

4
$\begingroup$

Adaptive time integrators adjust the step length in an attempt to maximize efficiency while controlling truncation error (usually locally) to a prescribed tolerance. If the solution undergoes rapid changes, the local truncation error estimates will force the time step to decrease. Implicit integrators have the additional complication that algebraic systems (especially nonlinear systems) may require vastly different amounts of work, and that amount of work may depend on the step size.

Production ODE integrators should include diagnostics so that you can see where the time is spent (e.g., very short time steps or many nonlinear iterations). You can then decide whether to change the method parameters, choose a different method, or live with the observed performance.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.