Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 14, 2023
1 parent 44e12eb commit d55227c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ function MIRKJacobianComputationAlgorithm(diffmode = missing;
diffmode = AutoForwardDiff()
bc_diffmode = bc_diffmode === missing ? AutoForwardDiff() : bc_diffmode
collocation_diffmode = collocation_diffmode === missing ?
AutoForwardDiff() : collocation_diffmode
AutoForwardDiff() : collocation_diffmode
else
diffmode = AutoSparseForwardDiff()
bc_diffmode = bc_diffmode === missing ? AutoForwardDiff() : bc_diffmode
collocation_diffmode = collocation_diffmode === missing ?
AutoSparseForwardDiff() : collocation_diffmode
AutoSparseForwardDiff() : collocation_diffmode
end
return MIRKJacobianComputationAlgorithm(bc_diffmode, collocation_diffmode,
collocation_diffmode)
Expand Down
16 changes: 8 additions & 8 deletions test/orbital.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,25 @@ TestTol = 0.05

### Now use the BVP solver to get closer
bvp = BVProblem(orbital!, cur_bc!, y0, tspan)
for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype=Val(:central)),
AutoSparseForwardDiff(), AutoFiniteDiff(; fdtype=Val(:forward)),
AutoSparseFiniteDiff())
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);
reltol = 1e-13)
cur_bc!(resid_f, sol, nothing, sol.t)
@test norm(resid_f, Inf) < TestTol
end

### Using the TwoPoint BVP Structure
bvp = TwoPointBVProblem(orbital!, cur_bc_2point!, y0, tspan;
bcresid_prototype = (Array{Float64}(undef, 3), Array{Float64}(undef, 3)))
for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype=Val(:central)),
AutoSparseForwardDiff(), AutoFiniteDiff(; fdtype=Val(:forward)),
AutoSparseFiniteDiff())
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);
reltol = 1e-13)
cur_bc_2point!(resid_f_2p, (sol(t0), sol(t1)), nothing)
@test norm(vcat(resid_f_2p...), Inf) < TestTol
end
2 changes: 1 addition & 1 deletion test/shooting_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ end
bvp3 = TwoPointBVProblem(f1!, bc2!, u0, tspan;
bcresid_prototype = (Array{Float64}(undef, 1), Array{Float64}(undef, 1)))
@test SciMLBase.isinplace(bvp3)
sol = solve(bvp3, Shooting(Tsit5(), TrustRegion(; autodiff=false)))
sol = solve(bvp3, Shooting(Tsit5(), TrustRegion(; autodiff = false)))
@test SciMLBase.successful_retcode(sol)
resid_f = (Array{Float64, 1}(undef, 1), Array{Float64, 1}(undef, 1))
bc2!(resid_f, (sol(tspan[1]), sol(tspan[2])), nothing)
Expand Down

0 comments on commit d55227c

Please sign in to comment.