UNIHIVE

Study Hub UNIPORT MTH 492

MTH 492 · Numerical Methods

The finite element method

Weak form, linear elements, the stiffness matrix and a worked one-dimensional example.

Our notes

2 min read

The idea

Instead of approximating derivatives at points (finite differences), the finite element method (FEM) approximates the solution by simple pieces (elements) joined at nodes, chosen to make the error as small as possible in an average sense. It handles irregular shapes, varied materials and mixed boundary conditions well: the method behind structural, thermal and fluid software.

Step 1: the weak form

For −u″ = f on (0, 1), u(0) = u(1) = 0, multiply by a test function v (with v(0) = v(1) = 0) and integrate by parts:
∫₀¹ u′v′ dx = ∫₀¹ f v dx for all admissible v.
Only first derivatives remain: rougher (piecewise) functions are allowed.

Step 2: linear elements

Divide [0, 1] into elements of length h with nodes xᵢ. Use hat functions φᵢ: 1 at node i, 0 at the other nodes, linear in between. Approximate u ≈ Σ Uᵢφᵢ.

Step 3: Galerkin's choice

Take v = each φⱼ in turn. This gives KU = F:

  • Stiffness matrix: Kⱼᵢ = ∫ φⱼ′φᵢ′ dx. For equal linear elements: K = (1/h) × tridiag(−1, 2, −1).
  • Load vector: Fⱼ = ∫ f φⱼ dx. For f = 1: Fⱼ = h.

Element by element (assembly)

Each element contributes a 2 × 2 element stiffness matrix (1/h)[1 −1; −1 1]. Adding these into the global matrix at the right rows and columns gives K. This assembly is the same in 2D and 3D, which is why FEM programs are general.

Worked example

−u″ = 1, u(0) = u(1) = 0, four elements (h = 0.25). Exact u = x(1 − x)/2.

  1. K = 4 × [2 −1 0; −1 2 −1; 0 −1 2], F = (0.25, 0.25, 0.25)
  2. Equations: 8U₁ − 4U₂ = 0.25; −4U₁ + 8U₂ − 4U₃ = 0.25; −4U₂ + 8U₃ = 0.25
  3. By symmetry U₁ = U₃: 8U₁ − 4U₂ = 0.25 and −8U₁ + 8U₂ = 0.25. Adding twice the first to the second: 8U₁ = 0.75, U₁ = 0.09375, U₂ = 0.125.
xFEMExact
0.250.093750.09375
0.50.1250.125

In this 1D problem linear elements are exact at the nodes (between nodes the FEM solution is straight while the true one curves).

FEM against finite differences

Finite differencesFinite elements
Approximatesderivatives at pointsthe solution over elements
Geometryeasiest on rectanglesany shape (triangles, tetrahedra)
Boundary conditionsderivative ones need carenatural ones built in
TheoryTaylor seriesenergy and variational principles

Exams usually ask

  • Derive the weak form and the stiffness matrix for linear elements.
  • Solve a small 1D problem with 2 to 4 elements.

Common mistake

Forgetting the 1/h factor in the stiffness matrix, which scales every answer wrongly.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All MTH 492 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.