Skip to content

Commit 409a07b

Browse files
committed
specify chunksize for lambert's problem
1 parent 7c5ea8f commit 409a07b

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
push:
77
branches:
88
- master
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
914
jobs:
1015
test:
1116
runs-on: ubuntu-latest

test/shooting/orbital.jl

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ resid_f_2p = (Array{Float64, 1}(undef, 3), Array{Float64, 1}(undef, 3))
6666

6767
### Now use the BVP solver to get closer
6868
bvp = BVProblem(orbital!, cur_bc!, y0, tspan)
69-
for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype = Val(:central)),
70-
AutoSparseForwardDiff(), AutoFiniteDiff(; fdtype = Val(:forward)),
69+
for autodiff in (AutoForwardDiff(; chunksize = 6), AutoFiniteDiff(; fdtype = Val(:central)),
70+
AutoSparseForwardDiff(; chunksize = 6), AutoFiniteDiff(; fdtype = Val(:forward)),
7171
AutoSparseFiniteDiff())
7272
nlsolve = TrustRegion(; autodiff)
7373
@time sol = solve(bvp, Shooting(DP5(); nlsolve); force_dtmin = true, abstol = 1e-13,
@@ -76,19 +76,22 @@ for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype = Val(:central)),
7676
@info "Single Shooting Lambert's Problem: $(norm(resid_f, Inf))"
7777
@test norm(resid_f, Inf) < 0.005
7878

79-
jac_alg = BVPJacobianAlgorithm(; nonbc_diffmode = autodiff)
80-
@time sol = solve(bvp, MultipleShooting(10, AutoVern7(Rodas5P()); nlsolve, jac_alg);
81-
abstol = 1e-6, reltol = 1e-6, verbose = false)
82-
cur_bc!(resid_f, sol, nothing, sol.t)
83-
@info "Multiple Shooting Lambert's Problem: $(norm(resid_f, Inf))"
84-
@test norm(resid_f, Inf) < 0.005
79+
# Older versions take too long on the first run
80+
if VERSION v"1.10-"
81+
jac_alg = BVPJacobianAlgorithm(; nonbc_diffmode = autodiff)
82+
@time sol = solve(bvp, MultipleShooting(10, DP5(); nlsolve, jac_alg);
83+
force_dtmin = true, abstol = 1e-6, reltol = 1e-6, verbose = false)
84+
cur_bc!(resid_f, sol, nothing, sol.t)
85+
@info "Multiple Shooting Lambert's Problem: $(norm(resid_f, Inf))"
86+
@test norm(resid_f, Inf) < 0.005
87+
end
8588
end
8689

8790
### Using the TwoPoint BVP Structure
8891
bvp = TwoPointBVProblem(orbital!, (cur_bc_2point_a!, cur_bc_2point_b!), y0, tspan;
8992
bcresid_prototype = (Array{Float64}(undef, 3), Array{Float64}(undef, 3)))
90-
for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype = Val(:central)),
91-
AutoSparseForwardDiff(), AutoFiniteDiff(; fdtype = Val(:forward)),
93+
for autodiff in (AutoForwardDiff(; chunksize = 6), AutoFiniteDiff(; fdtype = Val(:central)),
94+
AutoSparseForwardDiff(; chunksize = 6), AutoFiniteDiff(; fdtype = Val(:forward)),
9295
AutoSparseFiniteDiff())
9396
nlsolve = TrustRegion(; autodiff)
9497
@time sol = solve(bvp, Shooting(DP5(); nlsolve); force_dtmin = true, abstol = 1e-13,
@@ -98,11 +101,14 @@ for autodiff in (AutoForwardDiff(), AutoFiniteDiff(; fdtype = Val(:central)),
98101
@info "Single Shooting Lambert's Problem: $(norm(reduce(vcat, resid_f_2p), Inf))"
99102
@test norm(reduce(vcat, resid_f_2p), Inf) < 0.005
100103

101-
jac_alg = BVPJacobianAlgorithm(; nonbc_diffmode = autodiff, bc_diffmode = autodiff)
102-
@time sol = solve(bvp, MultipleShooting(10, AutoVern7(Rodas5P()); nlsolve, jac_alg);
103-
abstol = 1e-6, reltol = 1e-6, verbose = false)
104-
cur_bc_2point_a!(resid_f_2p[1], sol(t0), nothing)
105-
cur_bc_2point_b!(resid_f_2p[2], sol(t1), nothing)
106-
@info "Multiple Shooting Lambert's Problem: $(norm(reduce(vcat, resid_f_2p), Inf))"
107-
@test norm(reduce(vcat, resid_f_2p), Inf) < 0.005
104+
# Older versions take too long on the first run
105+
if VERSION v"1.10-"
106+
jac_alg = BVPJacobianAlgorithm(; nonbc_diffmode = autodiff, bc_diffmode = autodiff)
107+
@time sol = solve(bvp, MultipleShooting(10, DP5(); nlsolve, jac_alg);
108+
force_dtmin = true, abstol = 1e-6, reltol = 1e-6, verbose = false)
109+
cur_bc_2point_a!(resid_f_2p[1], sol(t0), nothing)
110+
cur_bc_2point_b!(resid_f_2p[2], sol(t1), nothing)
111+
@info "Multiple Shooting Lambert's Problem: $(norm(reduce(vcat, resid_f_2p), Inf))"
112+
@test norm(reduce(vcat, resid_f_2p), Inf) < 0.005
113+
end
108114
end

0 commit comments

Comments
 (0)