-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no method matching hasmetadata
in tearing
#3370
Comments
The problem here seems to be that the initialization system thinks |
Okay, so the problem is that dummy derivatives tries to differentiate the last equation (the one involving |
This can be solved by providing symbolic derivatives for the registered function as in this section of Symbolics docs. We should surface this in MTK somewhere. julia> df1(c, T) = -6c
julia> @register_symbolic df1(c, T)
julia> Symbolics.derivative(::typeof(f), args::NTuple{2, Any}, ::Val{1}) = df1(args...)
julia> Symbolics.derivative(::typeof(f), args::NTuple{2, Any}, ::Val{2}) = 0.0
julia> @mtkbuild tank = Tank();
julia> prob = ODEProblem(tank, u0, (0, 10.0), [],
guesses=[tank.M1 => 5,
tank.M2 => 5, tank.c => 1.0, tank.b => 1.0])
julia> solve(prob, Rodas5P())
retcode: Success
# ... |
Yeah... that needs a better error message 😅 . All it needs is to basically say that a derivative isn't defined and I think that's a solid solution. |
Describe the bug 🐞
I get an obscure error from a seemingly well-constructed system. Perhaps it's just that I would need to specify the derivative of
f
?Expected behavior
Better error message?
Minimal Reproducible Example 👇
This is heavily reduced of course.
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
Julia 1.10.5
MTK v9.62.0
The text was updated successfully, but these errors were encountered: