Skip to content
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

Merged
merged 13 commits into from Feb 26, 2024

Conversation

ChrisRackauckas
Copy link
Member

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.

Comment on lines 65 to +84
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
Copy link
Contributor

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?

Copy link
Member Author

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.

Project.toml Outdated Show resolved Hide resolved
if isinplace === Val{true}()
integrator.u .= prob.f.initializeprobmap(sol.u)
integrator.u .= nlsol[Main.ModelingToolkit.unknowns(prob.f.sys)] # prob.f.initializeprobmap(sol)
Copy link
Contributor

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?

Copy link
Member Author

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

@ChrisRackauckas ChrisRackauckas merged commit 090a087 into master Feb 26, 2024
28 of 31 checks passed
@ChrisRackauckas ChrisRackauckas deleted the overrideinit branch February 26, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants