Skip to content

Solvers & preconditioners

jno.solve and jno.precond are slots: you hand one to fem.solve(...) or fdm.solve(...) and it replaces the default without changing a single term of the weak form. The same slot objects work for both front doors.

Between "accept the default" and "write a full solve_fn" sits the slot API: the solver factorises into four orthogonal slots, each a configured callable (never a string) from the jno.solve / jno.precond namespaces — or your own with the same contract. Every None keeps today's default; solve_fn= stays the total override (passing both is an error).

u = fem.solve(
    x0        = u_guess,                 # warm start — see "What a warm start buys" below
    nonlinear = jno.solve.newton(),      # linearization driver (nonlinear problems)
    linear    = jno.solve.gmres(),       # inner linear solve: lu / dense / cg / bicgstab / gmres
    precond   = jno.precond.jacobi(),    # v -> M⁻¹v spec, materialized against the assembled A
)

Which page do you need

You want to Page
pick cg / gmres / lu for a system, warm-start it, use a direct backend, batch many solves Linear solvers
speed a Krylov solve up: Jacobi, AMG, Stokes and Navier–Stokes blocks, composition, float32 Preconditioners
FSAI, coarse spaces and deflation, overlapping Schwarz Single precision, FSAI, coarse spaces, Schwarz
change how a nonlinear problem is linearised: Newton, Picard, Anderson, staggered, sparse-direct Newton Nonlinear drivers
time-dependent problems: schemes, variable-step BDF, SDIRK, Rosenbrock Transient problems
eigenpairs, band structure, contour eigensolves, singular values, logdet, trace, f(A)v Eigenproblems
plug in your own solver, read the solve printout, fem.stats, profile Writing your own and diagnostics
what runs compiled, first-run cost, when AMG pays, large systems on a GPU Performance

The first choice, by problem

Problem linear= precond= nonlinear=
SPD (Poisson, elasticity, mass) cg jacobi(); amg, fsai or schwarz when it is large none
non-symmetric (advection, SUPG) bicgstab / gmres jacobi() (the default) none
saddle point (Stokes, Biot) fgmres saddle() (AMG on the momentum block, pressure mass for the Schur complement) none
a nonlinear problem the same as above, per Newton step the same as above newton() (the default); picard / lag for lagged coefficients; staggered for coupled fields; newton(direct=True) for sparse-direct

The full choice by structure is the table in Choosing a linear solver; the preconditioner table is at the top of Preconditioners.