-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
DAE mass-matrix form: how much of OrdinaryDiffEq do I need to depend on? #2513
Comments
you need OrdinaryDiffEqNonlinearSolve and OrdinaryDiffEqRosenbrock for singular me matrices |
Yeah it has a special error message for this, I wonder why it's not hit here. |
Just to confirm this, Installing OrdinaryDiffEqNonlinearSolve alone isn't enough, I also have to import it. But then it does run as it should. |
Based on a close reading of https://github.com/SciML/OrdinaryDiffEq.jl/blob/a849f328da10f39be9f4b60fa13aa712375061e3/lib/OrdinaryDiffEqCore/src/initialize_dae.jl, here is what I have pieced together:
Indeed, if I adjust the example so that we use julia> pr = ODEProblem(dae_f, [1.0, -1.0], (0.0, 1.0), initialzealg=OrdinaryDiffEqRosenbrock.SciMLBase.NoInit())
julia> solve(pr, Rosenbrock23())
retcode: Success
Interpolation: specialized 2nd order "free" stiffness-aware interpolation
t: 14-element Vector{Float64}:
0.0
1.0e-6
1.1e-5
0.00011099999999999999
0.0011109999999999998
0.011110999999999996
0.06683274154492563
0.12255448308985126
0.23458930091053964
0.346624118731228
0.5123338263199448
0.6780435339086617
0.8849787889379794
1.0
u: 14-element Vector{Vector{Float64}}:
[1.0, -1.0]
[0.9999990000005, -0.9999990000005]
[0.9999890000604997, -0.9999890000604997]
[0.9998890061602316, -0.9998890061602316]
[0.998889616891569, -0.998889616891569]
[0.9889504591072803, -0.9889504591072803]
[0.9353450167194357, -0.9353450167194357]
[0.884645223878678, -0.884645223878678]
[0.7908389642917913, -0.7908389642917913]
[0.7069797592982714, -0.7069797592982714]
[0.5989062717031488, -0.5989062717031488]
[0.5073535947357113, -0.5073535947357113]
[0.412364026329937, -0.412364026329937]
[0.36753665558720594, -0.36753665558720594]
And if I pass it an invalid initial condition, it will still solve, with a correct solution for the algebraic variable except at the initial condition (which I guess might be expected, but is somewhat disconcerting). julia> pr = ODEProblem(dae_f, [1.0, 0.0], (0.0, 1.0), initialzealg=OrdinaryDiffEqRosenbrock.SciMLBase.NoInit())
julia> solve(pr, Rosenbrock23())
retcode: Success
Interpolation: specialized 2nd order "free" stiffness-aware interpolation
t: 14-element Vector{Float64}:
0.0
1.0e-6
1.1e-5
0.00011099999999999999
0.0011109999999999998
0.011110999999999996
0.0668326888361821
0.1225543776723642
0.23458911814501143
0.34662385861765865
0.5123335359943582
0.6780432133710577
0.8849784513102263
1.0
u: 14-element Vector{Vector{Float64}}:
[1.0, 0.0]
[0.9999990000005, -0.9999990000005006]
[0.9999890000604997, -0.9999890000604995]
[0.9998890061602316, -0.9998890061602318]
[0.998889616891569, -0.9988896168915689]
[0.9889504591072803, -0.9889504591072802]
[0.9353450660390021, -0.935345066039002]
[0.8846453171711408, -0.8846453171711407]
[0.7908391089561135, -0.7908391089561134]
[0.7069799433906985, -0.7069799433906983]
[0.5989064458099173, -0.598906445809917]
[0.5073537576078662, -0.5073537576078659]
[0.41236416579338064, -0.4123641657933806]
[0.3675366555969062, -0.3675366555969061]
So it seems to me like the default init shouldn't be |
Contemplating how this would be fixed: should there be a method in Oh, but we were supposed to hit an error, and in this case I managed to get a solution without an error. So maybe the error needs to move further up the call stack to |
We can check |
Okay, took a stab at a pull request which makes a change of this sort. I'm still relatively inexperienced with this kind of contribution, so I'm happy to make whatever changes are necessary. (Haven't done the code formatting step yet, but I assume that more changes will be needed anyway to my solution before it will get merged.) A preliminary test indicates that with the above MWE, that pull request triggers the appropriate error if OrdinaryDiffEqNonlinearSolve isn't installed, but still triggers the error if ODENonlinearSolve is loaded, so I know I have it wrong. Will take a look later. |
Describe the example
In the switch from [email protected] to [email protected], some tooling for solving DAEs in mass-matrix form is no longer exported.
I notice that on the upgrade from 1.1 to 1.2, OrdinaryDiffEqNonlinearSolve and some other related packages are removed as dependencies.
If I just need to depend on another subset of SciML, I don't mind, just need to know what to import (and maybe this should make it into the documentation at https://docs.sciml.ai/DiffEqDocs/stable/tutorials/dae_example/ ?)
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
With OrdinaryDiffEqRosenbrock v1.2
Not Working Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Working Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
The text was updated successfully, but these errors were encountered: