LLNL / sundials

Official development repository for SUNDIALS - a SUite of Nonlinear and DIfferential/ALgebraic equation Solvers. Pull requests are welcome for bug fixes and minor changes.
https://computing.llnl.gov/projects/sundials
BSD 3-Clause "New" or "Revised" License
488 stars 118 forks source link

Differential delay equations #273

Closed mottelet closed 1 year ago

mottelet commented 1 year ago

Hello,

Has there been some attemps to embed sundials solvers into Differential delay equations solvers (others than the DelayDiffEq package of Julia) ?

S.

balos1 commented 1 year ago

Personally, I am not aware of any other than DelayDiffEq. A search of papers citing the SUNDIALS 2005 paper (2500+ citations) does not turn up much either.

mottelet commented 1 year ago

In fact the most problematic case is when the delay can become smaller that the actual step and fixed point iterations have to be used. In cvode, for example, is it possible to call safely CVodeGetDky in the ode rhs (needs to pass cvode_mem object in user_data, I guess) ?

mottelet commented 1 year ago

So, is it possible ?

gardner48 commented 1 year ago

Hi @mottelet, this is generally considered unsafe. When within the RHS function CVodeGetDky will compute the interpolated values using the predicted Nordsieck array for the new time and may not be as accurate as desired. Could you tell us some more about your use case?

drreynolds commented 1 year ago

Following up on the comment by @gardner48, according to the documentation at https://sundials.readthedocs.io/en/latest/cvodes/Usage/SIM.html#c.CVodeGetDky, "It is only legal to call the function CVodeGetDky after a successful return from CVode()."

Thus the documentation very directly states that you cannot call it within the RHS function.

That said, there may be some circumstances where an approximate version would be usable (as @gardner48 was exploring further).

mottelet commented 1 year ago

@gardner48 : I am exploring the possibilities of wrapping Sundials solvers into a differential delay equations solver. Like I said above, when the delays can become smaller than the actual solver predicted step, the approach used in Julia is to do fixed point iterations. In the case of CVode, the initial Nordsieck vectors set would be those of the previous step (hence used for extrapolation), and for further iterations the Nordsieck vectors of previous iteration are used. Hence this approach would need to allow CVodeGetDky to use a kind of checkpoint mechanism (i.e. have currently updated Nordsieck vectors and also the previous iteration/freezed Nordsieck vectors).

balos1 commented 1 year ago

Closing this now, but feel free to reopen if the discussion should be continued.