I have a list of complex differential equations that I need to step through "in parallel" (integrating one time step for equation 1, then one time step in equation 2, then another on in equation 1, etc): the solver needs to be "re-entrant". I've been trying to use scipy.integrate.ode
. My problem is
exactly the same as solving two uncoupled ODEs within a loop using python and scipy.integrate.ode, except with complex differential equations. Thus I can't use the 'dopri5', which is for real-valued ODEs only.
Is there any complex re-entrant ODE solver available in Python (preferably with an interface that isn't too radically different from scipy.integrate.ode
)?
Using multiprocessing
to have the solver in multiple processes (as proposed here) isn't really an option, because the overhead of sending back the states through IPC would be prohibitive. Another comment on the same question mentions that the sundials-library that underlies the scipy solver actually is re-entrant, but presumably Scipy hasn't caught up. Are there any other Python wrappers for sundials? I can't find any information whether the mentioned scikits-odes package is re-entrant.
I also tried simply replacing scipy.integrate.ode
with scipy.integrate.complex_ode
, but that crashes with a TypeError: can't multiply sequence by non-int of type 'complex'
that I haven't investigated any further.
My actual code where this entire problem comes up is here: https://github.com/qucontrol/krotov/blob/fe7c7240b6b7090b176b96f7d6d2f6b96bc39816/src/krotov/propagators.py#L156