I have a small toy compartmental model that iteratively solves a system of ode's using a rk4 algorithm from a ode_solvers crate. For some reason when I get printout from each iteration, only for monitoring/testing purposes I get two copies of each line from "println!"
Have I coded something incorrectly or could it possible be a bug in the ode solver? Thx. J.
The code to create the ode solver object is this:
mpl ode_solvers::System<f64, State> for TwoPool {
fn system(&self, _: Time, y: &State, dy: &mut State) {
and the line further down that outputs the results is this:
// print the outputs of the model at each integration iteration
println!("PoolSizes A={:.3}, B={:.3}, Tot={:.3}", y[0], y[1], y[2]);
and this is a section of the output I get:
PoolSizes A=22.231, B=14.926, Tot=37.157
PoolSizes A=22.231, B=14.926, Tot=37.157
PoolSizes A=22.288, B=14.956, Tot=37.243
PoolSizes A=22.288, B=14.956, Tot=37.243
PoolSizes A=22.344, B=14.986, Tot=37.330
PoolSizes A=22.344, B=14.986, Tot=37.330
PoolSizes A=22.401, B=15.015, Tot=37.416
PoolSizes A=22.401, B=15.015, Tot=37.416
PoolSizes A=22.457, B=15.045, Tot=37.502
PoolSizes A=22.457, B=15.045, Tot=37.502
PoolSizes A=22.513, B=15.075, Tot=37.588
Any thoughts why I'm getting doubles? Thx. J