-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Indexing and iterating in ODEProblem and modelingtoolkitize / error messages #1678
Comments
This is at least an intermediate solution to help give more interpretable error messages for #1678 . It's not a full solution since the real problem there is that while tuples are supported, it assumes `::NTuple{<:Number}` The "real" answer of course is to make this handling recursive, but I'll leave that as a separate PR.
#1682 at least improves the error message. |
Yeah. So is it just not expected for MTK to work with these kinds of variables, then? i.e. with a If there are some ways to work around these errors that you know of, maybe that's also useful to add/link to in the new error message. |
SciML/DifferentialEquations.jl#881 is turning to a more general solution. |
Should this be closed now that https://github.com/SciML/SciMLStructures.jl exists? I imagine this would be a similar use-case for this issue anyway judging by SciML/DifferentialEquations.jl#881 (haven't yet tried it though) |
Yes |
I am working on some complicated 2D finite volume code and am trying to refactor it to allow for
modelingtoolkitize
. In doing so I am having some difficulties dealing with iteration and indexing, and the error messages don't really seem so clear to me in how I can fix it.The following code covers the type of iteration I am dealing with:
I define additional functions for
getindex
andsetindex!
so that they are not traced (as someone helped me with here https://discourse.julialang.org/t/modelingtoolkit-indexing-a-parameter-by-another-parameter-in-an-odeproblem/83569/2?u=legola18), along with some additionaldo_something
function. When I runmodelingtoolkitize
as shown, I get:How can I change the code further to allow for this type of work? It would be nice if there were e.g. a suggestion in this error message for what could be done for this type of loop, too - I know improving these error messages is a current work in progress.
Just for reference, this is what the code above looks like with hard-coded numbers (to make it easier to compare to for what 'works') and the Jacobian that I actually want to compute:
The text was updated successfully, but these errors were encountered: