On Jun 5, 2011, at 4:53 PM, Biswa Sengupta wrote:
> I debugged my code (attached) to realise that the solution in time is > invariant over dx - this just can't be true. I tried saving the fields and > plotting them after simulation to note that V,m,h and n do not change with > cable length (dx). Can this be due to the specific implementation of the > Neumann boundaries? I read in the FAQ section that fixed flux (Neumann) > boundaries sometimes do not function the way they generally should in FiPy? > Why is this the case? I don't believe that is true any longer, but regardless, as described in the FAQ, you can write your boundary condition as a source consisting of the divergence of the boundary flux and be sure that it will do the right thing. Looking at your code, and comparing the equations you provided in ttp://www.neuron.yale.edu/course/hhcable.html, I don't believe that you are using the ImplicitSourceTerm correctly. "Implicit" means that the term applies to the solution variable. In the case of the ImplicitSourceTerm, it means that the coefficient is multiplied by the solution variable, so ImplicitSourceTerm(coeff=normcurr) means V * normcurr but you have defined the components of normcurr to include (V-e_Na), etc. You need to factor out the terms proportional to V and declare them as an ImplicitSourceTerm with coefficient equal to the proportionality and then the remaining terms must be added as explicit sources. The same issue appears to be present in your ODEs.
