Page 1 of 1

Use of crank.c file

Posted: Fri Apr 27, 2012 4:28 am
by jackfolla
Dear all,
I would like to know the size of the tridiagonal matrix and other information from Crank-Nicolson solver (file crank.c in "src/scopmath").

I know that in general it is possible to specify in a mod file the method to use in order to solve a system of equations:

i.e. for using euler method, it is possible specify in a mod file:

BREAKPOINT {
SOLVE state METHOD euler
}

I tried to use cnexp, thinking that CNexp stands for Crank-Nicolson Exponential method, but in this way the crank.c file it is not used.
I know that it is need to set the variable "secondorder" =2, but also setting this value, the method it is not invoked.

Can anyone give me information about it?
If it is possible to post a practical example in a .hoc file that uses the Crank-Nicolson solver?

Re: Use of crank.c file

Posted: Fri Apr 27, 2012 11:51 am
by ted
If you want to learn about using NMODL to add new features to NEURON, read either chaper 9 of The NEURON Book or this article:
Hines, M.L. and Carnevale, N.T.
Expanding NEURON's repertoire of mechanisms with NMODL.
Neural Computation 12:995-1007, 2000
which is available from a link at http://www.neuron.yale.edu/neuron/nrnpubs
jackfolla wrote:I would like to know the size of the tridiagonal matrix
Depends on the particular model that one has set up with hoc and/or Python statements. You don't need this information in order to build or use models, or to add new mechanisms with NMODL.
I know that in general it is possible to specify in a mod file the method to use
Discussed in this post
Integration methods for SOLVE statements
http://www.neuron.yale.edu/phpBB/viewto ... f=28&t=592
in the Hot tips area
http://www.neuron.yale.edu/phpBB/viewforum.php?f=28
of the NEURON Forum
for using euler method
Never use euler. Never.
I tried to use cnexp, thinking that CNexp stands for Crank-Nicolson Exponential method, but in this way the crank.c file it is not used.
I know that it is need to set the variable "secondorder" =2, but also setting this value, the method it is not invoked.
The METHOD specification in any NMODL file pertains only to the state variables in the equations that are generated from the statements in that NMODL file. secondorder and the CVode class are used to control how all other states are integrated.

Re: Use of crank.c file

Posted: Thu May 03, 2012 9:21 am
by jackfolla
Dear Ted,
thanks for your reply.

I'm interested to know how the Crank-Nicolson method (implemented in src/scopmath/crank.c) works in a NEURON model.

Can someone post me a model that certainly uses crank-nicolson (crank.c)?

Thanks.

Re: Use of crank.c file

Posted: Thu May 03, 2012 12:25 pm
by ted
Suggest you search ModelDB for instances of "secondorder"