@@ -15,7 +15,7 @@ Single shooting method, reduces BVP to an initial value problem and solves the I
15
15
## Keyword Arguments
16
16
17
17
- `nlsolve`: Internal Nonlinear solver. Any solver which conforms to the SciML
18
- `NonlinearProblem` interface can be used.Note that any autodiff argument for the solver
18
+ `NonlinearProblem` interface can be used. Note that any autodiff argument for the solver
19
19
will be ignored and a custom jacobian algorithm will be used.
20
20
- `jac_alg`: Jacobian Algorithm used for the nonlinear solver. Defaults to
21
21
`BVPJacobianAlgorithm()`, which automatically decides the best algorithm to use based
@@ -39,12 +39,25 @@ function concretize_jacobian_algorithm(alg::Shooting, prob)
39
39
return Shooting (alg. ode_alg, alg. nlsolve, BVPJacobianAlgorithm (diffmode))
40
40
end
41
41
42
- function Shooting (ode_alg, nlsolve; jac_alg = BVPJacobianAlgorithm ())
42
+ function Shooting (ode_alg; nlsolve = NewtonRaphson (), jac_alg = nothing )
43
+ jac_alg === nothing && (jac_alg = __propagate_nlsolve_ad_to_jac_alg (nlsolve))
43
44
return Shooting (ode_alg, nlsolve, jac_alg)
44
45
end
45
46
46
- function Shooting (ode_alg; nlsolve = NewtonRaphson (), jac_alg = BVPJacobianAlgorithm ())
47
- return Shooting (ode_alg, nlsolve, jac_alg)
47
+ Shooting (ode_alg, nlsolve; jac_alg = nothing ) = Shooting (ode_alg; nlsolve, jac_alg)
48
+
49
+ # This is a deprecation path. We forward the `ad` from nonlinear solver to `jac_alg`.
50
+ # We will drop this function in
51
+ function __propagate_nlsolve_ad_to_jac_alg (nlsolve:: N ) where {N}
52
+ # Defaults so no depwarn
53
+ nlsolve === nothing && return BVPJacobianAlgorithm ()
54
+ ad = hasfield (N, :ad ) ? nlsolve. ad : nothing
55
+ ad === nothing && return BVPJacobianAlgorithm ()
56
+
57
+ Base. depwarn (" Setting autodiff to the nonlinear solver in Shooting has been deprecated \
58
+ and will have no effect from the next major release. Update to use \
59
+ `BVPJacobianAlgorithm` directly" , :Shooting )
60
+ return BVPJacobianAlgorithm (ad)
48
61
end
49
62
50
63
"""
0 commit comments