Skip to content
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

Instability when claculating local sensitivites #90

Open
H-Sax opened this issue May 23, 2022 · 2 comments
Open

Instability when claculating local sensitivites #90

H-Sax opened this issue May 23, 2022 · 2 comments

Comments

@H-Sax
Copy link

H-Sax commented May 23, 2022

Hi,

I am trying to calculate the local sensitivities for a large circulation model [(Shi 2006)]

I am Importing the model using CellML.jl when I define an ODEproblem and simulate the solution appears fine and also when performing GSA the results are also sound.

Using the code

using ForwardDiff

savetime = LinRange(18, 19, 100)

p = prob.p 

function circ_local(x)
    newprob = remake(prob; p=x[1:end])
    sol = solve(newprob, Tsit5(); reltol=1e-6, abstol=1e-12,saveat = savetime)
    [mean(sol[@nonamespace sys.LV₊V]), mean(sol[@nonamespace sys.Pat₊Pi])]
end
S = ForwardDiff.jacobian(circ_local,p)

Note: all the solver opts I use are the same for both simulation and performing GSA.

The above returns the following warnings with the NAN’s

Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZBye7/src/initdt.jl:121
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase ~/.julia/packages/SciMLBase/Vg9hW/src/integrator_interface.jl:345
2×154 Matrix{Float64}:
 NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  …  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN
 NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN     NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN

I have tried with a range of stiff solvers and low tolerance however nothing is working. I am cautious to claim model error due to the GSA and simulation running fine. This issue is also present in models Heldt 2002 and the Systemic loop as checked by me. I guess this would also be the same for the model I opened an issue about recently Smith 2004.

This issue has been opened as a result of discussion on the discourse please see here

Cheers

@anandijain
Copy link
Contributor

Hey Harry, thanks for these issues. The first link doesn't seem to resolve (Shi 2006)

@H-Sax
Copy link
Author

H-Sax commented May 25, 2022

Hey Harry, thanks for these issues. The first link doesn't seem to resolve (Shi 2006)

Sorry about this I must have copied a dodgy link

https://models.cellml.org/exposure/c49d416ae3a5132882e6ea7479ba50f5/ModelMain.cellml/view

The above should now take you to the Shi 2006 model quoted in my initial issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants