Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmech committed May 15, 2024
1 parent 258db0d commit 2c82bb6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions russell_ode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn main() -> Result<(), StrError> {
// solve from x = 0 to x = 1
let x1 = 1.0;
let mut args = 0;
solver.solve(&mut y, x, x1, None, None, &mut args)?;
solver.solve(&mut y, x, x1, None, &mut args)?;
println!("y =\n{}", y);

// check the results
Expand Down Expand Up @@ -280,7 +280,7 @@ fn main() -> Result<(), StrError> {
// solve from x = 0 to x = 20
let x1 = 20.0;
let mut args = 0;
solver.solve(&mut y, x, x1, None, None, &mut args)?;
solver.solve(&mut y, x, x1, None, &mut args)?;
println!("y =\n{}", y);

// check the results
Expand Down
2 changes: 1 addition & 1 deletion russell_ode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
//! // solve from x = 0 to x = 2
//! let x1 = 2.0;
//! let mut args = 0;
//! solver.solve(&mut y, x, x1, None, None, &mut args)?;
//! solver.solve(&mut y, x, x1, None, &mut args)?;
//! println!("y =\n{}", y);
//! Ok(())
//! }
Expand Down
2 changes: 1 addition & 1 deletion russell_ode/src/ode_solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ use russell_sparse::CooMatrix;
/// // solve from x = 0 to x = 1
/// let x1 = 1.0;
/// let mut args = 0;
/// solver.solve(&mut y, x, x1, None, None, &mut args)?;
/// solver.solve(&mut y, x, x1, None, &mut args)?;
///
/// // check the results
/// let y_ana = Vector::from(&[f64::exp(x1) - x1 - 1.0]);
Expand Down
8 changes: 3 additions & 5 deletions russell_ode/tests/test_radau5_robertson_small_h.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ fn test_radau5_robertson_small_h() {
params.step.h_ini = 1e-6;
params.debug = true;

// allocate the solver
let mut solver = OdeSolver::new(params, &system).unwrap();

// this will cause h to become too small
params.set_tolerances(1e-2, 1e-2, None).unwrap();

// allocate the solver
let mut solver = OdeSolver::new(params, &system).unwrap();

// solve the ODE system
let res = solver.solve(&mut y0, x0, x1, None, &mut args);
assert_eq!(res.err(), Some("the stepsize becomes too small"));
Expand All @@ -28,8 +28,6 @@ fn test_radau5_robertson_small_h() {
// get statistics
let stat = solver.stats();

println!("TODO");

// print and check statistics
println!("{}", stat.summary());
println!("y ={}{}", format_fortran(y0[0]), format_fortran(y0[1]));
Expand Down

0 comments on commit 2c82bb6

Please sign in to comment.