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

fix: create and solve initialization system in linearization_function #2676

Merged

Conversation

AayushSabharwal
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

Comment on lines 104 to 109
function generate_algebraic_initializesystem(sys::ODESystem;
u0map = Dict(),
name = nameof(sys),
guesses = Dict(), check_defguess = false,
default_dd_value = 0.0,
kwargs...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this is a lot of a copy, maybe we can do this instead with some undocumented kwargs in the other?

@AayushSabharwal
Copy link
Member Author

end
end

pars = [parameters(sys); get_iv(sys)]
nleqs = [eqs_ics; get_initialization_eqs(sys); observed(sys)]
nleqs = if algebraic_only
eqs_ics
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you always need the observed equations?

@AayushSabharwal AayushSabharwal force-pushed the as/linearization-initialization branch 2 times, most recently from 7e6688e to c2a7118 Compare May 6, 2024 08:39
src/systems/abstractsystem.jl Show resolved Hide resolved
test/downstream/linearize.jl Outdated Show resolved Hide resolved
@AayushSabharwal AayushSabharwal force-pushed the as/linearization-initialization branch from 042abb3 to cc31bf3 Compare May 7, 2024 09:31
@ChrisRackauckas
Copy link
Member

Looks like there's still linearization tests failing?

@AayushSabharwal
Copy link
Member Author

Yeah that's the one I'm having trouble reproducing. It errors in tests, but not when I run the code block manually in the REPL.

@ChrisRackauckas
Copy link
Member

Avoid any redefinition. If I had to guess it could be JuliaLang/julia#52635 cropping back up. If you split the safetestset into different parts does it go away?

@AayushSabharwal
Copy link
Member Author

Nope, still errors even in it's own file and @safetestset, but runs fine copy-pasted into the REPL

@ChrisRackauckas
Copy link
Member

Start Julia with forced bounds checks.

@AayushSabharwal
Copy link
Member Author

Thanks! Found the bug.

@AayushSabharwal
Copy link
Member Author

AayushSabharwal commented May 8, 2024

The test runs now, but it gives incorrect values. I'm not sure where it's going wrong.

EDIT: Never mind, fixed it as soon as I posted this

EDIT2: Another correctness issue

@AayushSabharwal AayushSabharwal force-pushed the as/linearization-initialization branch from 3898fce to d6befb7 Compare May 22, 2024 05:52
@ChrisRackauckas
Copy link
Member

What's the state here?

@AayushSabharwal
Copy link
Member Author

InterfaceI doesn't pass because of the OrdinaryDiffEq stuff, but everything else is good (except the downstream tests marked as broken)

@ChrisRackauckas ChrisRackauckas merged commit e1befe0 into SciML:master May 26, 2024
19 of 24 checks passed
@ChrisRackauckas
Copy link
Member

InitializationSystem Test: Test Failed at /home/runner/work/ModelingToolkit.jl/ModelingToolkit.jl/test/initializationsystem.jl:238
  Expression: sol.retcode == SciMLBase.ReturnCode.Unstable
   Evaluated: SciMLBase.ReturnCode.MaxIters == SciMLBase.ReturnCode.Unstable

@oscardssmith I thought this was handled?

@oscardssmith
Copy link
Contributor

so did I. Was this using the most recent version of SciMLBase?

@ChrisRackauckas
Copy link
Member

Make a PR that bumps it and let's see if master fails.

@AayushSabharwal AayushSabharwal deleted the as/linearization-initialization branch May 26, 2024 15:21
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.

4 participants