@@ -30,7 +30,7 @@ daesolvers = [Ascher2, Ascher4, Ascher6]
3030 for solver in solvers
3131 sol = solve (bvp, solver (), dt = 0.01 )
3232 @test isapprox (sol. u[end ], osol. u[end ]; atol = 0.01 )
33- @test sol. u[ 1 ] == [1.0 , 2.0 ]
33+ @test sol[[x, y], 1 ] == [1.0 , 2.0 ]
3434 end
3535
3636 # Test out of place
@@ -40,7 +40,7 @@ daesolvers = [Ascher2, Ascher4, Ascher6]
4040 for solver in solvers
4141 sol = solve (bvp2, solver (), dt = 0.01 )
4242 @test isapprox (sol. u[end ], osol. u[end ]; atol = 0.01 )
43- @test sol. u[ 1 ] == [1.0 , 2.0 ]
43+ @test sol[[x, y], 1 ] == [1.0 , 2.0 ]
4444 end
4545end
4646
129129 sol2 = solve (bvpi2, MIRK4 (), dt = 0.01 )
130130 sol3 = solve (bvpi3, MIRK4 (), dt = 0.01 )
131131 sol4 = solve (bvpi4, MIRK4 (), dt = 0.01 )
132- @test sol1 ≈ sol2 ≈ sol3 ≈ sol4 # don't get true equality here, not sure why
132+ @test sol1. t ≈ sol2. t ≈ sol3. t ≈ sol4. t
133+ @test sol1. u ≈ sol2. u ≈ sol3[[x (t), y (t)]] ≈ sol4[[x (t), y (t)]]
134+ # @test sol1 ≈ sol2 ≈ sol3 ≈ sol4 # don't get true equality here, not sure why
133135end
134136
135137function test_solvers (
296298 costfn = ModelingToolkit. generate_cost (
297299 lksys; expression = Val{false }, wrap_gfw = Val{true })
298300 _t = tspan[2 ]
299- @test costfn (sol, prob. p, _t) ≈ (sol (0.6 )[ 1 ] + 3 )^ 2 + sol (0.3 )[ 1 ] ^ 2
301+ @test costfn (sol, prob. p, _t) ≈ (sol (0.6 ; idxs = x (t)) + 3 )^ 2 + sol (0.3 ; idxs = x (t)) ^ 2
300302
301303 # ## With a parameter
302304 @parameters t_c
309311 sol = solve (prob, Tsit5 ())
310312 costfn = ModelingToolkit. generate_cost (
311313 lksys; expression = Val{false }, wrap_gfw = Val{true })
312- @test costfn (sol, prob. p, _t) ≈ log (sol (0.56 )[2 ] + sol (0.0 )[1 ]) - sol (0.4 )[1 ]^ 2
314+ @test costfn (sol, prob. p, _t) ≈
315+ log (sol (0.56 ; idxs = y (t)) + sol (0.0 ; idxs = x (t))) - sol (0.4 ; idxs = x (t))^ 2
313316end
0 commit comments