Skip to content

[R-sig-dyn-mod] Problem with simecol and ode - crash from R

Rainer M Krug wrote:
Hi Rainer,

as you see yourself, this is not a problem of package simecol, it is a
problem of lsoda from the deSolve package. The reason is, that with the
parameters given, your simulation runs to minus infinity.

As a result, former versions of deSolve/lsoda produced a buffer overflow
and this resulted in a "stack smashing" error.

The "stack smashing" bug was solved in version 1.5 of deSolve, available
from CRAN since last weekend. Instead of breaking R lsoda now issues an
error message. I admit that this error message is not very helpful, but
there are several possibilities to diagnose the problem:

One option is to use a fixed step solver (rk4, euler) as you did, or a
different variable time step solver (rk alias ode45, vode, lsode or
daspk). Given your model and parameters, try:

solver(lgH) <- "vode"
plot(sim(lgH))

lsoda seems the only one that fails completely, but even that case can
be solved (in the diagnostic sense, i.e. by potentially loosing
accuracy) if you limit hmin, e.g.:

solver(lgH) <- "lsoda"
plot(sim(lgH, hmin = 1e-12))


Hope it helps and please update deSolve.

Thomas Petzoldt