You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug 🐞
When running a differential equation system using ModelingToolkit, an internal error occurs where variables (N(t))[1] and (N(t))[2] are unexpectedly marked as zero in the equation 0 ~ -H(t) + myfun(T(t), N(t)). This issue arises during the structural transformation call.
Expected behavior
The system should solve the ODE without internal errors, accurately computing the values of the variables (N(t))[1] and (N(t))[2] without them being incorrectly marked as zero.
Minimal Reproducible Example 👇
using ModelingToolkit
using Symbolics
using ModelingToolkit: t_nounits as t, D_nounits as D, scalarize
using OrdinaryDiffEq
myfun(T, x::Vector) =100.0*T*x[1] +50.0*T*x[2]
@register_symbolicmyfun(T, x::Vector)
functionmyc(; name)
vars =@variablesbegin
(N(t))[1:2]
H(t)
T(t)
end
eqs = [scalarize(D(N) .~-N), D(H) ~ H/sum(scalarize(N)),
H -myfun(T, N) ~0.0]
ODESystem([eqs...;], t, collect(Iterators.flatten(vars)), []; name)
end
component =myc(; name =:myc)
simple_prob =structural_simplify(component; check_consistency =true)
Error & Stacktrace ⚠️
It is a warning
┌ Warning: Internal error: Variable (N(t))[1] was marked as being in0~-H(t) +myfun(T(t), N(t)), but was actually zero
└ @ ModelingToolkit.StructuralTransformations C:\Users\vinicius\.julia\packages\ModelingToolkit\Jc09X\src\structural_transformation\utils.jl:233
┌ Warning: Internal error: Variable (N(t))[2] was marked as being in0~-H(t) +myfun(T(t), N(t)), but was actually zero
└ @ ModelingToolkit.StructuralTransformations C:\Users\vinicius\.julia\packages\ModelingToolkit\Jc09X\src\structural_transformation\utils.jl:233
Environment (please complete the following information):
seeing this as well. the equations it warns against include a registered array function which generates a ton of screen output, which shows up during testing.
I have also noticed huge structural_simplify performance hits with this warning. I don't know if it's just due to the potentially large amount of printing to STERROR it does but simplifications can take seconds then I invoke this error and its close to an hour or sometimes longer. I have tested it where I change my vectors from length 5 to length 500 and it changes the simplify time from half a second to 90 mins. Is there a temporary way to disable the warning to fix performance
Describe the bug 🐞
When running a differential equation system using ModelingToolkit, an internal error occurs where variables (N(t))[1] and (N(t))[2] are unexpectedly marked as zero in the equation 0 ~ -H(t) + myfun(T(t), N(t)). This issue arises during the structural transformation call.
Expected behavior
The system should solve the ODE without internal errors, accurately computing the values of the variables (N(t))[1] and (N(t))[2] without them being incorrectly marked as zero.
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
It is a warning
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
The text was updated successfully, but these errors were encountered: