Closed gdudziuk closed 4 years ago
Hi Grzegorz,
some of your parameters (k1
, l1
, k2
, k5
, k6
, k8
and k10
) in Setup_A
are defined in log10 space which is indicated by the fourth function parameter. For these parameters, you also have to define the value of the parameter in log10 space, e.g. change arSetPars('k8', 9.60678189e+01, 1, 1, 0.0, 1.0e+100)
to arSetPars('k8', log10(9.60678189e+01), 1, 1, 0.0, 1.0e+100)
in order to correctly assign the value of k8
. In your current implementation the value of k8 would be 10^(9.60678189e+01) which is very high and typically leads to problems in the ODE integration, since the ODE system becomes too stiff.
Additionally you should also define the upper and lower bounds in log10 space for these values. I also recommend to use lower values for the upper bound, since during fitting it can happen that the upper bound (in your case 1e+100) is reached, leading again to problems with the integration of the ODE.
some of your parameters (
k1
,l1
,k2
,k5
,k6
,k8
andk10
) inSetup_A
are defined in log10 space which is indicated by the fourth function parameter. For these parameters, you also have to define the value of the parameter in log10 space
Ah, that's it. So—contrary to what I have said—the attached models does not have the same parameters, and consequently the resulting ODE systems are different. Thanks for your help in identifying this. After setting the scale for all parameters to normal, Setup_A
produces plots as Setup_B
, i.e. everything works as expected.
By the way, except the GitHub issues, is there any place to ask questions concerning d2d? The README of the project states that
for support issues, please use the issues and forum
but I can't find the forum anywhere.
System information
Issue description
I attach code which compare two different ways of setting up the same model with the same known parameters:
arSetPars
in the setup script (cf.Setup_A.m
andModels/hsr_A.def
in the attached files).CONDITIONS
section of the model definition file (cf.Setup_B.m
andModels/hsr_B.def
in the attached files).The attached scripts set up the model, compile it and try to plot its solutions by a call to
arPlot
.With the method 1. (call
Setup_A
to reproduce),arPlot
experiences problems with the convergence of the ODE solver and returns the following error:Possibly, the solver tolerances require some tweaking but I have not managed to get things work.
With the method 2. (call
Setup_B
to reproduce) there are no problems with runningarPlot
and the default tolerances were just fine. I other words, things work "out of the box".To my understanding, both methods of implementing a model with known parameters should result in the same ODE system, so the ODE solver should be able to deal with it for both methods (or for neither of them). This is not the case, which suggests that there may exist some essential differences in the compiled mex files which impact the performance of the ODE solver. It may be a bug, so hereby I report.
Attachment code.zip