nmodl icon indicating copy to clipboard operation
nmodl copied to clipboard

CVODE codgen for NEURON

Open JCGoran opened this issue 1 year ago • 7 comments

The implementation works as follows:

  • find any DERIVATIVE blocks, and copy them into DERIVATIVE_ORIGINAL_FUNCTION and DERIVATIVE_ORIGINAL_JACOBIAN. This is done since the cnexp (and some other visitors) solve the ODEs in-place, so the information about f(x) (and consequently its Jacobian) is lost. Why two new constructs instead of one? Because NMODL cannot insert two identical blocks (it doesn't matter if they have a different name) in the symbol table
  • DERIVATIVE_ORIGINAL_FUNCTION basically replaces x' = f(x) with Dx = f(x), while DERIVATIVE_ORIGINAL_JACOBIAN replaces x' = f(x) with Dx = Dx / (1 - dt * J(f)), where J is the Jacobian of the transformation (computed analytically using SymPy)

TODO:

  • [ ] add tests for KINETIC
  • [ ] fix issue with CONSERVE statement

JCGoran avatar Aug 13 '24 16:08 JCGoran

Codecov Report

Attention: Patch coverage is 13.58025% with 70 lines in your changes missing coverage. Please review.

Project coverage is 86.22%. Comparing base (9ee3226) to head (9d09481).

Files Patch % Lines
src/codegen/codegen_neuron_cpp_visitor.cpp 13.58% 70 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1399      +/-   ##
==========================================
- Coverage   86.65%   86.22%   -0.44%     
==========================================
  Files         182      182              
  Lines       13626    13704      +78     
==========================================
+ Hits        11808    11816       +8     
- Misses       1818     1888      +70     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 13 '24 16:08 codecov[bot]

Closing in favor of #1493

JCGoran avatar Oct 28 '24 11:10 JCGoran