-
-
Couldn't load subscription status.
- Fork 79
Correct OrdinaryDiffEq DAE init integration #407
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
Conversation
|
@oscardssmith Can you put together some reduced tests for all this? |
Found by inspection - I think this acidentally had the same bug as SciML/Sundials.jl#407 if save_idxs is not `nothing`.
|
test added. |
|
Test fails |
|
yeah a different test is failing. I'm pretty sure some of the changes here are invalid, but I'm investigating. |
Sundials.jl got an implementation of the OrdinaryDiffEq DAE initialization interface in SciML#401. Unfortunately, it turns out that this doesn't quite work, because the u/du in Sundials' integrator struct are not the actual memory that IDA uses (it has an internal copy). In [1], I propose re-using `u_modified` to inform us that the shadow copy was modified during initialization. This is the Sundials side of that interface. [1] SciML/OrdinaryDiffEq.jl#1969
As in OrdinaryDiffEq's version of this function, we should save_start after DAE initialization has had a chance to change the initial guess.
12d01d4 to
eecd601
Compare
Codecov Report
@@ Coverage Diff @@
## master #407 +/- ##
==========================================
+ Coverage 81.44% 81.72% +0.28%
==========================================
Files 11 11
Lines 1428 1428
==========================================
+ Hits 1163 1167 +4
+ Misses 265 261 -4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
SciML/OrdinaryDiffEq.jl#1969 is required for this to actually do something with the OrdinaryDiffEq inits. @oscardssmith can you make sure to add a test case that exercises that path? |
This corrects two issues with the DAE init integration added in #401:
It makes sure that shadow copy of the state in the integrator struct is reflected back into IDA (with Set u_modified in DAE initialization if the u was changed OrdinaryDiffEq.jl#1969). This needs to handle two distinct cases:
a. Where a DiffEq DAE initialization algorithm is used directly (handled by checking u modified after the call to DAE init)
b. Where a DiffEq DAE init is chained into the IDA default init (handled by the check at the top of IDADefaultInit.
It also needs to make sure to reflect the values that IDADefaultInit came up with back into integrator.u to make sure that it can be read from there for anybody who might wish to inspect it.
The order of save_start and initialize_dae! was reversed, causing the first entry of the solution to always be
prob.u0rather than the result of DAE initialization.