odesolver in BVPSOL
For the DiffEq wrapper of BVPSOL, I am hoping that we can allow any common interface method for the odesolver in BVPSOL. How exactly would I set that up? More specifically, what is it looking for in the odesolver argument? A function with a specific signature?
If odesolver≠nothing then odesolver (the IVP-solver) must be a (julia) function with input:
(rhs::Function, t0::Real, T::Real,x0::Vector, opt::AbstractOptionsODE) and output
(t,x,retcode,stats). That's the form of all the ODE-Solvers in ODEInterface.
Important:
- The IVP-solver options (
optabove) are a modified version of theOPT_IVPOPT, becauseBVPSOLgives the following (additional) values there:OPT_RTOL,OPT_MAXSS,OPT_INITIALSS. - The IVP-solver must return a
stats["step_predict"]field. This step-size prediction is needed by `BVPSOL´.
The IVP-solver options (opt above) are a modified version of the OPT_IVPOPT, because BVPSOL gives the following (additional) values there: OPT_RTOL, OPT_MAXSS, OPT_INITIALSS.
So it's essentially the same as the options that you pass in, but with these three fields changed? The last two make sense, but why is the relative tolerance modified?
The IVP-solver must return a stats["step_predict"] field. This step-size prediction is needed by `BVPSOL´.
What is step_predict? My guess would've been the initial dt prediction, but that's probably wrong because that value is OPT_INITIALSS.
So it's essentially the same as the options that you pass in, but with these three fields changed? The last two make sense, but why is the relative tolerance modified?
Yes. The rel. tol. may be changed by BVPSOL in the cases, where BVPSOL does numerical differentiation.
What is step_predict? My guess would've been the initial dt prediction, but that's probably wrong because that value is OPT_INITIALSS.
step_predict is the prediction of the initial-value solver for the next time-step (if one would integrate past the given end-time). A analogon description is: "the last predicted step size of the last accepted step of the IVP-solver)"
next time-step (if one would integrate past the given end-time)
Thanks. Out of curiosity, do you know how it uses this?
BVPSOL is a boundary value problem solver working with the multiple-shooting principle.
Here is a picture (the black dashed line is the initial guess given by the user). The shooting is done from right to left in this example, because at (0,0) there is a singularity. The (initial) grid consists of 5 intervals (colors: blue, orange, green, red, purple). BVPSOL solves the 5 IVP (with the guess as initial values) and get trajectories. They are shown in the picture after the first step of BVPSOL. Now a Newton-Method is used to change the 5 initial values to get one continuous solution (the last result, after the convergence is also plotted). During this, a lot of IVP need to be solved and now to your question:
The blue IVP-solver has a step size prediction for its last step. Hence this is a (very) good initial step size to begin the numerical solution for the orange IVP-solver [especially if the Newton-method is converging and the gaps/jumps between different trajectories are getting smaller and smaller].

oh, so it's just using step_predict to set OPT_INITIALSS? Interesting. Thanks.