Page 1 of 1

### Variable Steps and Integration methods

Posted: Wed Aug 05, 2009 6:35 pm
So my gap junction, inhibitory synapse coupled network (200 cells) runs pretty slowly. I tried various variable step methods; but they all ran considerably slower. And the local step method doesn't run at all. And it's not a very noisy network; most of the time, the cells have only a subtly fluctuating membrane potential

What's going on here?

### Re: Variable Steps and Integration methods

Posted: Wed Aug 05, 2009 9:43 pm
Models of individual cells that are singly connected (may be branched, but have no closed loops), or networks of such cells that are connected by events delivered by NetCons, are represented by a family of equations whose system matrix is tridiagonal. That is, all elements of the matrix are 0 except for the main diagonal and the diagonal immediately above and below it. The computational cost of solving such a system scales with the number of equations (number of compartments in the model).

Closed loops, whether they result from peculiar cellular architectures or gap junctions, introduce off-diagonal nonzero terms that change the system matrix from tridiagonal to sparse. Sparse matrix solvers impose a computational burden that scales with the square of the number of compartments. A model with 100 compartments that involves gap junctions might take 100 times longer to simulate than a model with 100 compartments but no gap junctions.

### Re: Variable Steps and Integration methods

Posted: Wed Aug 05, 2009 10:45 pm
Well I suppose that makes sense (well has much as anything which contains the phrase "the system matrix is tridiagonal" can make sense to a humble pharmacologist). But It doesn't seem to make sense that variable timestep integrators should run SLOWER.

### Re: Variable Steps and Integration methods

Posted: Wed Aug 05, 2009 11:23 pm
local step method doesn't run at all
Local time step can only work in a network if communication between cells is by events. With local time step integration, each cell has its own time, which is identical across all compartments of that cell. The fact of current exchange between adjacent compartments requires the voltage in every compartment to be at exactly the same time as its neighbors--after all, the current through the axial resistances that separate adjacent compartments is governed by Ohm's law, and Ohm's law requires knowing the potentials at both ends of a resistor at the same time.

And that's why, if two cells are connected by a gap junction, then they are forced to march at the same pace. So in a network with cells connected by gap junctions, time must be the same across all cells, which means you can only use fixed dt or global variable dt.
It doesn't seem to make sense that variable timestep integrators should run SLOWER.
Adaptive integration is guaranteed to do only one thing: meet a local error criterion at each advance. A single advance with adaptive integration is about 3x more costly than a single advance with fixed dt. Total run time is shorter only if the integrator can take longer time steps without violating the error criterion--it has to take enough of these steps, and they have to be big enough, to make up for the cost of all steps over the entire simulation. So whether you get a net speedup or not remains an empirical question. In any particular case with which I am not already familiar, I would hesitate to bet my lunch money; it's probably safer to play the horses.