Skip to content

Commit d3b9de6

Browse files
Add documentation for EisenstatWalkerForcing2
- Add Eisenstat & Walker (1996) reference to refs.bib - Add forcing parameter to General Keyword Arguments section - Add new Forcing Term Strategies section with EisenstatWalkerForcing2 docs - Update NewtonRaphson docstring with detailed keyword argument descriptions - Add mention of Newton-Krylov support in solver recommendations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 4581631 commit d3b9de6

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed

docs/src/native/solvers.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ documentation.
3535
differencing tricks (without ever constructing the Jacobian). However, if the Jacobian
3636
is still needed, for example for a preconditioner, `concrete_jac = true` can be passed
3737
in order to force the construction of the Jacobian.
38+
- `forcing`: Adaptive forcing term strategy for Newton-Krylov methods. When using an
39+
iterative linear solver (Krylov method), this controls how accurately the linear system
40+
is solved at each Newton iteration. Defaults to `nothing` (fixed tolerance). See
41+
[Forcing Term Strategies](@ref forcing_strategies) for available options.
3842

3943
## Nonlinear Solvers
4044

@@ -81,3 +85,43 @@ QuasiNewtonAlgorithm
8185
GeneralizedFirstOrderAlgorithm
8286
GeneralizedDFSane
8387
```
88+
89+
## [Forcing Term Strategies](@id forcing_strategies)
90+
91+
Forcing term strategies control how accurately the linear system is solved at each Newton
92+
iteration when using iterative (Krylov) linear solvers. This is the key idea behind
93+
Newton-Krylov methods: instead of solving ``J \delta u = -f(u)`` exactly, we solve it only
94+
approximately with a tolerance ``\eta_k`` (the forcing term).
95+
96+
The [eisenstat1996choosing](@citet) paper introduced adaptive strategies for choosing
97+
``\eta_k`` that can significantly improve convergence, especially for problems where the
98+
initial guess is far from the solution.
99+
100+
```@docs
101+
EisenstatWalkerForcing2
102+
```
103+
104+
### Example Usage
105+
106+
```julia
107+
using NonlinearSolve, LinearSolve
108+
109+
# Define a large nonlinear problem
110+
function f!(F, u, p)
111+
for i in 2:(length(u) - 1)
112+
F[i] = u[i - 1] - 2u[i] + u[i + 1] + sin(u[i])
113+
end
114+
F[1] = u[1] - 1.0
115+
F[end] = u[end]
116+
end
117+
118+
n = 1000
119+
u0 = zeros(n)
120+
prob = NonlinearProblem(f!, u0)
121+
122+
# Use Newton-Raphson with GMRES and Eisenstat-Walker forcing
123+
sol = solve(prob, NewtonRaphson(
124+
linsolve = KrylovJL_GMRES(),
125+
forcing = EisenstatWalkerForcing2()
126+
))
127+
```

docs/src/refs.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
@article{eisenstat1996choosing,
2+
title = {Choosing the forcing terms in an inexact Newton method},
3+
author = {Eisenstat, Stanley C and Walker, Homer F},
4+
journal = {SIAM Journal on Scientific Computing},
5+
volume = {17},
6+
number = {1},
7+
pages = {16--32},
8+
year = {1996},
9+
publisher = {SIAM}
10+
}
11+
112
@article{bastin2010retrospective,
213
title = {A retrospective trust-region method for unconstrained optimization},
314
author = {Bastin, Fabian and Malmedy, Vincent and Mouffe, M{\'e}lodie and Toint, Philippe L and Tomanos, Dimitri},

docs/src/solvers/nonlinear_system_solvers.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ sparse/structured matrix support, etc. These methods support the largest set of
5050
features, but have a bit of overhead on very small problems.
5151

5252
- [`NewtonRaphson()`](@ref): A Newton-Raphson method with swappable nonlinear solvers and
53-
autodiff methods for high performance on large and sparse systems.
53+
autodiff methods for high performance on large and sparse systems. Supports Newton-Krylov
54+
methods with adaptive forcing via [`EisenstatWalkerForcing2`](@ref).
5455
- [`TrustRegion()`](@ref): A Newton Trust Region dogleg method with swappable nonlinear
5556
solvers and autodiff methods for high performance on large and sparse systems.
5657
- [`LevenbergMarquardt()`](@ref): An advanced Levenberg-Marquardt implementation with the

lib/NonlinearSolveFirstOrder/src/raphson.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@
88
An advanced NewtonRaphson implementation with support for efficient handling of sparse
99
matrices via colored automatic differentiation and preconditioned linear solvers. Designed
1010
for large-scale and numerically-difficult nonlinear systems.
11+
12+
### Keyword Arguments
13+
14+
- `autodiff`: determines the backend used for the Jacobian. Defaults to `nothing` which
15+
means that a default is selected according to the problem specification.
16+
- `concrete_jac`: whether to build a concrete Jacobian. If a Krylov-subspace method is
17+
used, then the Jacobian will not be constructed. Defaults to `nothing`.
18+
- `linsolve`: the [LinearSolve.jl](https://github.com/SciML/LinearSolve.jl) solver used
19+
for the linear solves within the Newton method. Defaults to `nothing`, which means it
20+
uses the LinearSolve.jl default algorithm choice.
21+
- `linesearch`: the line search algorithm to use. Defaults to `missing` (no line search).
22+
- `vjp_autodiff`: backend for computing Vector-Jacobian products.
23+
- `jvp_autodiff`: backend for computing Jacobian-Vector products.
24+
- `forcing`: Adaptive forcing term strategy for Newton-Krylov methods. When using an
25+
iterative linear solver (e.g., `KrylovJL_GMRES()`), this controls how accurately the
26+
linear system is solved at each iteration. Use `EisenstatWalkerForcing2()` for the
27+
classical Eisenstat-Walker adaptive forcing strategy. Defaults to `nothing` (fixed
28+
tolerance from the termination condition).
1129
"""
1230
function NewtonRaphson(;
1331
concrete_jac = nothing, linsolve = nothing, linesearch = missing,

0 commit comments

Comments
 (0)