How is the linear system solved, and what do tolerance and non-convergence mean?
An iterative solver improves a displacement estimate until an algebraic
imbalance is small enough. That establishes how closely it solves the
assembled equations. Mesh refinement and comparison with physical evidence
answer separate questions. This page covers static, small-strain,
isotropic linear-elastic solids; the implementation details refer to
KoFEM’s ordinary solid solve. Shell, coupled and optimization solvers have
their own settings.
The system after constraints
Assembly collects the
element equations. Displacement constraints
then move known values to the right-hand side. Write the resulting system as:
Here is the constrained
stiffness matrix,
contains the
displacement coefficients,
and is the modified
load vector, including prescribed-displacement
contributions. This local is a discrete vector, not the
continuum body-force field. In the N–mm system, their units are N/mm, mm
and N. KoFEM keeps each constrained row as an identity row that restates
its prescribed value; the free rows express force balance.
Conjugate gradients and preconditioning
Conjugate gradients (CG) uses sparse matrix–vector products and a few
vectors instead of forming a dense inverse. It chooses successive search
directions that are orthogonal in the stiffness inner product. In exact
arithmetic, CG solves a positive-definite system in at most as many steps
as there are unknowns. Rounding and poor conditioning make that bound an
impractical iteration budget.
Conjugate gradients on the plane-elasticity system of a small triangular mesh, clamped at one end and loaded at the other. Symmetric Gauss–Seidel preconditioning, one of KoFEM’s two choices, reaches a 10−6 relative tolerance in far fewer iterations. Computed for this figure; the plotted residual is the preconditioned norm relative to its initial value.
CG assumes a symmetric positive-definite matrix:
for every nonzero vector .
For elastic solids this means every admissible nonzero deformation costs
positive strain energy. It requires stable material properties, valid
elements and enough constraints on every connected part to remove rigid
motions. Merely adding one support does not establish these conditions.
A preconditioner cheaply approximates the inverse action
of . Call its matrix ; applying it means
solving approximately with , not explicitly inverting it.
Preconditioned CG also requires a fixed, symmetric positive-definite
preconditioner. The Solve panel offers two:
AMG multigrid (the default): smoothed-aggregation
algebraic multigrid. It groups neighbouring nodes into aggregates,
builds coarser versions of the system that still contain the six
rigid-body motions, and applies one V-cycle per CG step, with a
forward Gauss–Seidel sweep before and a backward sweep after each
coarse correction. The coarsest level is solved directly when it
is small enough.
Gauss–Seidel: one symmetric Gauss–Seidel sweep,
a forward and a backward pass, per application. These local sweeps
reduce error cheaply but remove long-range, slowly varying errors
poorly, so they need many more iterations on large or thin-walled
models.
Which residual does the solver measure?
At iteration , the estimate
has algebraic residual :
On free solid rows this is the remaining nodal force imbalance, in N.
Constrained rows enforce prescribed values; their residual is not a
support reaction. KoFEM measures the Euclidean norm of the residual
relative to the load:
The solve log calls the force residual. It is
dimensionless and means the same accuracy whichever preconditioner is
chosen. It is the ratio of two vector norms, not the largest nodal
force imbalance. Constrained rows, which hold prescribed values, enter
both norms; for fixed supports they are zero. CG updates the residual
recursively during the iteration; the solve does not independently
recompute the final force imbalance or estimate a condition number.
Tolerances and stopping
The relative tolerance asks for a reduction of
the residual relative to the load. KoFEM tests the squared quantities
after every step:
A relative tolerance of asks for a residual a million
times smaller than the load, or a factor of in the
squared test. It does not promise six correct digits of displacement or
stress. There is no absolute tolerance.
Ordinary solid solve in KoFEM
Setting
Value
Control
Preconditioner
AMG multigrid or Gauss–Seidel
“Solver” on the Solve panel; AMG is the default
Relative tolerance
1e-6
Fixed internally
Stopping measure
Fixed internally
Initial budget
5000 iterations
Internal default; callers can supply cgIterationLimit, not an ordinary solver-settings input
Additional budget
1–1 000 000 per continuation
User enters “Extra iterations” in “Keep solving?”
The app exposes the preconditioner and continuation, not a solid
tolerance control. Optimization tolerance inputs belong to another
solver path. With no load and nothing prescribed,
: the solution is exactly zero and the
solve accepts it before the first step.
Worked example: two free bar DOFs
Take two axial bar elements of stiffness 1 N/mm each. Fix the left node
and apply 1 N to each of the other two nodes. Their free displacements are
and , in mm. The reduced system is:
. Equilibrium gives
: the first element carries 2 N,
the second 1 N. Start CG at zero. For the forward/backward Gauss–Seidel
pair, the inverse action is:
Initially
and . CG uses this
preconditioned product for its step lengths; the first is
. The stopping test uses the plain residual norm. The
resulting iterates are:
At iteration 1, and
, so
. The current
target requires the second step, and a one-step
budget fails to converge. For illustration, a looser relative tolerance
of 0.7 would accept step 1; that tolerance is not an app setting. The
linked calculation below reproduces the steps in floating point, where
roundoff can leave a small nonzero final residual.
Conditioning, scaling and rigid modes
Conditioning describes how strongly a solution responds
to perturbations. For a symmetric positive-definite matrix, the spectral
condition number is the largest eigenvalue divided
by the smallest. Widely separated stiffness scales make this ratio large.
CG depends on the spectrum after preconditioning; a good preconditioner
clusters those scales.
Residual size alone cannot bound displacement error without information
about the inverse stiffness. Let denote the exact
solution of these discrete equations and
the algebraic error. Then . For nonzero
load and solution, ordinary Euclidean norms satisfy:
The right-hand factor is the reported , but the condition
number of a real stiffness matrix is large and unknown, so the bound
gives no useful error estimate. In practice:
Rigid modes: missing supports or disconnected bodies
make the matrix singular. Even a zero residual cannot establish
uniqueness: two free nodes joined by a spring with balanced loads have
the same residual after any common translation. See
Rigid-body modes.
Near mechanisms and constraints: a weak connection
or poorly placed supports leave a very soft motion. Extra constraints
can remove it but also change the physical problem and make the answer
too stiff. Support placement is a modelling choice.
Material contrast: very stiff and very soft regions
create separated scales. Poisson’s ratio near 0.5 makes the volumetric
stiffness large and can also cause displacement-element locking; a
tighter solve does not remove that discretisation error.
Mesh quality and size: distorted elements, small
features and large size transitions can worsen conditioning. Refining
adds unknowns and can increase the iteration count. Correct poor
elements first; refinement alone is not a solver repair.
Scaling: consistent units and suitable variable
scaling keep magnitudes manageable. Coherent unit conversion preserves
the physical solution; changing only the modulus or coordinates changes
the model. Multiplying a matrix by one scalar does not change its
condition number. KoFEM’s solid solve adds no separate equilibration
step beyond preconditioning.
Iteration budgets and failure
A budget limits work; it is not a convergence criterion. At the initial
5000-step solid budget, KoFEM can pause at Keep solving?
when a recent residual window shows progress. The policy checks both
window endpoints and the geometric means of its two halves; it tolerates
oscillations but requires improvement beyond roundoff. The window is
half the initial budget, at most 100 iterations. This heuristic predicts
neither eventual convergence nor the validity of the model.
Continue adds the requested number of iterations to the
live loop. It preserves the iterate, residual, search direction,
preconditioner and original convergence target. The prompt may recur.
Stop, including Escape, raises an explicit error and
discards the partial result. When the residual no longer falls, the
budget ends the solve with an error.
That error reports the relative residual, iteration count and
target 1e-6, with “The partial result was discarded”.
Two other errors stop a solve early and say the model is probably not
fully constrained: a multigrid setup whose coarsest system is singular,
and a CG breakdown, where a search direction meets zero or negative
stiffness. A non-convergence message alone does not diagnose
singularity; a constrained but poorly conditioned model can also fail.
Check body connectivity and supports first, then material values and
units, element quality
and stiffness contrasts. Inspect the displacement pattern and residual
history if available. A falling residual may justify more iterations;
a plateau calls for investigating conditioning. Although the current
error suggests refining the mesh, refinement can make convergence harder.
Three different accuracy questions
What each check establishes
Question
Evidence
Remaining uncertainty
Linear-solver convergence
Residual meets the algebraic stopping test for one assembled system
Displacement error depends on conditioning; mesh and model errors remain
Mesh convergence
A chosen quantity stabilizes under suitable refinement or higher order, with adequate linear solves
Singular peak stress may never stabilize; modelling assumptions remain
Physical model accuracy
Suitable assumptions, loads, supports and materials; comparison with analysis, experiments or trusted references
Small strain and linear elasticity may fail even on a fine mesh with a tiny residual
Judge the displacement or stress quantity needed for the engineering
decision. The axial-bar benchmark checks
extension against a known solution. A single passing benchmark does not
validate all meshes or boundary conditions. The
result interpretation chapter
develops these checks further.
KoFEM implementation
KoFEM’s solid solve runs in its Rust finite-element module.
The worked example above was checked independently of the
production solver; it illustrates the equations, not KoFEM’s code path.
KoFEM’s automated tests drive the real solid solver through
successful continuation, Stop and an exhausted iteration budget, and check that a
continued solve gives the same final field as an uninterrupted one.
Why KoFEM uses this method
Choice and rationale. Sparse CG suits a constrained,
positive-definite elastic system and keeps storage and per-step work
modest in the browser. Smoothed-aggregation multigrid uses the six
rigid-body motions to correct the long-range errors that local sweeps
leave, so it needs far fewer iterations on large and thin-walled
models. Gauss–Seidel remains as the simpler choice. The implementation
has a fixed accuracy target, checks convergence and lets a progressing
solve continue without restarting.
Tradeoff and alternatives. Multigrid costs a setup
step and extra memory for its coarse levels, and an under-constrained
model fails already in that setup. Geometric multigrid and other
algebraic multigrid variants are alternatives. Sparse direct
factorization is another general option, with fill-in and memory
costs; the current solid path does not select it as a fallback.
Limits. A correctly constrained but very large or
poorly conditioned model may still stagnate or need many extensions.
Continuation cannot repair a rigid mode or make a wrong physical model
accurate.
Sources and further reading
Vaněk, Mandel and Brezina, “Algebraic multigrid by smoothed
aggregation for second and fourth order elliptic problems”,
Computing 56 (1996), the multigrid preconditioner.