-
-
Notifications
You must be signed in to change notification settings - Fork 226
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
SavingCallback for DAEs: Not clear how to get du #547
Comments
|
Thanks. In principal this works. However, there are the following issues: Fails for first time pointAt the first time point
triggers the following Sundials error:
I guess, this can be seen as a bug in IDA, because IDA has Temporarily, I use the code:
Would be better if this bug-fix would be included in function integrator(...). I tried whether this problem is present with DASKR, but unfortunately DASKR does not support callbacks. Allocates memory at every call
always allocates (unnecessary) memory for vector du. It would be better to use the call:
However, then "somehow" a cache-vector
This is also not nice (e.g. requires to define an It would be better, if a second |
Yeah 🤷♂
https://docs.juliadiffeq.org/latest/basics/integrator/#Caches-1
|
Unfortunately, this does not work for IDA: When printing the size of the cache vector:
So, there is only one cache vector and this cache vector is already used in
Could you add more cache vectors to IDA. |
I think we need to dig into Sundials and see if we can grab more cache vectors that it's already made. That's probably better than adding another register, since there's gotta be one in there. |
I tried to use a Float64 vector instead of an Any vector:
Surprisingly this worked. Since IDA is using an N_Vector array, this could mean that at every model evaluation there is some overhead associated to copy the N_Vector to a Julia vector. |
It should just be doing an unsafe_wrap, but FFI is not my specialty so it would be good if someone double check this: |
The callback
save_func(u, t, integrator)
can be provided to compute additional outputsy
based on the current time t and the current state u (and the model parameters integrator.p):y=f(u,t,p)
.To compute additional outputs
y
for DAEs, also the derivatives of the statesdu
are in general needed (y = f(du, u, t, p)
), butdu
is not in the interface ofsave_func
. Is it possible to getdu
somehow from theintegrator
(e.g.integrator.du
), or is a function call needed?The text was updated successfully, but these errors were encountered: