-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Example from https://docs.sciml.ai/ModelingToolkit/stable/tutorials/callable_params/, but with remake
added:
using ModelingToolkit
using OrdinaryDiffEq
using DataInterpolations
using ModelingToolkit: t_nounits as t, D_nounits as D
ts = collect(0.0:0.1:10.0)
spline = LinearInterpolation(ts .^ 2, ts)
Tspline = typeof(spline)
@variables x(t)
@parameters (interp::Tspline)(..)
@mtkbuild sys = ODESystem(D(x) ~ interp(t), t)
prob = ODEProblem(sys, [x => 0.0], (0.0, 1.0), [interp => spline])
p_new = [interp => spline]
remake(prob; p = p_new)
gives
ERROR: TypeError: in validate_parameter_type, in Parameter interp⋆, expected SymbolicUtils.FnType{Tuple, Real, LinearInterpolation{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}}, got a value of type LinearInterpolation{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}
Stacktrace:
[1] validate_parameter_type(ic::ModelingToolkit.IndexCache, stype::Type, sz::Symbolics.Unknown, sym::Symbolics.CallWithMetadata{…}, index::ModelingToolkit.ParameterIndex{…}, val::LinearInterpolation{…})
@ ModelingToolkit C:\Users\Torkel\.julia\packages\ModelingToolkit\ZOG3I\src\systems\parameter_buffer.jl:450
[2] validate_parameter_type(ic::ModelingToolkit.IndexCache, p::Symbolics.CallWithMetadata{…}, idx::ModelingToolkit.ParameterIndex{…}, val::LinearInterpolation{…})
@ ModelingToolkit C:\Users\Torkel\.julia\packages\ModelingToolkit\ZOG3I\src\systems\parameter_buffer.jl:432
[3] (::ModelingToolkit.var"#handle_parameter#205"{…})(ic::ModelingToolkit.IndexCache, sym::Symbolics.CallWithMetadata{…}, idx::ModelingToolkit.ParameterIndex{…}, val::LinearInterpolation{…})
@ ModelingToolkit C:\Users\Torkel\.julia\packages\ModelingToolkit\ZOG3I\src\systems\parameter_buffer.jl:508
[4] _remake_buffer(indp::ODEProblem{…}, oldbuf::MTKParameters{…}, idxs::Base.KeySet{…}, vals::Base.ValueIterator{…}; validate::Bool)
@ ModelingToolkit C:\Users\Torkel\.julia\packages\ModelingToolkit\ZOG3I\src\systems\parameter_buffer.jl:534
[5] _remake_buffer
@ C:\Users\Torkel\.julia\packages\ModelingToolkit\ZOG3I\src\systems\parameter_buffer.jl:496 [inlined]
[6] remake_buffer
@ C:\Users\Torkel\.julia\packages\ModelingToolkit\ZOG3I\src\systems\parameter_buffer.jl:494 [inlined]
[7] _updated_u0_p_symmap(prob::ODEProblem{…}, u0::Vector{…}, ::Val{…}, p::Dict{…}, ::Val{…}, t0::Float64)
@ SciMLBase C:\Users\Torkel\.julia\packages\SciMLBase\VIERM\src\remake.jl:1042
[8] _updated_u0_p_internal(prob::ODEProblem{…}, ::Missing, p::Vector{…}, t0::Float64; interpret_symbolicmap::Bool, use_defaults::Bool)
@ SciMLBase C:\Users\Torkel\.julia\packages\SciMLBase\VIERM\src\remake.jl:909
[9] _updated_u0_p_internal
@ C:\Users\Torkel\.julia\packages\SciMLBase\VIERM\src\remake.jl:898 [inlined]
[10] #updated_u0_p#768
@ C:\Users\Torkel\.julia\packages\SciMLBase\VIERM\src\remake.jl:1123 [inlined]
[11] updated_u0_p
@ C:\Users\Torkel\.julia\packages\SciMLBase\VIERM\src\remake.jl:1102 [inlined]
[12] remake(prob::ODEProblem{…}; f::Missing, u0::Missing, tspan::Missing, p::Vector{…}, kwargs::Missing, interpret_symbolicmap::Bool, build_initializeprob::Bool, use_defaults::Bool, lazy_initialization::Nothing, _kwargs::@Kwargs{})
@ SciMLBase C:\Users\Torkel\.julia\packages\SciMLBase\VIERM\src\remake.jl:228
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working