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

Smith et al 2004 model not readable #89

Open
H-Sax opened this issue May 12, 2022 · 6 comments
Open

Smith et al 2004 model not readable #89

H-Sax opened this issue May 12, 2022 · 6 comments

Comments

@H-Sax
Copy link

H-Sax commented May 12, 2022

Hi,

Trying to read in the Smith et al 2004 model Minimal haemodynamic system model including ventricular interaction and valve dynamics. — Physiome Model Repository 1

using the code

ml = CellModel("/home/harry/Desktop/PhD/Year 1/Sem 2/CellML project/smith_chase_nokes_shaw_wake_2004/smith_chase_nokes_shaw_wake_2004-f7b732c9707a/smith_chase_nokes_shaw_wake_2004.cellml")

prob = ODEProblem(ml, (0.0,5000.0))

sol = solve(prob, CVODE_BDF(), dtmax = 0.5)

Returns the following error

ERROR: MethodError: no method matching operation(::Float64)
Closest candidates are:
  operation(::SymbolicUtils.Code.MakeSparseArray) at ~/.julia/packages/Metatheory/XcKKW/src/utils.jl:154
  operation(::Symbolics.CallWithMetadata) at ~/.julia/packages/Symbolics/hgePJ/src/variable.jl:202
  operation(::Symbolics.ComplexTerm{T}) where T at ~/.julia/packages/Symbolics/hgePJ/src/complex.jl:22
Stacktrace:
  [1] (::CellMLToolkit.var"#24#26")(eq::Equation)
    @ CellMLToolkit ./none:0
  [2] iterate
    @ ./iterators.jl:447 [inlined]
  [3] iterate
    @ ./generator.jl:44 [inlined]
  [4] grow_to!(dest::Vector{Any}, itr::Base.Generator{Base.Iterators.Filter{CellMLToolkit.var"#24#26", Vector{Equation}}, CellMLToolkit.var"#23#25"})
    @ Base ./array.jl:797
  [5] collect
    @ ./array.jl:721 [inlined]
  [6] remove_rhs_diff(eqs::Vector{Equation})
    @ CellMLToolkit ~/.julia/packages/CellMLToolkit/Pnsff/src/components.jl:191
  [7] process_component(doc::CellMLToolkit.Document, comp::CellMLToolkit.Component, class::Dict{CellMLToolkit.Var, Bool})
    @ CellMLToolkit ~/.julia/packages/CellMLToolkit/Pnsff/src/components.jl:269
  [8] #32
    @ ./none:0 [inlined]
  [9] iterate
    @ ./generator.jl:47 [inlined]
 [10] Dict{Symbol, ODESystem}(kv::Base.Generator{Vector{CellMLToolkit.Component}, CellMLToolkit.var"#32#33"{CellMLToolkit.Document, Dict{CellMLToolkit.Var, Bool}}})
    @ Base ./dict.jl:104
 [11] subsystems(doc::CellMLToolkit.Document, class::Dict{CellMLToolkit.Var, Bool})
    @ CellMLToolkit ~/.julia/packages/CellMLToolkit/Pnsff/src/components.jl:248
 [12] process_components(doc::CellMLToolkit.Document; simplify::Bool)
    @ CellMLToolkit ~/.julia/packages/CellMLToolkit/Pnsff/src/components.jl:224
 [13] process_components
    @ ~/.julia/packages/CellMLToolkit/Pnsff/src/components.jl:220 [inlined]
 [14] CellModel(path::String)
    @ CellMLToolkit ~/.julia/packages/CellMLToolkit/Pnsff/src/CellMLToolkit.jl:36
 [15] top-level scope
    @ ~/Desktop/PhD/Year 1/Sem 2/CellML project/Cell_ML.jl:77

I had asked the question on the discourse to which a conjectured answer has been given
https://discourse.julialang.org/t/cellmltoolkit-jl-a-model-not-readable/80918

Not sure how I would go about trying to fix this issue or if anyone could help this would be appreciated :)

@H-Sax
Copy link
Author

H-Sax commented May 25, 2022

Following from a discussion on slack the issue appears to be that the above model requires a Differential-Algebraic Equation (DAE) solver and cannot be converted to a set of ODEs.

@ChrisRackauckas
Copy link
Member

I see, so it needs just parse into an ODESystem and let the user then choose DAEProblem on it.

@anandijain
Copy link
Contributor

Which program were you able to simulate this with? Was it OpenCor?

@H-Sax
Copy link
Author

H-Sax commented May 25, 2022

Yes using OpenCor, the problem did appear quite stiff though so I had to lower the tolerances increase the amount of steps etc.

image

The simulations do appear in line with the papers results at least.

@anandijain
Copy link
Contributor

What settings did you use? I'm getting an error with mxsteps (I just downloaded the latest stable opencor 0.6)
image

I ask all this just so that if I get the julia simulation working, I want to make sure I am comparing the results correctly

@H-Sax
Copy link
Author

H-Sax commented May 25, 2022

image

As you can see my previous celebrations may have been immature I was just glad to see it simulate I ignored the error message sorry!

Not entirely sure what this means for the model, maybe Julias DAE solvers may cope with the model better?

hope this helps :)

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

3 participants