Thanks for posting your query--you discovered a bug that needed to be fixed. Changes in the model specification are supposed to be detected during initialization, and are supposed to produce corresponding changes in the Jacobian; this was not occurring for the part of the Jacobian that handles longitudinal diffusion, in response to changes in section geometry.
This bug has been fixed in the latest source code that is downloadable from the mercurial repository, and the fix will be included in future alpha and standard release installers. If you rely on one of the installers instead of compiling from source code, there is a workaround:
every time you change L (or section diameter), also do the following:
nseg*=3
nseg/=3
Then it will be safe to run a new simulation.
Explanation:
Tripling nseg forces the necessary change in the Jacobian, without affecting the locations of point processes.
Dividing nseg by 3 restores the spatial grid to its original resolution (and the Jacobian to its previous size), while preserving the changes that were required by the alteration of section geometry.
Alternatively, you might try
area(0.5)
which should also force a recalculation of the Jacobian's coefficients.
An additional comment: your mod file lacks an INITIAL block, is casual about units and does not properly take compartment size into consideration. It's a good idea to have an INITIAL block, not only for the sake of conceptual clarity, but also because it is best not to leave initialization to chance. Carelessness about units precludes the use of modlunit to detect syntax errors, and invites erroneous results caused by units inconsistencies. Compartment size is always important in accumulation mechanisms.
Here is a mod file that illustrates correct usage:
Code: Select all
NEURON {
SUFFIX diff
}
UNITS {
PI = (pi) (1)
(molar) = (1/liter)
(mM) = (millimolar)
(um) = (micron)
}
ASSIGNED {
diam (um)
}
PARAMETER {
: since z is a STATE, the name "Dz" is automatically created
: and means dz/dt
: therefore must use something else as the name of the diffusion constant
DZ = 1 (um2/ms)
}
BREAKPOINT {
SOLVE state METHOD sparse
}
STATE {
z (mM)
}
INITIAL {
z = 0
}
KINETIC state {
COMPARTMENT diam*diam*PI/4 {z}
LONGITUDINAL_DIFFUSION DZ*diam*diam*PI/4 {z}
~z << (0)
}