Skip to content

2.0.0

Latest

Choose a tag to compare

@jacobwilliams jacobwilliams released this 19 Oct 03:53
· 1 commit to master since this release

New features

  • Dense output (continuous extensions) for variable-step methods (#9):
    • Available for rkdp54, rkdp85, rkv65e, rkv65r, rkv76e, rkv76r, rkv87e, rkv87r, rkv98e, rkv98r, rkdp87, rkev87 and dverk78. These methods are marked DENSE in the methods table.
    • Off by default, with no overhead. Turn it on with dense_output=.true. in initialize.
    • New interpolate method, with an optional istatus argument, and a new dense_interval method that returns the interval of the last step.
    • New dense_output_step option, which reports the solution on a fixed output grid without reducing the step size. It also works with integrate_to_event.
    • Event location in integrate_to_event uses the interpolant when dense output is enabled.
    • The extra function evaluations some interpolants need are only done when the dense output is actually used. When one of them is f at the end of the step, it is reused as the first stage of the next step.
    • Interpolant coefficients can be given in polynomial form or in the DOPRI5/DOP853 form. The Verner and Stone interpolants are converted exactly to the DOPRI form, which has much lower roundoff error. All coefficients have 40 significant digits, so they are also accurate in quad precision builds.
  • More step size control options in stepsize_class. All are off by default:
    • rtol_scaling: scale the relative tolerance with max(|x(t)|,|x(t+h)|), as DOPRI5/DOP853 do.
    • pi_beta and pi_beta_mult: PI (Lund) stabilized step size control.
    • no_increase_after_reject: don't increase the step size right after a rejected step.
    • error_combination: use DOP853's combined error estimate in rkdp85.
    • p_exponent_offset can now be -1, the usual choice for the error per unit step.
    • New public rms_func norm.
    • Documented settings that reproduce Hairer's DOPRI5/DOP853 step size control. With them, rkdp85 takes exactly the same steps as DOP853.
  • Fewer function evaluations:
    • Every variable-step method now gets its first stage from a function evaluation cache. A step that is retried after a rejection no longer recomputes f at the start of the step.
    • With the default options, rkdp85 now uses DOP853's combined error estimate, which acts like an 8th order estimate. The 5th order estimate it used before overestimated the error, so steps were much smaller than needed: at tol=1e-10 on a circular orbit it took 99 steps, and now takes 46.

Bug fixes

  • Fixed the error-per-unit-step scaling (relative_err=.true.). The error was multiplied by |h| instead of divided by it (#37). accept_mode=2 now also respects relative_err.
  • Fixed the root bracket in integrate_to_event. The search used the next proposed step size instead of the step just taken, which gave wrong event times.
  • Fixed rko129: its first stage was evaluated at t*h instead of t, which gave wrong results for non-autonomous problems. rkf1412 now evaluates its first stage at t directly; this was not a bug, since its offset was zero.
  • A user stop (me%stop()) now sets the status to RKLIB_ERROR_USER_STOPPED. Previously the integrator returned success. After a stop, nothing else is evaluated.
  • The very-small-error check in the step size control now uses the error scaled by the tolerance. At tight tolerances the old check caused many rejected steps.
  • stepsize_class%initialize now resets any option you don't pass to its default. Previously a reused object kept the options from the last call.

Other changes

  • New error codes for dense output. The codes run from -11 to -16 and are documented in the source.
  • stepsize_class%initialize is no longer pure, and compute_stepsize is now intent(inout) because it keeps state from the previous step.
  • The function evaluation cache moved from rk_variable_step_fsal_class to rk_variable_step_class. The public bindings are unchanged.
  • New script scripts/generate_dense.py generates the Verner and Stone dense output routines from the published coefficient files, and checks them, including all order conditions with --check.
  • New tests:
    • rk_test_dense: dense output.
    • rk_test_dop853: comparison against the reference DOP853.
    • rk_test_flint: comparison against FLINT.
    • rk_test_dop853_options: a table comparing step size option combinations.
    • rk_test_nonautonomous: all methods on a non-autonomous problem.
    • step_size_test was extended to cover the new options.
  • New dev-dependencies: dop853 and FLINT. A pixi environment is included for building.