Closed
Description
Describe the bug 🐞
Hello the question was first posted here
I have repeated it below.
ODE solver does not consider the parameter to be dynamic. Instead fixes the value to be at t=0
Expected behavior
The chosen parameter should change over t
and should affect the solution to the ODE.
Minimal Reproducible Example 👇
using ModelingToolkit, DifferentialEquations
using ModelingToolkit: t_nounits as t, D_nounits as D
function test(;name)
vars = @variables begin
x(t)
end
para = @parameters begin
α(t)
end
eqs = [
D(x) ~ α
]
ODESystem(eqs,t,vars,para,name=name)
end
@named model = test()
sys = structural_simplify(model)
para = [sys.α => cos(t)]
u0 = [sys.x => 1]
tspan = (0,2π)
prob = ODEProblem(sys,u0,tspan,para)
sol = solve(prob)
Error & Stacktrace
No error
Environment (please complete the following information):
- Output of
using Pkg; Pkg.status()
[961ee093] ModelingToolkit v9.62.0
[0c46a032] DifferentialEquations v7.15.0
- Output of
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
- Output of
versioninfo()
Julia Version 1.11.3
Commit d63adeda50 (2025-01-21 19:42 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 20 × 12th Gen Intel(R) Core(TM) i7-12800H
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 20 virtual cores)
Additional context