@@ -11,14 +11,15 @@ tsitsol = solve(prob_ode_2Dlinear, Tsit5())
1111@test sol. stats. nf == tsitsol. stats. nf
1212@test all (isequal (1 ), sol. alg_choice)
1313
14- sol = solve (prob_ode_2Dlinear, reltol= 1e-10 )
15- vernsol = solve (prob_ode_2Dlinear, Vern7 (), reltol= 1e-10 )
14+ sol = solve (prob_ode_2Dlinear, reltol = 1e-10 )
15+ vernsol = solve (prob_ode_2Dlinear, Vern7 (), reltol = 1e-10 )
1616# test that default isn't much worse than Tsit5 (we expect it to use Tsit5 for this).
1717@test sol. stats. naccept == vernsol. stats. naccept
1818@test sol. stats. nf == vernsol. stats. nf
1919@test all (isequal (2 ), sol. alg_choice)
2020
21- prob_ode_linear_fast = ODEProblem (ODEFunction (f_2dlinear, mass_matrix= 2 * I (2 )), rand (2 ), (0.0 , 1.0 ), 1.01 )
21+ prob_ode_linear_fast = ODEProblem (
22+ ODEFunction (f_2dlinear, mass_matrix = 2 * I (2 )), rand (2 ), (0.0 , 1.0 ), 1.01 )
2223sol = solve (prob_ode_linear_fast)
2324@test all (isequal (3 ), sol. alg_choice)
2425# for some reason the timestepping here is different from regular Rosenbrock23 (including the initial timestep)
@@ -27,56 +28,59 @@ function rober(u, p, t)
2728 y₁, y₂, y₃ = u
2829 k₁, k₂, k₃ = p
2930 [- k₁ * y₁ + k₃ * y₂ * y₃,
30- k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^ 2 ,
31- k₂ * y₂^ 2 ]
31+ k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^ 2 ,
32+ k₂ * y₂^ 2 ]
3233end
33- prob_rober = ODEProblem (rober, [1.0 ,0.0 ,0.0 ],(0.0 ,1e3 ),(0.04 ,3e7 ,1e4 ))
34+ prob_rober = ODEProblem (rober, [1.0 , 0.0 , 0.0 ], (0.0 , 1e3 ), (0.04 , 3e7 , 1e4 ))
3435sol = solve (prob_rober)
35- rosensol = solve (prob_rober, AutoTsit5 (Rosenbrock23 (autodiff= false )))
36+ rosensol = solve (prob_rober, AutoTsit5 (Rosenbrock23 (autodiff = false )))
3637# test that default has the same performance as AutoTsit5(Rosenbrock23()) (which we expect it to use for this).
3738@test sol. stats. naccept == rosensol. stats. naccept
3839@test sol. stats. nf == rosensol. stats. nf
39- @test unique (sol. alg_choice) == [1 ,3 ]
40+ @test unique (sol. alg_choice) == [1 , 3 ]
4041@test sol. alg_choice[1 ] == 1
4142@test sol. alg_choice[end ] == 3
4243
43- sol = solve (prob_rober, reltol= 1e-7 , abstol= 1e-7 )
44- rosensol = solve (prob_rober, AutoVern7 (Rodas5P (autodiff= false )), reltol= 1e-7 , abstol= 1e-7 )
44+ sol = solve (prob_rober, reltol = 1e-7 , abstol = 1e-7 )
45+ rosensol = solve (
46+ prob_rober, AutoVern7 (Rodas5P (autodiff = false )), reltol = 1e-7 , abstol = 1e-7 )
4547# test that default has the same performance as AutoTsit5(Rosenbrock23()) (which we expect it to use for this).
4648@test sol. stats. naccept == rosensol. stats. naccept
4749@test sol. stats. nf == rosensol. stats. nf
48- @test unique (sol. alg_choice) == [2 ,4 ]
50+ @test unique (sol. alg_choice) == [2 , 4 ]
4951@test sol. alg_choice[1 ] == 2
5052@test sol. alg_choice[end ] == 4
5153
5254function exrober (du, u, p, t)
5355 y₁, y₂, y₃ = u
5456 k₁, k₂, k₃ = p
55- du .= vcat ([- k₁ * y₁ + k₃ * y₂ * y₃,
56- k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^ 2 ,
57- k₂ * y₂^ 2 , ], u[4 : end ])
57+ du .= vcat (
58+ [- k₁ * y₁ + k₃ * y₂ * y₃,
59+ k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^ 2 ,
60+ k₂ * y₂^ 2 ], u[4 : end ])
5861end
5962
60- for n in (100 , ) # 600 should be added but currently is broken for unknown reasons
63+ for n in (100 ,) # 600 should be added but currently is broken for unknown reasons
6164 stiffalg = n < 50 ? 4 : n < 500 ? 5 : 6
6265 linsolve = n < 500 ? nothing : KrylovJL_GMRES ()
63- jac_prototype = sparse (I (n+ 3 ))
66+ jac_prototype = sparse (I (n + 3 ))
6467 jac_prototype[1 : 3 , 1 : 3 ] .= 1.0
6568
66- prob_ex_rober = ODEProblem (ODEFunction (exrober; jac_prototype), vcat ([1.0 ,0.0 ,0.0 ], ones (n)),(0.0 ,100.0 ),(0.04 ,3e7 ,1e4 ))
69+ prob_ex_rober = ODEProblem (ODEFunction (exrober; jac_prototype),
70+ vcat ([1.0 , 0.0 , 0.0 ], ones (n)), (0.0 , 100.0 ), (0.04 , 3e7 , 1e4 ))
6771 sol = solve (prob_ex_rober)
68- fsol = solve (prob_ex_rober, AutoTsit5 (FBDF (;autodiff= false , linsolve)))
72+ fsol = solve (prob_ex_rober, AutoTsit5 (FBDF (; autodiff = false , linsolve)))
6973 # test that default has the same performance as AutoTsit5(Rosenbrock23()) (which we expect it to use for this).
7074 @test sol. stats. naccept == fsol. stats. naccept
7175 @test sol. stats. nf == fsol. stats. nf
72- @test unique (sol. alg_choice) == [1 ,stiffalg]
76+ @test unique (sol. alg_choice) == [1 , stiffalg]
7377end
7478
7579function swaplinear (u, p, t)
76- [u[2 ], u[1 ]]. * p
80+ [u[2 ], u[1 ]] .* p
7781end
78- swaplinearf = ODEFunction (swaplinear, mass_matrix= ones (2 ,2 ) - I (2 ))
79- prob_swaplinear = ODEProblem (swaplinearf, rand (2 ), (0. , 1. ), 1.01 )
80- sol = solve (prob_swaplinear, reltol= 1e-7 ) # reltol must be set to avoid running into a bug with Rosenbrock23
82+ swaplinearf = ODEFunction (swaplinear, mass_matrix = ones (2 , 2 ) - I (2 ))
83+ prob_swaplinear = ODEProblem (swaplinearf, rand (2 ), (0.0 , 1.0 ), 1.01 )
84+ sol = solve (prob_swaplinear, reltol = 1e-7 ) # reltol must be set to avoid running into a bug with Rosenbrock23
8185@test all (isequal (4 ), sol. alg_choice)
8286# for some reason the timestepping here is different from regular Rodas5P (including the initial timestep)
0 commit comments