LSodar
LSODAR (short for Livermore Solver for Ordinary Differential equations, with Automatic method switching for stiff and nonstiff problems, and with Root-finding) is a numerical solver providing an efficient and stable method to solve Ordinary Differential Equations (ODEs) Initial Value Problems. Called by xcos.
Description
LSODAR (short for Livermore Solver for Ordinary Differential equations, with Automatic method switching for stiff and nonstiff problems, and with Root-finding) is a numerical solver providing an efficient and stable variable-size step method to solve Initial Value Problems of the form :
\begin{eqnarray}
\dot{y} = f(t,y), \hspace{3 mm} y(t_0) = y_0, \hspace{3 mm} y \in R^N
\end{eqnarray}
LSodar is similar to CVode in many ways :
It uses variable-size steps,
It can potentially use BDF and Adams integration, methods,
BDF and Adams being implicit stable methods, LSodar is suitable for stiff and nonstiff problems,
They both look for roots over the integration interval.
The main difference though is that LSodar is fully automated, and chooses between BDF and Adams itself, by checking for stiffness at every step.
If the step is considered stiff, then BDF (with max order set to 5) is used and the Modified Newton method 'Chord' iteration is selected.
Otherwise, the program uses Adams integration (with max order set to 12) and Functional iterations.
The stiffness detection is done by step size attempts with both methods.
First, if we are in Adams mode and the order is greater than 5, then we assume the problem is nonstiff and proceed with Adams.
The first twenty steps use Adams / Functional method.
Then LSodar computes the ideal step size of both methods. If the step size advantage is at least ratio = 5, then the current method switches (Adams / Functional to BDF / Chord Newton or vice versa).
After every switch, LSodar takes twenty steps, then starts comparing the step sizes at every step.
Such strategy induces a minor overhead computational cost if the problem stiffness is known, but is very effective on problems that require differentiate precision. For instance, discontinuities-sensitive problems.
Concerning precision, the two integration/iteration methods being close to CVode's, the results are very similar.
Examples
The integral block returns its continuous state, we can evaluate it with LSodar by running the example :
The Scilab console displays :
Now, in the following script, we compare the time difference between the methods by running the example with the five solvers in turn :
Open the script
These results show that on a nonstiff problem, for the same precision required, LSodar is significantly faster. Other tests prove the proximity of the results. Indeed, we find that the solution difference order between LSodar and CVode is close to the order of the highest tolerance (
ylsodar - ycvode
≈ max(reltol, abstol) ).
Variable step-size ODE solvers are not appropriate for deterministic real-time applications because the computational overhead of taking a time step varies over the course of an application.
See Also
CVode
IDA
Runge-Kutta 4(5)
Dormand-Price 4(5)
ode
ode_discrete
ode_root
odedc
impl
Bibliography
ACM SIGNUM Newsletter, Volume 15, Issue 4, December 1980, Pages 10-11 LSode - LSodiSundials DocumentationHistory5.4.1LSodar solver added