Skip to content

Commit 79dcf13

Browse files
Raise NonlinearSolveBase floor for operator Jacobians (#3917)
* Preserve nonlinear verbosity when resizing caches Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> * Raise NonlinearSolveBase floor for operator Jacobians Declare the first NonlinearSolveBase release that supports SciMLOperator Jacobian prototypes so downgrade resolution cannot select the incompatible 2.33 series. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> --------- Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
1 parent 95bb9da commit 79dcf13

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

lib/OrdinaryDiffEqNonlinearSolve/Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name = "OrdinaryDiffEqNonlinearSolve"
22
uuid = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8"
33
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com>", "Yingbo Ma <mayingbo5@gmail.com>"]
4-
version = "2.3.0"
4+
version = "2.3.2"
55

66
[deps]
77
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
8+
NonlinearSolveBase = "be0214bd-f91f-a760-ac4e-3421ce2b2da0"
89
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
910
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
1011
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
@@ -50,6 +51,7 @@ DiffEqDevTools = {path = "../DiffEqDevTools"}
5051
SciMLTesting = "2.1"
5152
Pkg = "1"
5253
NonlinearSolve = "4.20.3"
54+
NonlinearSolveBase = "2.34.1"
5355
ForwardDiff = "1.3.3"
5456
Test = "<0.0.1, 1"
5557
FastBroadcast = "1.3"

lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import PreallocationTools: DiffCache, get_tmp
1717
using SimpleNonlinearSolve: SimpleTrustRegion, SimpleGaussNewton
1818
using NonlinearSolve: FastShortcutNonlinearPolyalg, FastShortcutNLLSPolyalg, NewtonRaphson,
1919
HomotopySweep, step!
20+
# The operator Jacobian path is implemented in NonlinearSolveBase and needs its own floor.
21+
import NonlinearSolveBase
2022
using MuladdMacro: @muladd
2123
using FastBroadcast: @..
2224
import FastClosures: @closure

lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ function initialize!(
132132
SciMLBase.remake(cache.prob; u0 = copy(z), p = nlp_params)
133133
end
134134
cache.prob = new_prob
135-
cache.cache = init(new_prob, cache.cache.alg)
135+
cache.cache = init(
136+
new_prob, cache.cache.alg;
137+
verbose = integrator.opts.verbose.nonlinear_verbosity
138+
)
136139
else
137140
SciMLBase.reinit!(cache.cache, z, p = nlp_params)
138141
end

test/InterfaceIII/verbosity.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,5 +428,21 @@ using NonlinearSolve: NonlinearVerbosity
428428
@test integrator.cache.nlsolver.cache.cache.verbose == NonlinearVerbosity(SciMLLogging.Detailed())
429429
end
430430

431+
@testset "Resize preserves Detailed NonlinearVerbosity" begin
432+
resize_prob = ODEProblem((du, u, p, t) -> du .= u, [1.0], (0.0, 1.0))
433+
verbose = DEVerbosity(nonlinear_verbosity = SciMLLogging.Detailed())
434+
integrator = init(
435+
resize_prob, ImplicitEuler(nlsolve = NonlinearSolveAlg());
436+
verbose, dt = 0.1
437+
)
438+
expected = NonlinearVerbosity(SciMLLogging.Detailed())
439+
@test integrator.cache.nlsolver.cache.cache.verbose == expected
440+
441+
resize!(integrator, 2)
442+
step!(integrator)
443+
444+
@test integrator.cache.nlsolver.cache.cache.verbose == expected
445+
end
446+
431447
end
432448
end

0 commit comments

Comments
 (0)