Skip to content

Cannot simulate a certain ODESystem (probably one where everything gets simplified away) #3467

@TorkelE

Description

@TorkelE

This was working on the Catalyst tests up until the v9.66 release, so probably related.

Simple system, just consisting of a simple algebraic equation. Probably related to why we have an error.

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using OrdinaryDiffEqDefault
@variables X(t)
eqs = [2X ~ 6.0 - X]
@mtkbuild osys = ODESystem(eqs, t)
u0 = [X => 1.0]
oprob = ODEProblem(osys, u0, 1.0)
sol = solve(oprob)
ERROR: MethodError: no method matching build_solution(::ODEProblem{…}, ::Nothing, ::Vector{…}, ::Vector{…}, ::SciMLBase.ReturnCode.T)
The function `build_solution` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  build_solution(::SciMLBase.AbstractDAEProblem, ::Any, ::Any, ::Any, ::Any; timeseries_errors, dense, dense_errors, calculate_error, k, interp, retcode, destats, stats, saved_subsystem, kwargs...)
   @ SciMLBase ~/.julia/packages/SciMLBase/Ub9ub/src/solutions/dae_solutions.jl:82
  build_solution(::Union{SciMLBase.AbstractDDEProblem, SciMLBase.AbstractODEProblem}, ::Any, ::Any, ::Any; timeseries_errors, dense, dense_errors, calculate_error, k, alg_choice, interp, retcode, destats, stats, resid, original, saved_subsystem, kwargs...)
   @ SciMLBase ~/.julia/packages/SciMLBase/Ub9ub/src/solutions/ode_solutions.jl:454
  build_solution(::SciMLBase.AbstractOptimizationCache, ::Any, ::Any, ::Any; retcode, original, stats, kwargs...)
   @ SciMLBase ~/.julia/packages/SciMLBase/Ub9ub/src/solutions/optimization_solutions.jl:74
  ...

Stacktrace:
 [1] build_null_solution(::ODEProblem{…}; saveat::Tuple{}, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Bool, kwargs::@Kwargs{})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:719
 [2] build_null_solution(::ODEProblem{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:691
 [3] solve_call(::ODEProblem{…}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:627
 [4] solve_call(::ODEProblem{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:592
 [5] solve_up(::ODEProblem{…}, ::Nothing, ::Nothing, ::MTKParameters{…}; kwargs::@Kwargs{})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:1128
 [6] solve_up
   @ ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:1122 [inlined]
 [7] solve(::ODEProblem{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:1059
 [8] solve(::ODEProblem{Nothing, Tuple{…}, true, MTKParameters{…}, ODEFunction{…}, @Kwargs{}, SciMLBase.StandardODEProblem})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/gGshU/src/solve.jl:1049

If things like this shouldn't be simualteable in the first way, there should probably be an error when one tries to create an ODESystem that cannot be simualted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions