-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Allow for using the initializeprob with OverrideInit #2151
Conversation
function _initialize_dae!(integrator, prob::ODEProblem, | ||
alg::DefaultInit, x::Val{true}) | ||
_initialize_dae!(integrator, prob, | ||
BrownFullBasicInit(integrator.opts.abstol), x) | ||
if SciMLBase.has_initializeprob(prob.f) | ||
_initialize_dae!(integrator, prob, | ||
OverrideInit(integrator.opts.abstol), x) | ||
else | ||
_initialize_dae!(integrator, prob, | ||
BrownFullBasicInit(integrator.opts.abstol), x) | ||
end | ||
end | ||
|
||
function _initialize_dae!(integrator, prob::ODEProblem, | ||
alg::DefaultInit, x::Val{false}) | ||
_initialize_dae!(integrator, prob, | ||
BrownFullBasicInit(integrator.opts.abstol), x) | ||
if SciMLBase.has_initializeprob(prob.f) | ||
_initialize_dae!(integrator, prob, | ||
OverrideInit(integrator.opts.abstol), x) | ||
else | ||
_initialize_dae!(integrator, prob, | ||
BrownFullBasicInit(integrator.opts.abstol), x) | ||
end |
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.
can't these be combined?
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.
maybe, since it wasn't already I assumed that it's potentially due to some ambiguity and with such a big change going on I don't want to touch that at the same time.
src/initialize_dae.jl
Outdated
if isinplace === Val{true}() | ||
integrator.u .= prob.f.initializeprobmap(sol.u) | ||
integrator.u .= nlsol[Main.ModelingToolkit.unknowns(prob.f.sys)] # prob.f.initializeprobmap(sol) |
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.
shouldn't this depend on SII rather than MTK directly?
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.
oh that shouldn't've made it in there, that was my testing and it should just use the getu
Uses the latest addition to SciMLBase so that if an ODEProblem or DAEProblem tags a nonlinear system for the initialization then it will use it.