srenevey / ode-solvers

Numerical methods to solve ordinary differential equations in Rust.
BSD 3-Clause "New" or "Revised" License
64 stars 26 forks source link

Stiffness appears to be checked almost every timestep? #9

Closed joshburkart closed 2 years ago

joshburkart commented 2 years ago

Hello -- thanks for providing this package!

I was trying to turn off stiffness detection and just let the solver use lots of tiny steps when necessary. I was thus going to set n_stiff to u32::MAX. However, even after doing this I found that IntegrationError::StiffnessDetected could still be returned. I traced it to this line in both dop853.rs and dopri5.rs -- shouldn't it be self.stats.accepted_steps % self.n_stiff == 0 instead?

                if (self.stats.accepted_steps % self.n_stiff != 0) || iasti > 0 {
srenevey commented 2 years ago

Thank you for pointing this out. I have fixed it in the latest revision.