Opened 5 years ago
Last modified 5 years ago
#13524 new Bugs
Parameter mismatch on make_controlled factory (incorrectly constructed controlled_runge_kutta)
Reported by: | Owned by: | karsten | |
---|---|---|---|
Milestone: | To Be Determined | Component: | odeint |
Version: | Boost Release Branch | Severity: | Problem |
Keywords: | parameter, make_controlled, step-size, slow, adaptive | Cc: |
Description
While constructing a controlled_runge_kutta (might also affect other) using the make_controlled factory, the constructor of controlled_runge_kutta gets passed the wrong parameters. The factory calls the constructor with (abs_error, rel_error, stepper), instead of the actual parameters of the constructor (error_checker, step_adjuster, stepper). (see "boost/numeric/odeint/stepper/generation/make_controlled.hpp:44" and "boost/numeric/odeint/stepper/controlled_runge_kutta.hpp:247") This yields no compile error, since the respective class has the type of these paramerts as templates and the constructors of the actual expected types have all default parameters, without being explicit. This leads to the practically invisible error, where the passed values construct the types, expected by the constructor of controlled_runge_kutta, by populating the first parameter each (effectivly using these constructors as conversion constructors).
Note: This leads to the maximal step size being set to the relative error limit and the relative error limit being set to the default value of 10-6. Since one usually sets the relative error limit to a rather low value (like the default 10-6), this causes the controller to split usually small enough steps into even smaller, thus thousands of, substeps, drastically increasing computation time.
I was able to notice this behavior while debugging why my calculation of the controlled runge kutta uses unreasonably many substeps, while the constant step size runge kutta got a error estimated much lower then the error limit of the controller while doing the whole interval in only one step.
I had reported this bug a while ago on Github https://github.com/headmyshoulder/odeint-v2/issues/228 and only now realised, that one is supposed to report them here.