Skip to content

[R-sig-dyn-mod] Dimension error using ode.2D

2 messages · amiller at math.utah.edu, Thomas Petzoldt

#
Hello,

I am getting the following error when I use ode.2D:

Error in ode.2D(y = uini, times = times, func = tissue2D_deriv, parms =
NULL,  :
  cannot run ode.2D: dimensions are not an integer fraction of number of
state variables

I think the reason may be because one of my state variables is defined on
the full 2D domain so that its dimensions are nx*ny (nx is number of x
grid points, ny is number of y grid points). I have another state variable
that is only defined on a 1D slice so that its dimensions are nx*1.

The state variable ("G") that is defined on the full 2D domain undergoes
2D diffusion, and the state variable that is defined on the 1D slice is
dependent on G. I am using ode.2D because I am solving the PDE using
method of lines.

Is there a way to model PDEs (solved using method of lines) and ODEs (that
are dependent on the solution of the PDEs) using ode.2D?

Thank you,
Anna
#
Hi,

ode.2d is a "top-leve function" for the special case where each grid 
cell has the same (full) set of states. This allows the solver to 
calculate the sparsity pattern of the Jacobian and to speed up the 
numerical solution.


Am 03.11.2017 um 07:53 schrieb amiller at math.utah.edu:
Yes, indeed.
In this case you can use another solver directly, e.g. lsodes with a 
user-defined sparsity structure (or with the full Jacobian), or to use 
another Jacobian-free solver. More about this can be found in the 
following book:

Soetaert, Cash, Mazzia (2012) Solving Differential Equations in R. 
Springer Verlag. p. 142ff.
Hope it helps,

Thomas