-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"SOLVE kinetic STEADYSTATE sparse" is not solving for steady state. #1394
Comments
Thank you, I can reproduce the issue and I'll debugging now. STEADY_STATE is a very good next keyword to work on. |
I'm using the following simplified MOD file:
The equation for
In NMODL we divide the above by I'll create a PR that adopts the battle-tested scaling factors used in NOCMODL. |
However, it's not enough to make |
I think it comes down to these three things:
Scaling ODE terms:
Scaling CONSERVE terms:
The tolerances involved are Finally, there's the issue that the CONSERVE term has very favourable cancellation properties in NOCMODL:
assume
Hence,
then depending on the size of |
Not familiar with the l1 and l2 error terminology. What do those mean? |
Using numpy notation:
(it's unlikely a really important part of the discussion.) Might as well make it a complete answer: Mathematicians like to unify, here it's the exponent one can replace with a symbol
With a little abuse of notation one can allow
|
Since we anyway have access to the Jacobian, we can (somewhat) inexpensively do Newton error propagation: The idea is that it should give us an estimate of how big we'd expect round-off errors to be. Once we know that we can pick a tolerance, e.g. |
Looks good. (I wonder where my above |
I don't see a segfault, only a very long error message leading to an assert followed by a core dump:
I'm happy to follow up on the SEGFAULT, if it doesn't go away after this has been made clean and merged. |
Sorry. Changed the comment. There was no segfault. |
That's plausibly explained by something I didn't mention in the summary. One more difference is how
meaning the residual would grow linearly with |
The changes have been implemented here: #1403. |
It appears that the implementation contains terms involving
nt->dt
nocmodl makes use of _ss_sparse_thread which iterative solves a nonlinear system using
auto const ss_dt = 1e9;
(ideally the solution should use the conservation constraints in place of an equal number of ODE to avoid trying to solve a singular matrix, but that is not directly relevant to this issue). This issue was observed when comparing NMODL and nocmodl results for nrn/share/examples/nrniv/nmodl/capmp.mod when launching
nrngui capmp.hoc
.The left column is for NMODL, the right is for nocmodl. (note: I'm using NMODL branch 1uc/fix-cadifpmp-shift).
The top row shows calcium concentration as a function of time for three cell diameters. In every case the intention was to initialize the concentration to 0.01 mM (single compartment) The NMODL 100diam (black line) case calculated an initial steady state of approximately 0.0076 instead of the correct 0.01.
Ignore the bottom row. I'm showing it because the missing beginning and ending of the steady state calcium current vs constant calcium concentration for the NMODL simulation is a puzzle (but likely not relevant to the initialization issue for the large diameter case.)
I believe the steady state initialization issue is due to using the value of nt->dt in the steady state equations of the NMODL generated capmp.cpp file. Evidence for this is
but my naive expectations are dashed with
The text was updated successfully, but these errors were encountered: