-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
[WIP] feat: add hooks for OverrideInit
#517
base: master
Are you sure you want to change the base?
Conversation
kwargs... | ||
) | ||
return NonlinearSolveNoInitCache(prob, alg, args, kwargs) | ||
cache = NonlinearSolveNoInitCache( | ||
prob, alg, args, kwargs, initializealg, ReturnCode.Success) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prob, alg, args, kwargs, initializealg, ReturnCode.Success) | |
prob, alg, args, kwargs, initializealg, ReturnCode.Default) |
Probably should be this
) | ||
end | ||
|
||
NonlinearSolveBase.run_initialization!(cache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be inside the @static_timeit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
) | ||
end | ||
|
||
NonlinearSolveBase.run_initialization!(cache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again with the @static_timeit
) | ||
end | ||
|
||
NonlinearSolveBase.run_initialization!(cache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@static_timeit
Can you briefly mention the motivation behind this? I am not too familiar with the background (other PRs for DAEs and stuff) |
Sure. MTK currently generates initialization problems for ODEs. SciML/ModelingToolkit.jl#3253 aims to expand this to all such problems. The basic use case is that users can specify initial conditions for variables that MTK eliminates from the system, and the initialization process solves for the states of the system. As a contrived example, consider: y ~ x^3
x^2 + y^2 ~ 2 MTK will reduce this to a system with a single unknown y ~ 3
y ~ x^3 and solve for x ~ 3
y ~ 3
y ~ x^3 This fails the nonlinear solve with MTK can also potentially solve for parameters, such as if The core infrastructure is in SciMLBase, but all solver libraries need to hook into it. In most cases, this is a trivial change: https://github.com/SciML/StochasticDelayDiffEq.jl/pull/84/files. NonlinearSolve has a billion entry points, multiple different "integrators" (caches) and a whole host of other intricacies which make this PR more complicated. |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.