@@ -11,13 +11,14 @@ using OrdinaryDiffEq
1111#= Basic IPO: We need to read the incidence of the contained `-` =#
1212@noinline function onecall! ()
1313 x = continuous ()
14+ initial! (x - 1.0 )
1415 always! (ddt (x) - x)
1516end
1617
1718onecall! ()
18- sol = solve (DAECProblem (onecall!, ( 1 ,) .=> 1. ), IDA ( ))
19+ sol = solve (DAECProblem (onecall!), DFBDF (autodiff = false ))
1920@test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], exp .(sol. t)))
20- sol = solve (ODECProblem (onecall!, ( 1 ,) .=> 1. ), Rodas5 (autodiff= false ))
21+ sol = solve (ODECProblem (onecall!), Rodas5 (autodiff= false ))
2122@test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], exp .(sol. t)))
2223
2324#= === Contained Equations ============#
@@ -27,23 +28,24 @@ function twocall!()
2728end
2829
2930twocall! ()
30- dae_sol = solve (DAECProblem (twocall!, ( 1 , 2 ) .=> 1. ), IDA ( ))
31- ode_sol = solve (ODECProblem (twocall!, ( 1 , 2 ) .=> 1. ), Rodas5 (autodiff= false ))
31+ dae_sol = solve (DAECProblem (twocall!), DFBDF (autodiff = false ))
32+ ode_sol = solve (ODECProblem (twocall!), Rodas5 (autodiff= false ))
3233for (sol, i) in Iterators. product ((dae_sol, ode_sol), 1 : 2 )
3334 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], exp .(sol. t)))
3435end
3536
3637#= ============= NonLinear ============#
3738@noinline function sin! ()
3839 x = continuous ()
40+ initial! (x - 1.0 )
3941 always! (ddt (x) - sin (x))
4042end
4143function sin2! ()
4244 sin! (); sin! ();
4345 return nothing
4446end
45- dae_sol = solve (DAECProblem (sin2!, ( 1 , 2 ) .=> 1. ), IDA ( ))
46- ode_sol = solve (ODECProblem (sin2!, ( 1 , 2 ) .=> 1. ), Rodas5 (autodiff= false ))
47+ dae_sol = solve (DAECProblem (sin2!), DFBDF (autodiff = false ))
48+ ode_sol = solve (ODECProblem (sin2!), Rodas5 (autodiff= false ))
4749for (sol, i) in Iterators. product ((dae_sol, ode_sol), 1 : 2 )
4850 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], 2 * acot .(exp .(- sol. t).* cot (1 / 2 ))))
4951end
5254@noinline sink! (x, v) = always! (x - v)
5355function sinsink! ()
5456 x = continuous ()
57+ initial! (x - 1.0 )
5558 sink! (ddt (x), sin (x))
5659end
57- dae_sol = solve (DAECProblem (sinsink!, ( 1 ,) .=> 1. ), IDA ( ))
58- ode_sol = solve (ODECProblem (sinsink!, ( 1 ,) .=> 1. ), Rodas5 (autodiff= false ))
60+ dae_sol = solve (DAECProblem (sinsink!), DFBDF (autodiff = false ))
61+ ode_sol = solve (ODECProblem (sinsink!), Rodas5 (autodiff= false ))
5962for sol in (dae_sol, ode_sol)
6063 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], 2 * acot .(exp .(- sol. t).* cot (1 / 2 ))))
6164end
@@ -66,7 +69,7 @@ function sinsink2!()
6669 x = continuous ()
6770 sink2! (x, sin (x))
6871end
69- dae_sol = solve (DAECProblem (sinsink2!, (1 ,) .=> 1. ), IDA ( ))
72+ dae_sol = solve (DAECProblem (sinsink2!, (1 ,) .=> 1. ), DFBDF (autodiff = false ))
7073ode_sol = solve (ODECProblem (sinsink2!, (1 ,) .=> 1. ), Rodas5 (autodiff= false ))
7174for sol in (dae_sol, ode_sol)
7275 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], 2 * acot .(exp .(- sol. t).* cot (1 / 2 ))))
@@ -91,7 +94,7 @@ function (this::sicm2!)()
9194 sicm! (this. a)(); sicm! (this. b)();
9295 return nothing
9396end
94- dae_sol = solve (DAECProblem (sicm2! (1. , 1. ), (1 , 2 ) .=> 1. ), IDA ( ))
97+ dae_sol = solve (DAECProblem (sicm2! (1. , 1. ), (1 , 2 ) .=> 1. ), DFBDF (autodiff = false ))
9598ode_sol = solve (ODECProblem (sicm2! (1. , 1. ), (1 , 2 ) .=> 1. ), Rodas5 (autodiff= false ))
9699for (sol, i) in Iterators. product ((dae_sol, ode_sol), 1 : 2 )
97100 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], 1. .+ sol. t))
104107
105108@noinline function (this:: nlsicm! )()
106109 x = continuous ()
110+ initial! (x - 1.0 )
107111 always! (ddt (x) - sin (this. arg))
108112end
109113
@@ -116,8 +120,8 @@ function (this::nlsicm2!)()
116120 nlsicm! (this. a)(); nlsicm! (this. b)();
117121 return nothing
118122end
119- dae_sol = solve (DAECProblem (nlsicm2! (1. , 1. ), ( 1 , 2 ) .=> 1. ), IDA ( ))
120- ode_sol = solve (ODECProblem (nlsicm2! (1. , 1. ), ( 1 , 2 ) .=> 1. ), Rodas5 (autodiff= false ))
123+ dae_sol = solve (DAECProblem (nlsicm2! (1. , 1. )), DFBDF (autodiff = false ))
124+ ode_sol = solve (ODECProblem (nlsicm2! (1. , 1. )), Rodas5 (autodiff= false ))
121125for (sol, i) in Iterators. product ((dae_sol, ode_sol), 1 : 2 )
122126 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], 1. .+ sin (1. )* sol. t))
123127end
0 commit comments