From 6dfd699cf8999ae226ef00a90aed40677f97e8b7 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 12 Nov 2024 13:08:31 -0100 Subject: [PATCH 1/2] Fix precision mixing in RodasTableau and better test precision mix Fixes https://github.com/SciML/OrdinaryDiffEq.jl/issues/2524 --- lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl | 2 +- test/interface/precision_mixing.jl | 0 test/runtests.jl | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 test/interface/precision_mixing.jl diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl index d7968cc572..7ed62e5847 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl @@ -225,7 +225,7 @@ end struct RodasTableau{T, T2} A::Matrix{T} C::Matrix{T} - gamma::T + gamma::T2 c::Vector{T2} d::Vector{T} H::Matrix{T} diff --git a/test/interface/precision_mixing.jl b/test/interface/precision_mixing.jl new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/runtests.jl b/test/runtests.jl index 821c48615d..3928ddad86 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -85,6 +85,7 @@ end if !is_APPVEYOR && (GROUP == "All" || GROUP == "InterfaceIV" || GROUP == "Interface") @time @safetestset "Autodiff Error Tests" include("interface/autodiff_error_tests.jl") @time @safetestset "Ambiguity Tests" include("interface/ambiguity_tests.jl") + @time @safetestset "Precision Mixing Tests" include("interface/precision_mixing.jl") @time @safetestset "Sized Matrix Tests" include("interface/sized_matrix_tests.jl") @time @safetestset "Second Order with First Order Solver Tests" include("interface/second_order_with_first_order_solvers.jl") end From e379c469dd54b1033ef2aeead4db3f56e07445aa Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 12 Nov 2024 13:09:58 -0100 Subject: [PATCH 2/2] add test --- test/interface/precision_mixing.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/interface/precision_mixing.jl b/test/interface/precision_mixing.jl index e69de29bb2..497944d65d 100644 --- a/test/interface/precision_mixing.jl +++ b/test/interface/precision_mixing.jl @@ -0,0 +1,22 @@ +using OrdinaryDiffEq +function ODE(du, u, t, R, K) + du .= u +end +params = BigFloat[1. 0.91758707304098; 1.48439909482661 1.] +u0 = BigFloat[0.1, 0.1] +tspan = (1.0, 31.0) +R = BigFloat[0.443280390004304303, 1.172917082211452] +K = BigFloat[13.470600276901400604, 12.52980757005] +ODE_ = (du, u, params, t) -> ODE(du, u, t, R, K) +odeProblem = ODEProblem(ODE_, u0, tspan, params) +for alg in [AutoVern8(Rodas5(), nonstifftol = 11 / 10) + FBDF() + QNDF() + Tsit5() + Rodas5P() + TRBDF2() + KenCarp4() + RadauIIA5() + ] + Solution = solve(odeProblem, alg, saveat = 1, abstol = 1.e-12, reltol = 1.e-6) +end \ No newline at end of file