Skip to content

Commit

Permalink
orbital multiple shooting
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 23, 2023
1 parent aafc2bb commit 95d6205
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions test/orbital.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype = Val(:central)),
AutoSparseForwardDiff(), AutoFiniteDiff(; fdtype = Val(:forward)),
AutoSparseFiniteDiff())
nlsolve = NewtonRaphson(; autodiff)
@time sol = solve(bvp, Shooting(DP5(); nlsolve); force_dtmin = true, abstol = 1e-13,
reltol = 1e-13)

@time sol = solve(bvp, Shooting(DP5(); nlsolve); force_dtmin = true,
abstol = 1e-13, reltol = 1e-13)
cur_bc!(resid_f, sol, nothing, sol.t)
@test norm(resid_f, Inf) < TestTol

@time sol = solve(bvp, MultipleShooting(10, DP5(); nlsolve); abstol = 1e-6,
reltol = 1e-6)
@test SciMLBase.successful_retcode(sol)
cur_bc!(resid_f, sol, nothing, sol.t)
@test norm(resid_f, Inf) < 1e-6
end

### Using the TwoPoint BVP Structure
Expand All @@ -84,8 +91,15 @@ for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype = Val(:central)),
AutoSparseForwardDiff(), AutoFiniteDiff(; fdtype = Val(:forward)),
AutoSparseFiniteDiff())
nlsolve = NewtonRaphson(; autodiff)
@time sol = solve(bvp, Shooting(DP5(); nlsolve); force_dtmin = true, abstol = 1e-13,
reltol = 1e-13)

@time sol = solve(bvp, Shooting(DP5(); nlsolve); force_dtmin = true,
abstol = 1e-13, reltol = 1e-13)
cur_bc_2point!(resid_f_2p, (sol(t0), sol(t1)), nothing)
@test norm(vcat(resid_f_2p...), Inf) < TestTol

@time sol = solve(bvp, MultipleShooting(10, DP5(); nlsolve); abstol = 1e-6,
reltol = 1e-6)
@test SciMLBase.successful_retcode(sol)
cur_bc_2point!(resid_f_2p, (sol(t0), sol(t1)), nothing)
@test norm(vcat(resid_f_2p...), Inf) < TestTol
end

0 comments on commit 95d6205

Please sign in to comment.