Skip to content

Commit

Permalink
Improve stiffness checking in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmech committed May 20, 2024
1 parent 66809a4 commit 18851e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions russell_ode/tests/test_dopri5_van_der_pol_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ fn test_dopri5_van_der_pol_debug() {
&[1.216973774601867E-02, 8.717646581250652E-01, 1.744401291692531E+00],
1e-12,
);
println!("h·ρ = {:?}", solver.out_stiff_h_times_rho()[32]);
println!("h·ρ = {:?}", solver.out_stiff_h_times_rho()[189]);
println!("h·ρ = {:?}", solver.out_stiff_h_times_rho()[357]);
let max_h_rho = params.stiffness.get_h_times_rho_max();
assert_eq!(max_h_rho, 3.25);
assert!(solver.out_stiff_h_times_rho()[0] < max_h_rho);
assert!(solver.out_stiff_h_times_rho()[32] > max_h_rho);
assert!(solver.out_stiff_h_times_rho()[189] > max_h_rho);
assert!(solver.out_stiff_h_times_rho()[357] > max_h_rho);
assert!(*solver.out_stiff_h_times_rho().last().unwrap() < max_h_rho);
}
10 changes: 10 additions & 0 deletions russell_ode/tests/test_dopri8_van_der_pol_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ fn test_dopri8_van_der_pol_debug() {
&[1.563905377322407E-02, 8.759592223459979E-01, 1.749270939102191E+00],
1e-7,
);
println!("h·ρ = {:?}", solver.out_stiff_h_times_rho()[21]);
println!("h·ρ = {:?}", solver.out_stiff_h_times_rho()[109]);
println!("h·ρ = {:?}", solver.out_stiff_h_times_rho()[196]);
let max_h_rho = params.stiffness.get_h_times_rho_max();
assert_eq!(max_h_rho, 6.1);
assert!(solver.out_stiff_h_times_rho()[0] < max_h_rho);
assert!(solver.out_stiff_h_times_rho()[21] > max_h_rho);
assert!(solver.out_stiff_h_times_rho()[109] > max_h_rho);
assert!(solver.out_stiff_h_times_rho()[196] > max_h_rho);
assert!(*solver.out_stiff_h_times_rho().last().unwrap() < max_h_rho);
}

0 comments on commit 18851e5

Please sign in to comment.