headmyshoulder / odeint-v2

odeint - solving ordinary differential equations in c++ v2
http://headmyshoulder.github.com/odeint-v2/
Other
337 stars 102 forks source link

varying absolute tolerances #204

Closed wds15 closed 7 years ago

wds15 commented 7 years ago

Hi!

Currently we can use the adaptive integration schemes with a single relative and absolute error tolerance which holds for all states at the same time.

In my application I do know that the scale of the sates differs systematically. Hence, I would like to be able to set per integrated state the absolute tolerance separately. I have not found this in the docs and it would be great if this could be considered.

mariomulansky commented 7 years ago

This is not supported out-of-the box in odeint right now. We decided against this for the sake of an easier interface. However, it should be quite easy to add such functionality. You would need to implement a new error checker, and provide it as template parameter to the adaptive stepper you are using. The default error checker is documented there: http://headmyshoulder.github.io/odeint-v2/doc/boost/numeric/odeint/default_error_checker.html The new error_checker should provide the same interface, but use a vector for the absolute/relative error to allow for the different scales.

wds15 commented 7 years ago

Great. Thanks. Just about anything is customizable in odeint. Wonderful.

martinkrausze commented 7 years ago

I would like to scale my ode problem. Alternatively I could use different absolute/relative error values for the 2 components of my state vector of my solution. Mario Mulansky wrote, this functionality could be added easily by implementing a new error checker. Can anyone give me an example? Thanks a lot.