Skip to content

Commit 0772416

Browse files
author
oscarddssmith
committed
add Hires test
1 parent d421621 commit 0772416

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/interface/linear_solver_test.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,43 @@ end
157157
atol = 1e-1, rtol = 1e-1)
158158
@test isapprox(exp.(p), g_helper(p; alg = KenCarp47(linsolve = KrylovJL_GMRES()));
159159
atol = 1e-1, rtol = 1e-1)
160+
161+
using OrdinaryDiffEq, StaticArrays, LinearSolve, ParameterizedFunctions
162+
163+
hires = @ode_def Hires begin
164+
dy1 = -1.71*y1 + 0.43*y2 + 8.32*y3 + 0.0007
165+
dy2 = 1.71*y1 - 8.75*y2
166+
dy3 = -10.03*y3 + 0.43*y4 + 0.035*y5
167+
dy4 = 8.32*y2 + 1.71*y3 - 1.12*y4
168+
dy5 = -1.745*y5 + 0.43*y6 + 0.43*y7
169+
dy6 = -280.0*y6*y8 + 0.69*y4 + 1.71*y5 - 0.43*y6 + 0.69*y7
170+
dy7 = 280.0*y6*y8 - 1.81*y7
171+
dy8 = -280.0*y6*y8 + 1.81*y7
172+
end
173+
174+
u0 = zeros(8)
175+
u0[1] = 1
176+
u0[8] = 0.0057
177+
178+
probiip = ODEProblem{true}(hires, u0, (0.0,10.0))
179+
proboop = ODEProblem{false}(hires, u0, (0.0,10.0))
180+
probstatic = ODEProblem{false}(hires, SVector{8}(u0), (0.0,10.0))
181+
probs = (;probiip, proboop, probstatic)
182+
qndf = QNDF()
183+
krylov_qndf = QNDF(linsolve=KrylovJL_GMRES())
184+
fbdf = FBDF()
185+
krylov_fbdf = FBDF(linsolve=KrylovJL_GMRES())
186+
rodas = Rodas5P()
187+
krylov_rodas = Rodas5P(linsolve=KrylovJL_GMRES())
188+
solvers = (;qndf, krylov_qndf, rodas, krylov_rodas, fbdf, krylov_fbdf, )
189+
190+
refsol = solve(probiip, FBDF(), abstol=1e-12, reltol=1e-12)
191+
@testset "Hires" begin
192+
@testset "$probname" for (probname, prob) in pairs(probs)
193+
@testset "$solname" for (solname, solver) in pairs(solvers)
194+
sol = solve(prob, solver, abstol=1e-12, reltol=1e-12, maxiters=2e4)
195+
@test sol.retcode == ReturnCode.Success
196+
@test isapprox(sol.u[end], refsol.u[end], rtol=1e-10, atol=1e-10)
197+
end
198+
end
199+
end

0 commit comments

Comments
 (0)