All courses › Finite Element Method
Finite Element Method (FEM): free practice, theory and problems
The finite element method (FEM) solves complicated structural problems by dividing a structure into many small, simple elements for which the relationship between forces and displacements is known exactly. The bar element (1D, axial) is the simplest element and shows the core idea: each element has a stiffness matrix that relates nodal displacements to nodal forces, and these are assembled into a global system of equations for the whole structure.
Contents
1. Bar elements and stiffness matrices
What is it about?
The finite element method (FEM) solves complicated structural problems by dividing a structure into many small, simple elements for which the relationship between forces and displacements is known exactly. The bar element (1D, axial) is the simplest element and shows the core idea: each element has a stiffness matrix that relates nodal displacements to nodal forces, and these are assembled into a global system of equations for the whole structure.
In short
- The stiffness matrix of a bar element: where is the elastic modulus, the cross-sectional area and the element length.
- The element equation: , where are the nodal displacements and the nodal forces.
- Global assembly: the element matrices are inserted into a global matrix according to the global degrees of freedom (DOFs) of their nodes. Nodes shared by several elements receive contributions from all of them.
- The global system is singular (not invertible) before boundary conditions are applied, because otherwise the structure could move freely as a rigid body.
- Boundary conditions (e.g. a fixed node, ) are removed from the system before solving for the unknown displacements; the reaction forces at the fixed nodes can then be computed afterward.
- The stiffness matrix is symmetric (Maxwell–Betti reciprocity theorem) and usually sparse, because each node is only connected to its nearest neighbours.
- The stress in an element is computed afterward from the displacements: .
The bar problem: what we are actually solving
Think of the bar as a long spring. It is fixed at the left end (), pulled by a load distributed along its whole length (, in N/m – for example self-weight) and by a point load at the right end (). The question is: how far does each point move? The answer is the displacement field .
Three simple relations give the whole theory:
- Kinematics – the strain is how fast the displacement changes along the bar: .
- Material (Hooke's law) – the stress is proportional to the strain: .
- Equilibrium – look at a small piece : the normal force on each side and the load must cancel, , so .
Combining 1 and 2 gives the normal force . Inserting into 3 gives the differential equation of the bar.
Strong form
with the boundary conditions
- – the bar is fixed. This is an essential boundary condition: it says something about itself.
- – the force at the end. This is a natural boundary condition: it says something about , i.e. about the force.
With constant , a uniform load and a point load we can solve directly:
The normal force is largest at the support, where the whole load must be carried.
Total potential energy
The finite element method is not built directly on the differential equation but on energy. The bar "chooses" the displacement that makes the total potential energy smallest:
- The first term is the strain energy stored in the bar (like in a spring).
- The last two terms are the potential of the loads: a load loses potential energy when it moves in its own direction.
With the ** inner product** it gets shorter: .
The principle of minimum potential energy: of all displacements satisfying , the correct one gives the smallest . How to find the minimum of such a "function of a function" is in the unit on the weak form (Gateaux derivative).
From a continuous bar to springs
Split the bar into elements of length . Inside each element we let vary linearly between the two nodal values. Then the strain is constant, , and the normal force is . Each element behaves like a spring with stiffness :
The load vector says that a uniform load on the element is shared equally between the two nodes. Both come from the integrals and (see the weak form).
Assembly step by step
- Number the nodes and the elements . Element connects nodes and . An element table says which global nodes each element uses.
- Start with a global matrix and a load vector full of zeros.
- For each element: add the four numbers of into the rows and columns of the element's two nodes, and add into the same rows of . Where two elements share a node, the contributions are summed.
- Add point loads straight into (here at the last node).
- Impose the boundary condition : delete row and column 0. Only now is non-singular.
- Solve . Compute the normal force in each element, , and the reaction from the row you deleted.
Example – two elements, uniform load and point load
A bar with kN and m is fixed at . It carries a uniform load kN/m and a point load kN at the end. We use two elements with m.
- Each element: kN/m and kN.
- Global (nodes 0, 1, 2): and . Node 1 gets load from both elements (), node 2 gets plus the point load .
- Delete node 0: .
- The second row gives . Into the first row: , so m and m.
- Normal forces: kN and kN. The reaction: row 0 gives , so kN – exactly the whole load kN, in the opposite direction.
- Check against the exact solution: and . The nodal values are exact, and the element forces and kN equal the exact at the middle of each element.
How to solve the problems
- Set up the stiffness (or the given spring stiffness ) for each element.
- Assemble: insert the element contributions into the correct rows/columns of the global matrix according to the node numbers.
- Apply the boundary conditions (remove rows/columns for fixed degrees of freedom, or set them to a known value).
- Solve for the unknown displacements.
- Compute stress/strain and, if needed, reaction forces from the displacements.
Example
Two bar elements in series: element 1 has N/mm, element 2 has N/mm. Node 1 is fixed, and a force of 600 N acts at node 3 (the free end). Find .
- The degree of freedom at node 1 is removed ().
- The force at node 3 is transmitted through both elements in series, so the displacements add: .
- mm.
Common mistakes
- Forgetting to remove the boundary conditions before solving the system (the matrix is then singular and cannot be inverted).
- Adding element contributions to the wrong place during assembly – always check the node numbers.
- Mixing units, e.g. GPa and mm² without converting to N/mm² (MPa).
- Assuming a stiffer element (higher ) means more displacement – it is the opposite.
Concepts in this part
2. Weak form and shape functions
What is it about?
To apply the finite element method to problems governed by differential equations (e.g. axial elasticity or heat conduction), we recast the "strong form" (the differential equation itself, which requires the solution to be smooth enough to differentiate twice) into a "weak form" by multiplying by a test function and integrating by parts. This lowers the smoothness requirement and is exactly what makes it possible to use simple, piecewise-linear shape functions within each element.
In short
- Shape functions interpolate the solution inside the element from the nodal values: . For a linear element on : , .
- The shape functions satisfy the Kronecker delta property (1 at their own node, 0 at the others) and form a partition of unity ( everywhere), so the element can reproduce a constant (rigid-body) displacement exactly.
- Galerkin's method chooses the test functions from the same space as the shape functions – standard FEM is therefore Bubnov–Galerkin.
- Essential (Dirichlet) boundary conditions are imposed directly on the unknowns (e.g. ); natural (Neumann) boundary conditions (force, flux) enter automatically through the boundary term produced by integration by parts.
- Isoparametric elements use the same shape functions to describe both geometry and displacement. The mapping from a reference element (e.g. ) to the physical element is governed by the Jacobian , which scales integrals between the two.
- Gauss quadrature evaluates integrals numerically with only a few points: points integrate polynomials exactly up to degree . 2-point Gauss (at , weight 1 each) is therefore exact up to and including degree 3.
The Gateaux derivative: when the energy is a function of a function
From mathematics you know the derivative: , and you find a minimum where .
The energy takes a whole function , not a number. We can still ask: *how much does change if we nudge the displacement a little in a direction ?* That is the Gateaux derivative (directional derivative):
Here is the "point" we stand at, is the direction (a variation or test function) and is a small number. The direction must satisfy , otherwise we would push the bar off its support.
Worked out for the bar
Insert into :
Expand the square, , and collect powers of :
Subtract , divide by and let . The last term vanishes:
A minimum means zero in every direction
At a minimum no small change can lower the energy. So for all admissible . That is the weak form:
- is bilinear (linear in each argument) and symmetric, . is linear.
- The energy can be written – just like for a spring, whose minimum gives .
- It really is a minimum: when solves the weak form, the computation above shows for all .
From strong to weak form – and back
You get the same result without energy. Multiply the strong form by a test function , integrate over the bar and integrate the left side by parts:
The boundary term: at we have , and at we have . This gives – the same weak form.
The way back shows why the natural boundary condition "comes for free". Integrating by parts backwards gives
Both brackets must then be zero: the differential equation and the force condition at the end. The essential condition , on the other hand, must be built into the function space.
- The weak form only needs to be square integrable (the space ), not to exist. That is why we can use piecewise linear functions with kinks at the nodes.
Galerkin's method
We cannot try every function, so we pick a finite set: basis functions with , and look for
Galerkin: use the same functions as test functions, for . Into the weak form:
- With hat functions (1 at their own node, 0 at all others, linear in between) is exactly the displacement at node .
- Two hat functions only overlap when their nodes are neighbours, so is tridiagonal – cheap to solve even with millions of unknowns.
- is symmetric because is symmetric, and positive definite because for all .
The master element and the Jacobian
Instead of integrating over each physical element of length , we do everything on one master element and map. Linear shape functions on the master element:
The mapping uses the same functions (isoparametric):
Two rules do the rest:
- Integrals: , so .
- Derivatives: the chain rule gives . For linear elements and .
The element matrix
With constant and , we get , and likewise for the others:
The element vector
- Uniform load : , so .
- A load varying linearly from to over the element: – the heavier end gets more.
Quadratic elements
With three nodes ():
The same recipe (remember ) gives
Note that a uniform load is not shared equally: the middle node gets of the load.
Gauss quadrature on the master element
When or varies, we evaluate the integrals numerically: .
- 1 point: , – exact for polynomials of degree .
- 2 points: , – exact for degree .
- In general points are exact up to degree .
Example – the Gateaux derivative of a simple functional
Let with . Find the weak and the strong form.
- .
- So . Weak form: for all with .
- Integration by parts (the boundary term is zero because at both ends): for all , so .
- The solution is . Check: and .
How to solve the problems
- Identify whether you need to interpolate a value (), evaluate a shape function at a point, or integrate numerically.
- For interpolation: find the correct (normalized position) and substitute into .
- For Gauss quadrature: substitute the quadrature points into the integrand, multiply by the weights and sum.
- Remember the Jacobian when switching from physical coordinates to reference coordinates in an integral.
Example
Use 2-point Gauss quadrature (, weight 1 each) to evaluate .
- , and is the same since is unchanged.
- The sum: .
- Check: the exact value is – since the integrand has degree 2 (), 2-point Gauss is exact.
Common mistakes
- Mixing up the conventions (shape functions) and (Gauss quadrature) – always check which interval the problem uses.
- Assuming more Gauss points always give a "more correct" answer than needed – for a low-degree polynomial, few points are exact.
- Forgetting the Jacobian when integrating over the reference element.
- Assuming natural and essential boundary conditions are treated the same way in the weak form.
Concepts in this part
3. Element types, meshing and error
What is it about?
Choosing the right element type and building a good mesh (network of elements) is crucial for whether an FEM analysis gives an accurate and trustworthy answer. This unit covers what element types exist, how a mesh is refined, what sources of error exist, and how to check that a model is correct.
In short
- Element types: CST (constant strain triangle, linear triangle) gives constant strain/stress throughout the element and needs a fine mesh where the stress varies a lot. Quadratic elements (e.g. LST) give better accuracy per element. Elements have different numbers of degrees of freedom per node depending on type (e.g. 2 for a 2D bar, 3 for a 2D beam, 6 for a 3D beam).
- h-refinement: makes the elements smaller (more elements). p-refinement: increases the polynomial degree of the shape functions in the existing elements. Both give convergence toward the exact solution.
- Displacements are continuous between elements in standard displacement-based FEM, but stresses are not – they often jump slightly between elements and are smoothed in post-processing.
- The displacement error typically decreases as as the element size shrinks, for elements of polynomial degree . Halving makes the error times smaller.
- Shear locking: linear elements can become artificially stiff in bending. This is solved with quadratic elements or reduced integration.
- At sharp interior corners, the stress is theoretically infinite (a singularity); the stress in the model then just keeps growing as the mesh is refined, instead of converging. The fix is to model a real fillet radius.
- A mesh convergence study refines the mesh step by step and checks whether a quantity of interest (e.g. maximum stress) stops changing significantly – that is how you know the mesh is fine enough.
How good is the FEM solution?
In short: Galerkin finds the best solution possible with the functions you have given it – measured in energy. More or better elements give a better set to choose from.
Galerkin orthogonality
The exact solution satisfies for all , including functions in the element space. The FEM solution satisfies . Subtract:
The error is "perpendicular" to the whole element space, measured with .
Best approximation in the energy norm
The energy norm is – the square root of twice the strain energy. Orthogonality gives
No other function in the element space is closer to the exact solution, measured in energy (Céa's lemma for symmetric problems).
FEM is too stiff
For any admissible we have . With :
So FEM always gives too high a potential energy. That means the work of the loads is too small: the model is too stiff, and the displacements are on average too small. More elements make the model softer and closer to the true answer.
Rate of convergence
For elements of degree , element size and a smooth exact solution:
- the energy error (and stress error):
- the displacement error in :
Halving with linear elements () halves the energy error and makes the displacement error about a quarter. With quadratic elements () they become a quarter and an eighth.
How to check a model
- Run with a coarse mesh, halve the element size and compare. If the result barely changes, it has converged.
- Check equilibrium: the sum of the reaction forces must equal the sum of the loads.
- Look for stress peaks at sharp re-entrant corners. They are singularities of the model and grow as the mesh is refined – model a real radius instead.
How to solve the problems
- Identify which error source or element property the question concerns: element type, refinement, continuity, or singularity.
- For DOF counting: multiply the number of nodes by the degrees of freedom per node for the element type.
- For convergence: use to compute how much smaller the error becomes when changes.
- Remember that the mesh should be finest where the stress gradients are largest, not spread evenly everywhere.
Example
A model with 3D beam elements (6 degrees of freedom per node) has 25 nodes. The displacement error scales as (linear elements, ). How many degrees of freedom does the model have, and by what factor does the error shrink if is divided by 2?
- Degrees of freedom: .
- Error factor: times smaller error.
Common mistakes
- Assuming stresses are continuous between elements the way displacements are.
- Assuming a finer mesh always helps at a sharp corner – there the stress is singular and never "converges" in the model.
- Forgetting to multiply by the degrees of freedom per node when counting DOFs.
- Confusing h- and p-refinement.
Concepts in this part
Example problems with solutions
Here are some of the problems in finite Element Method. In the app, calculation problems get new numbers every time, so you can practise until it sticks – and take a practice exam with an indicative grade as you prepare for the exam.
Bar elements and stiffness matrices: What is the stiffness matrix of a linear bar element (1D)?
Answer:
It is symmetric, and singular for a single element on its own.
Weak form and shape functions: What do you gain by rewriting to the weak form?
Answer: Lower differentiability requirements: one derivative is moved onto the test function
You integrate by parts.
Element types, meshing and error: What characterizes a CST element (linear triangle)?
Answer: Constant strain and stress in the whole element
It needs a fine mesh where stress gradients are large.
Bar elements and stiffness matrices: Why is the global stiffness matrix singular before the boundary conditions are applied?
Answer: The structure can move as a rigid body
Enough degrees of freedom must be locked to prevent rigid-body motion.
Matches these university courses
The content follows the syllabus found in, for example:
- TMM4135 (NTNU)
- TBM350 (NMBU)