matlab - Equivalent of ode15s in c++ -


introduction: i'm looking equivalent of matlab's ode15s solver cpp language. ode15s variable order method - depending on behavior of ode set can vary 1st 5th order has many benefits in matter of performance. has ability deal system stiffness (however i'm not sure if necessary in case). last think dea solving - don't need function can omit it.

why need it: need solve system of 30 ode nested additional iterative algorithm. takes lot of calculation time. in matlab od15s solver, adjust order, pretty fast - simulation t=0.0 t=50.0 takes less 1 min. i'm unable reproduce performance in cpp code.

what have try: i'm working odeint library. far runge_kutta_dopri5 solver provides enough accuracy fixed 5th order method. leads poor performance, , same calculation t=50.0 can take 10 min or more. it's important problem in series calculations. tried use bulirsch_stoer_dense_out 2nd order method seems have low accuracy calculation fail fast. tried adams_bashforthwith different order setup (up 5 if correctly it, example: adams_bashforth< 5 , vector_type > stepper;) fails in longer calculations. notice comparing same calculation , without (with fixed value) of additional algorithm inside ode system, in matlab has minor effect on performance, in cpp can double calculation time - basing on can assume runge_kutta_dopri5 takes many more steps ode15s, algorithm called more times.

the question: should try next? there other ode solver test? or maybe should try of mentioned other configuration (if so, specify please). here provide working configuration runge_kutta_dopri5, show required accuracy , how call solver:

typedef std::vector< double > vector_type; typedef runge_kutta_dopri5<vector_type> stepper_type; integrate_const(make_dense_output<stepper_type>( 1e-12, 1e-6 ),                  solveo, y, 0.0, t_end, dt , printr) 

edit: tested rosenbrock4 suggested @steve. small ode set here, faster (do less steps). in compexed ode set provides still correct results slover. here comparison:

runge_kutta_dopri5      rosenbrock4 0    0.0126099          0 0.0126099 0.01 0.0112752          0.01 0.0112752 0.02 0.0102286          0.02 0.0102286 0.03 0.0094139          0.03 0.0094139 0.04 0.0087850          0.04 0.0087850 0.05 0.0083047          0.05 0.0083047 0.06 0.0079425          0.06 0.0079425 0.07 0.0076739          0.07 0.0076739 0.08 0.0074791          0.08 0.0074791 0.09 0.0073422          0.09 0.0073423 0.1  0.0072505          0.1 0.0072505 steps: 32832            steps: 78155 

in addition steps slower, took few minutes against few seconds runge_kutta_dopri5, short calculation (from t=0 t=0.1), not 2 times slower may bet looking on number of steps.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -