Linear Finite Element Analysis / Solvers and conditioning
Sparse systems, residuals and conditioning
Solve the restrained system efficiently and distinguish equilibrium residual, backward error and displacement error.
Lesson review: expert verification remains open
This lesson has received a full-context editorial review and a check of its technical explanations. Selected arithmetic has been checked separately. This is not independent engineering sign-off.
Checks needed for project use
- Independent numerical-analysis reviewer: sparse solvers, scaling, conditioning and production preconditioners. The implementation is a small SPD teaching chain.
- Actual browser zoom, screen-reader/additional-browser use and native-fullscreen visual rendering remain unqualified; see report.
These are educational models and exercises. Check their assumptions before using the results. The full technical content and every diagram have not yet been independently verified.
Concrete and steel calculations retain their stated first-generation Eurocode teaching basis. Use the standards and amendments specified for your project; do not mix generations without an appropriate design basis.
Read the lesson register and outstanding review notesBy the end of this lesson you should be able to
- Read compressed sparse row storage and implement a matrix–vector product
- Derive preconditioned conjugate-gradient updates for an SPD system
- Check true residual and known-solution error without confusing algebraic and modelling accuracy
What you should already know
- Assembly, partitioned constraints and matrix norms
- Positive definiteness and elastic energy
Decide which system is being solved
After prescribed movements have been eliminated, the remaining equations are Kff uf = ff − Kfc uc. For a stable, conservative elastic model with adequate restraints, this reduced stiffness is symmetric positive definite. Its energy is positive for every non-zero admissible movement. A free rigid mode, release mechanism or disconnected part removes that property.
Check the model before selecting a solver. Conjugate gradients requires the symmetric positive-definite case. A multiplier formulation can produce a symmetric indefinite system; friction and some coupled formulations can produce an unsymmetric one. Those need other methods. Artificial diagonal stiffness may hide a mechanism while introducing a new load path. It is not an acceptable unexplained repair.
For a direct SPD solve, a Cholesky factorisation K = LLᵀ gives two triangular solves. Sparse ordering can reduce fill-in, but the final factors usually contain more entries than the original matrix. A direct solver is not automatically cheap merely because its input is sparse.
Store connectivity instead of empty entries
Compressed sparse row storage uses a value array, its column-index array and a row-pointer array. Entries belonging to row i lie between row[i] and row[i+1]. Multiplication visits those entries only. The row pointers have n+1 entries; the last pointer equals the number of stored coefficients.
The laboratory chain has n free translations between two fixed ends. Spring i has stiffness c^(i/n), for i from zero to n. Row i has diagonal ki+ki+1 and neighbouring entries −ki and −ki+1 where those neighbours are free. There are 3n−2 stored entries. At n=16 this is 46 coefficients rather than 256, excluding the index-storage overhead. The routine stores both off-diagonals for clarity. It makes no timing or large-model memory claim.
We manufacture the load by multiplying this matrix by a chosen sine displacement. That provides a known solution for testing the algebra. It is a numerical benchmark, with a unit baseline spring stiffness, rather than a structural design example.
What it calculates: One preconditioned conjugate-gradient step; M is a positive-definite preconditioner, not the dynamics mass matrix.
Follow the iteration
Start from x=0, r=b, z=M⁻¹r and p=z. After updating x, update r by subtracting αAp. Reapply the preconditioner to obtain znew. Set β=(rnewᵀznew)/(rᵀz) and pnew=znew+βp. The search directions are conjugate in the A inner product in exact arithmetic. This property, rather than a simple steepest-descent direction at every step, allows finite termination within n steps in exact arithmetic.
Round-off breaks exact conjugacy. The teaching routine allows up to 4n iterations and recomputes b−Ax for its stopping check. It reports failure to reach tolerance rather than silently treating the last iterate as converged. The recursively updated residual can differ from the recomputed residual; this matters when judging a very small tolerance.
Jacobi preconditioning takes M=diag(A). Applying its inverse is a componentwise division. It can help when diagonal scales differ, but does not remove every difficult eigenvalue distribution. The laboratory lets you compare both choices. Neither the residual history nor its iteration count is guaranteed to improve monotonically as a parameter changes.
What it calculates: Normwise backward error and the condition-number bound on relative forward error, for non-zero exact solution and load.
Continue with solver comparisons and tolerance choices.
Sources and specialist review
Netlib’s Templates was inspected for CG, preconditioning and stopping-criterion context. The CSR chain, small-system derivation and conditioning example are original. Production-scale solvers, mixed-unit scaling and preconditioner selection require specialist review. The derivations, examples and teaching routines are original. Bounded numerical checks are recorded; independent specialist review of the formulation, applicability and educational treatment remains open. Download the analysis routines, together with their member and bar dependencies.