boostnumerical-integrationodeint

Set a maximum step size in odeint


I create a boost::odeint stepper as follows:

auto stepper=boost::numeric::odeint::make_dense_output(0.01/*Absolute*/,0.1/*Relative*/, boost::numeric::odeint::runge_kutta_dopri5< CombinedState >() );

There will be times during the integration of my system where it "lies low" for a while. During this periods it seems as though the integrator sometimes increases its step size to the point where it then jumps over areas of interest.

Is there a way to limit the integrator's step size so it never exceeds a given maximum?


Solution

  • The step size limit was added in boost 1.60. Now the third argument is optionally max step size.

    auto stepper=boost::numeric::odeint::make_dense_output(0.01/*Absolute*/,0.1/*Relative*/, 0.01/*max_dt*/, boost::numeric::odeint::runge_kutta_dopri5< CombinedState >() );
    

    It was implemented in https://github.com/headmyshoulder/odeint-v2/pull/177