Description
Describe the bug 🐞
solve
fails with InitialFailure
because it treats my system as overdetermined. System is technically not overdetermined, it just has an state (jcn(t)
) that only appears in an algebraic equation and it is successfully substituted/eliminated during structural_simplify
.
Expected behavior
A clear and concise description of what you expected to happen.
Minimal Reproducible Example 👇
IIUC generate_initializesystem
treats the default value of jcn(t)=0
as one equation in the InitialSystem and its algebraic equation jcn ~ -hx
as a second equation, both involving a single state, thus overdetermined system? If I remove the default value of jcn(t)
it works fine.
Possibly related to #3033
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using OrdinaryDiffEq
@variables x(t)=1 jcn(t)=0 [input = true]
@parameters k=1 h=2
eqs = [
D(x) ~ -k*x + jcn,
jcn ~ -h*x
]
@named sys = System(eqs, t)
ss = structural_simplify(sys)
prob = ODEProblem(ss, [], (0, 10)) # errors with ;fully_determined=true
sol = solve(prob, Tsit5())
Error & Stacktrace
sol = solve(prob, Tsit5()) # retcode: InitialFailure
Environment (please complete the following information):
- Output of
using Pkg; Pkg.status()
[961ee093] ModelingToolkit v9.39.1
⌃ [1dea7af3] OrdinaryDiffEq v6.87.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: 20 × 13th Gen Intel(R) Core(TM) i5-13600KF
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 1 on 20 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =