Skip to content

Nonlinear drivers

The default Newton — jno.solve.newton()

A nonlinear fem.solve(), and each step of a nonlinear march, runs jno.solve.newton() unless told otherwise. Its direct= argument picks how each linear step is solved:

direct= tangent linear step
None (default) assembled J(u) (a BCOO), wherever the assembler provides one Jacobi-BiCGStab, or the linear=/precond= slots. The BiCGStab answer is verified (one SpMV) and re-solved with Jacobi-GMRES when its relative residual is not small
False matrix-free — J·v from a JVP, no tangent stored Jacobi-BiCGStab, or the linear=/precond= slots. The Jacobi diagonal comes from a diagonal-only pass of the assembler, so precond=jno.precond.jacobi() works here too
True assembled a sparse LU each step, or the linear= slot's direct solver (see Sparse-direct Newton below)

When each one falls back:

  • The default runs matrix-free, as direct=False does, when the problem has no assembled tangent (a residual-only operator — the matrix-free-only paths listed under the sparse-direct Newton below).
  • With nonlinear= unset, a direct linear= slot (lu, dense, amg) selects direct=True.
  • direct=True needs the assembled tangent and raises without one; an explicit matrix-free nonlinear= beside a direct linear= raises too.

Because the default hands its linear step an assembled matrix, a precond= that needs one composes with it; direct=False has no matrix and is the choice when the assembled tangent would not fit in memory.

Its Jacobi preconditioner needs only the tangent's diagonal, which the assembler computes without the matrix: the same element loop, keeping each element block's diagonal entries (as deal.II's MatrixFreeTools::compute_diagonal does), so the memory is one vector. Each Newton step uses the diagonal at its own iterate. Each matrix-free step costs more than a sparse product (it re-runs the element kernel), so prefer the default while the tangent fits. All three modes are differentiable (implicit differentiation through lax.custom_root).

Each linear step is solved only as far as that step needs (inexact Newton). On the assembled tangent and on the matrix-free path alike, a Krylov linear step (the default Jacobi-BiCGStab, or any of cg, bicgstab, gmres, fgmres, minres, cocg in the linear= slot) is asked for the Eisenstat–Walker forcing term (Eisenstat & Walker, SIAM J. Sci. Comput. 17 (1996) 16, choice 2) instead of its own tol: loose far from the root, tightening as Newton converges.

The contract is unchanged — Newton stops on its own residual bound, ‖r‖ ≤ atol + rtol·‖r₀‖ — so the slot's tol no longer sets how far each step is solved. A direct linear step (lu, dense) is exact anyway, and a residual linear in the unknown keeps one exact step.

A nonlinear root is therefore accurate to atol + rtol·‖r₀‖ (default 1e-8 each) and no further: the last steps are no longer solved far past the bound the loop stops on. To compare a nonlinear solve below that — two routes to the same root, a convergence study — ask Newton for it: fem.solve(nonlinear=jno.solve.newton(rtol=1e-12, atol=1e-12)).

rigid = [(1, 0), (0, 1), (-y, x)]
fem.solve(linear=jno.solve.cg(), precond=jno.precond.amg(nullspace=rigid, reuse=True))  # forcing included

Picard / lagged coefficients — jno.lag

When a solution-dependent coefficient's Newton tangent destroys the linearized system's structure (the classic case: a shear-thinning viscosity μ_eff(u) in non-Newtonian Stokes flow, whose full-Newton velocity block defeats AMG/block preconditioners), freeze it with jno.lag(...) and drive with jno.solve.picard():

fem = jno.fem([2 * jno.lag(mu_eff) * inner(eps(ui), eps(vi)) - pi * div(vi), ...])
sol = fem.solve(nonlinear=jno.solve.picard(damping=0.7), linear=jno.solve.fgmres(),
                precond=jno.precond.triangular(...))

lag is stop_gradient on the traced expression, so the residual's linearization is the Picard operator — each outer step re-solves the lagged system (linear convergence, but every inner system keeps its symmetry/definiteness); the converged solution is identical to full Newton's. Without any lag marker, picard(damping=…) is exactly damped Newton (jno.solve.newton(damping=…)). Caveat for inverse problems: implicit differentiation then also uses the lagged Jacobian — drop lag when exact parameter gradients matter more than per-step solvability.

Anderson acceleration — picard(anderson=m), staggered(anderson=m)

A fixed-point loop converges only linearly, and slowly when the lagged coupling is strong. anderson=m mixes the last m iterates into each new one (type-II Anderson acceleration, Walker & Ni, SIAM J. Numer. Anal. 49(4), 2011). It is safeguarded: a mixed step that does not decrease the residual retreats toward the plain iterate, so it is never worse than anderson=0, the default. Gradients are unchanged, since the converged point is still differentiated through custom_root.

sol = fem.solve(nonlinear=jno.solve.picard(anderson=5))
sol = fem.solve(nonlinear=jno.solve.staggered([u, d], anderson=5))

-∇·((1 + c u²)∇u) = f, lagged coefficient, Picard steps to rtol 1e-8

c picard() picard(anderson=5)
5 33 11
20 fails in 400 steps 14
50 fails in 400 steps 20

Alternate minimization — jno.solve.staggered([u, d]) / staggered([[v, p], [T]])

Some coupled energies are non-convex in the fields jointly but convex in each separately. A monolithic Newton then has no descent guarantee and simply diverges; solving one field at a time turns the problem into a sequence of convex solves:

sol = fem.solve(nonlinear=jno.solve.staggered([u, dm]))   # sweep u, then dm, until both converge

Variational phase-field fracture is the canonical case — (1-d)²|∇u|² is quartic in the pair, while u alone is a linear elasticity problem and d alone a linear elliptic one. Measured on the coupled damage form in tests/test_fem_staggered.py: newton() leaves with a residual around 1e+25 (it raises), and the staggered sweep converges to a genuine root of the coupled system. Fixed-stress Biot poroelasticity and thermo-mechanical staggering have the same shape.

Algorithm: Bourdin, Francfort & Marigo, Numerical experiments in revisited brittle fracture, JMPS 48 (2000), §3 — as the staggered operator split with a history field, Miehe, Welschinger & Hofacker, IJNME 83 (2010).

Groups — fields solved together inside one sweep. An entry of the field list may itself be a list:

fem.solve(nonlinear=jno.solve.staggered([[v, p], [T]], direct=True), linear=jno.solve.lu())

This is not a convenience. A velocity/pressure pair cannot be swept apart: the pressure block is the constraint block, with no diagonal of its own — the block jno.precond.saddle locates structurally — so "solve p with v frozen" is not a well-posed sub-problem. Any flow staggered against a solid or a temperature therefore has to group its Stokes pair. Measured on a three-field Stokes/temperature problem (tests/test_fem_staggered_groups.py): the grouped sweep lands on the monolithic root to 1e-7 relative, and the flat staggered([v, p, T]) does not converge at all.

A bare symbol among lists is its own group, so [[v, p], T] is legal and [u, dm] keeps meaning exactly what it always did — one field per sweep. Every block must still appear, in exactly one group.

A group holding a constraint field is indefinite, so it wants direct=True for the reason in the next paragraph: a matrix-free sub-solve cannot be preconditioned, and unpreconditioned BiCGStab on a saddle block is not a solve. That is documented rather than enforced — fem.solve's own saddle warning already fires on the shape.

direct=True factorizes each field's diagonal block rather than solving it matrix-free, and pairs with a linear= slot:

fem.solve(nonlinear=jno.solve.staggered([u, dm], direct=True), linear=jno.solve.lu(backend="pardiso"))

It exists because the matrix-free sub-solve cannot be preconditioned. A precond= spec materializes against an assembled operator, and a staggered sub-problem is a restriction closure (x -> R(u with block set to x)[block]) with no matrix, so an ill-conditioned block is solved by unpreconditioned BiCGStab — near-incompressible elasticity (ν → 0.5) being the usual victim. That was also why a direct linear= slot used to be refused against staggered outright: there was nothing to factorize.

The extraction avoids a data-dependent nnz (which would break the static shapes a traced Newton needs): instead of slicing J[b][:, b] out, the complement's rows and columns are zeroed and given a unit diagonal, so the block is solved as [[J_bb, 0], [0, I]] against [-r_b, 0].

The padding is pure diagonal — no fill-in — so the factorization cost stays the block's. With bounds, the matrix handed to the factorization is the min-map's semismooth Jacobian (identity rows on the active set), which jax.linearize derives for free on the matrix-free path but an assembled tangent does not.

3-D Yeoh phase-field march — 576 DOFs, 8 load steps, CPU

Measured on a 3-D Yeoh phase-field march (576 DOFs, 8 load steps, CPU): 42.80 s → 10.78 s, 4.0×, to the same answer.

Two honest caveats: the full tangent is assembled to use one block of it (a sparsity-caching backend — pardiso/cudss — then pays only the numeric re-factorization per sweep), and on a well-conditioned problem the matrix-free default is cheaper. This is not a free upgrade and it is not the default. The load-path march threads the tangent too, which it previously never did: before this, a direct driver inside a tau= path silently fell back to the matrix-free inner solve.

line_search= globalizes each sub-solve's Newton steps, and is on by default:

value what it does
"backtrack" (default) residual-norm Armijo, halving from damping. What this used to do under line_search=True.
True exact line search — bisect for the root of the directional derivative R(x+λd)·d, i.e. the minimizer of the energy along the Newton direction
False no line search; take damping

The default moved from False to "backtrack" because no line search is a genuine footgun on finite-strain forms: measured here, a 3-D Yeoh P2 march produced NaN on load step 1 without one (the undamped step inverts an element, det F ≤ 0, and J^(-2/3) is NaN) and solved cleanly with one.

True implements Heinzmann, Vicentini, Carrara et al., Iterative convergence in phase-field brittle fracture computations: exact line search is all you need, Computational Mechanics (2026), arXiv:2511.23064, §3 Algorithm 2 — the same algorithm they contributed to PETSc as SNESLineSearchBisection. Their Props. 1–2 and Remark 4 chain into a convergence guarantee for the whole alternate-minimization scheme, provided each sub-problem is strictly convex and coercive (jNO's bounds min-map is semismooth, so that proof does not cover it — the same gap they note for reduced-space active sets).

It is not the default, because we have not measured it beating backtracking. On the problems tested here — a 2-D SENT plate with and without a volumetric-deviatoric split, at several load levels — both need the same 21–22 staggered sweeps, and the exact search costs ~15% more wall time from the extra residual evaluations.

Note the paper's own failure cases arise only where the mechanical sub-problem is non-linear (their §: the residual "reduces to an affine form in the absence of an energy decomposition"), at critical load steps reached along a path — a regime not reproduced here. Reach for True when a sub-solve stalls; the theory is on its side even where our measurements are neutral.

Over-relaxation

Alternate minimization is a nonlinear block Gauss–Seidel iteration, so over-relaxation accelerates it exactly as it does the linear one — go ω times as far along each sub-step's own update direction, per block:

fem.solve(nonlinear=jno.solve.staggered([u, dm], over_relax=1.4))

Algorithm: Farrell & Maurini, Linear and nonlinear solvers for variational phase-field models of brittle fracture, IJNME 109 (2017) 648–667, Algorithm 2 (ORAM), §2.1. ω = 1 is plain alternate minimization. Kahan's classical bound gives ω ∈ (0, 2) as necessary for SOR to converge, and anything outside raises.

Whether it pays is problem-dependent, and there is no way to know in advance. The paper is explicit — they "rely on the naïve strategy of numerical experimentation on coarser problems" and defer automatic selection to future work.

Their own results split cleanly: Table I (a propagating crack, where AM converges slowly) gains 58–73% fewer iterations; Table II (where AM already converges fast) gets 0% — over-relaxation hinders it, going 37 → 111 → 185 → 326 → 747 iterations as ω runs 1.0 → 1.8.

On a 2-D small-strain phase-field problem that drives damage to 1, ω = 1.4 was 1.95× faster (3096 → 1587 ms, warm median of 3). So it defaults to 1, and a short ω sweep on a coarse version of the problem is the only way to know — the paper's own two tables disagree with each other.

ω cannot diverge. The extrapolation is not taken on trust: the step retreats by bisection on [1, ω] until the trial point has a finite residual and is feasible, and ω = 1 is the sub-solve's own converged answer, already evaluated and therefore admissible by construction. So the worst case is that the sweep degrades to plain alternate minimization.

This matters most on finite-strain forms, where an unguarded step past a converged answer inverts an element (det F ≤ 0, so J^(-2/3) is NaN) — measured on the 3-D Yeoh SENT march, which NaN'd on load step 1 at every ω down to 1.1 before the guard and runs to completion with it.

The test is finiteness and feasibility, not descent. Over-relaxation is deliberately not a descent method, so demanding a residual decrease would reject almost every ω > 1 and silently collapse the feature back to ω = 1 while appearing to keep it. Feasibility is the paper's own rule (§2.1 backs ω off by bisection on [1, ω] for the bound constraint); finiteness is the generalization.

Over-relaxation also acts on the free DOFs only.

Farrell & Maurini's ũ lives in the constrained space C_ū, where a prescribed DOF has δ = 0; jNO imposes essential conditions as residual rows, so without the mask the sub-solve's exact hit on the prescribed value gets extrapolated past — measured on one row with g = 2, ω = 1.7 gave 3.40 → 1.02 → 2.69, an oscillation decaying only as |1−ω|ᵏ, worst on a ramped condition where g moves every load step.

The mask covers every nonlinear problem — plain or parametric, 2-D/3-D or 1-D (non-nodal families excepted) — and on a periodic, slip or hanging-node system the prescribed DOFs are mapped into the reduced space the sweep runs in.

Cost when ω ≠ 1: one extra full residual evaluation per block per sweep.

Under bounds, over-relaxation steps past the sub-solve's answer — which is feasible by construction, while the extrapolation need not be — so the driver takes the box projector from the bounds wrapper and clips. That deviates from the paper, which backs the scalar ω off to the largest feasible value; clipping is componentwise, also feasible, and keeps more of the step.

The trade is the convergence rate, and it is not small. Alternate minimization converges linearly where Newton is quadratic, so it can need hundreds of sweeps near a propagating crack — hence the max_sweeps=200 default. It buys robustness, not speed: where Newton converges, Newton is the better choice (Farrell & Maurini, CMAME 312, 2017, compare the two directly).

Sweeping is Gauss-Seidel, so the order matters, and every field block must be listed — an unlisted field's equations would never be solved, which is rejected rather than skipped. Each field is solved alone unless it is listed in a group, which is solved together inside one sweep (see "Groups" above).

Differentiable in the ordinary way: at convergence the full residual is zero, so the sweep is just a way of finding that root and lax.custom_root supplies the gradient from the full Jacobian — the alternating structure is absent from the derivative by construction.

Sparse-direct Newton — jno.solve.newton(direct=True)

An iterative linear step — the default's Jacobi-BiCGStab on the assembled tangent, or BiCGStab on the JVP with direct=False — stalls on an indefinite / ill-conditioned tangent with no good preconditioner — a Taylor–Hood velocity/pressure saddle, a stiff Carman–Kozeny phase-change drag in a melt pool. direct=True instead assembles and factorizes the tangent each step with a sparse LU (the transient stepper factorizes the backward-Euler step tangent M/dt + ∂R/∂u; the steady path ∂R/∂u).

It composes wherever the assembler provides that tangent — fem.solve(nonlinear=jno.solve.newton(direct=True)) on a native nonlinear problem, steady or the transient march — and stays differentiable: implicit differentiation uses a direct, transposable tangent solve on the tangent assembled at the root (the adjoint solves Jᵀ directly too, not with a stalling Krylov). damping / line_search apply unchanged. It needs the assembled tangent, so it does not apply to the matrix-free-only paths (a coupled-residual wrapper, complex) — those fail loud.

The tangent it factorizes is always the element-scattered sparse one, in 1-D as in 2-D/3-D. 1-D used to build its nonlinear tangent with a global jax.jacfwd instead, on the assumption that only the then-default matrix-free Newton would ever ask for it; direct=True does ask, from inside the Newton loop, where a dense tangent cannot be sparsified at all (BCOO.fromdense needs a concrete nse). Besides working, the scattered tangent is O(nnz) rather than O(N²) — which is what 1-D node counts want.

A direct linear= slot selects it. lu, dense and amg all need an assembled matrix, so pairing one with the matrix-free Newton has nothing to factorize. fem.solve(linear=jno.solve.lu(backend="host")) on a nonlinear or transient problem therefore routes to the direct Newton, and that slot is the solver that runs on the assembled tangent (and on Jᵀ in the adjoint); precond= materializes against the same assembled operator.

Which factorization you pick is not cosmetic here: on a 26-step Rayleigh–Bénard march (three fields, saddle, nonlinear) the matrix-free Newton that was the default when this was measured (direct=False now) takes 20.1 s, linear=jno.solve.lu() 7.6 s and linear=jno.solve.lu(backend="host") 3.1 s, all to the same 2.8e-07 per-step Newton residual. An explicit matrix-free nonlinear= alongside a direct linear= is contradictory and raises rather than picking one silently.

Limits of this routing, since they are not obvious

This routing only fires when the linear slot is direct. A precond= that needs an assembled matrix (jacobi, an unbuilt amg) gets one from the default Newton; on the matrix-free routes (newton(direct=False), picard(), a problem with no assembled tangent) it raises where it is materialized.

picard() has no assembled-tangent form: its linearization is the lagged matrix-free JVP, so nonlinear=picard(), linear=lu() raises — moving to newton(direct=True) there changes the algorithm, not just the solver. And the direct Newton needs the assembler to supply a tangent, so the matrix-free-only routes (a coupled-residual wrapper) fail loud either way.

Reusing the factorization — newton(direct=True, reuse=True). Lagged-Jacobian (chord / Shamanskii) Newton: keep stepping against the last factorized tangent while each step still halves the residual, refresh it when the contraction falls below that, and reject a stale step that does not reduce the residual at all (Kelley, Solving Nonlinear Equations with Newton's Method, SIAM 2003, §1.5, §2.4).

It trades expensive factorizations for cheap extra steps, so it only pays where a factorization costs many residual evaluations, and only with a backend that keeps its factorization — lu(backend="cudss"), "pardiso" and "host" cache on the matrix values, so the same tangent again is a solve; backend="device" refactorizes anyway. fem.stats["nonlinear"]["factorizations"] reports the count on an eager solve.

Measured, honestly mixed. A 2-D manufactured nonlinear Poisson: 5 → 2 factorizations, same root. A 3-D rigid-plastic rolling model (22k DOFs, cuDSS, RTX 3070): the continuation ladder dropped from 137 to 75 factorizations, but the run got slower (134 s against 120 s) — there a factorization costs ~0.12 s while recompiling for each remeshed geometry costs ~6 s, so the linear solve was never the bottleneck. Measure where your time goes before reaching for it.