-
-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
SciML/SymbolicIndexingInterface.jl
#79Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug 🐞
I used modelingtoolkit.jl to build an ODE problem, with variables including x (typeof(x) is vector) and z. When I directly construct and solve the problem, there are no errors. However, when I use remake to reconstruct the problem, the following error occurs.
Minimal Reproducible Example 👇
using ModelingToolkit
using OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
@parameters σ ρ β
@variables (x(t))[1:2] z(t)
eqs = [D(x[1]) ~ σ * (x[2] - x[1]),
D(x[2]) ~ x[1] * (ρ - z) - x[2],
D(z) ~ x[1] * x[2] - β * z]
@mtkbuild sys = ODESystem(eqs, t)
u0 = [x => [1.0, 0.0],
z => 0.0]
p = [σ => 28.0,
ρ => 10.0,
β => 8 / 3]
tspan = (0.0, 100.0)
prob = ODEProblem(sys, u0, tspan, p, jac=true)
sol = solve(prob, Tsit5())
new_prob = remake(prob, p=p, u0=u0)
Error & Stacktrace
ERROR: MethodError: no constructors have been defined for Any
Stacktrace:
[1] _broadcast_getindex_evalf
@ Base.Broadcast .\broadcast.jl:709 [inlined]
[2] _broadcast_getindex
@ Base.Broadcast .\broadcast.jl:682 [inlined]
[3] getindex
@ Base.Broadcast .\broadcast.jl:636 [inlined]
[4] copy
@ Base.Broadcast .\broadcast.jl:942 [inlined]
[5] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Type{Any}, Tuple{Vector{Any}}})
@ Base.Broadcast .\broadcast.jl:903
[6] remake_buffer(sys::ODEProblem{…}, oldbuffer::Vector{…}, vals::Dict{…})
@ SymbolicIndexingInterface D:\Julia\Julia-1.10.0\packages\packages\SymbolicIndexingInterface\hDTd3\src\remake.jl:27
[7] _updated_u0_p_symmap(prob::ODEProblem{…}, u0::Dict{…}, ::Val{…}, p::Dict{…}, ::Val{…})
@ SciMLBase D:\Julia\Julia-1.10.0\packages\packages\SciMLBase\QEvkv\src\remake.jl:508
[8] _updated_u0_p_internal(prob::ODEProblem{…}, u0::Vector{…}, p::Vector{…}; interpret_symbolicmap::Bool, use_defaults::Bool)
@ SciMLBase D:\Julia\Julia-1.10.0\packages\packages\SciMLBase\QEvkv\src\remake.jl:427
[9] _updated_u0_p_internal
@ D:\Julia\Julia-1.10.0\packages\packages\SciMLBase\QEvkv\src\remake.jl:412 [inlined]
[10] #updated_u0_p#690
@ D:\Julia\Julia-1.10.0\packages\packages\SciMLBase\QEvkv\src\remake.jl:548 [inlined]
[11] updated_u0_p
@ D:\Julia\Julia-1.10.0\packages\packages\SciMLBase\QEvkv\src\remake.jl:529 [inlined]
[12] remake(prob::ODEProblem{…}; f::Missing, u0::Vector{…}, tspan::Missing, p::Vector{…}, kwargs::Missing, interpret_symbolicmap::Bool, use_defaults::Bool, _kwargs::@Kwargs{})
@ SciMLBase D:\Julia\Julia-1.10.0\packages\packages\SciMLBase\QEvkv\src\remake.jl:95
[13] top-level scope
@ e:\JlCode\LumpedHydro.jl\test\pkgs\test_mtk_ode.jl:25
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
st ModelingToolkit
[961ee093] ModelingToolkit v9.13.0
- Output of
versioninfo()
Julia Version 1.10.0
Commit 3120989f39 (2023-12-25 18:01 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 24 × 12th Gen Intel(R) Core(TM) i9-12900HX
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, alderlake)
Threads: 1 on 24 virtual cores
Environment:
JULIA_DEPOT_PATH = D:\Julia\Julia-1.10.0\packages
JULIA_PKG_SERVER = https://mirrors.pku.edu.cn/julia/
JULIA_EDITOR = code
JULIA_NUM_THREADS = 0
Additional context
I think the data format of u0 will be automatically converted to Any when processing multiple data types, which leads to this error.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working