2026 2NM4 Week 10 - Finite element method
Overview
The lecture develops the finite element method (FEM) from its motivation in boundary-value problems through weighted residuals, Gaussian quadrature, Galerkin testing, weak forms, and sparse matrix assembly. A one-dimensional heat equation example connects these ideas to backward Euler time stepping, mass and stiffness matrices, and the practical assembly and nonlinear-solver workflows used by COMSOL and ANSYS.
Key takeaways
- FEM accommodates complex geometry and locally varying resolution because its integral formulation does not depend on a uniformly spaced grid.
- The method of weighted residuals replaces pointwise exact satisfaction with a condition that the residual integrates to zero against selected test functions.
- The Galerkin method uses the same shape functions for the approximate solution and test functions, connecting the approximation choice directly to the assembled system.
- Integration by parts converts second spatial derivatives into first-derivative integrals and boundary terms, allowing piecewise-linear approximations that may not satisfy the strong form pointwise.
- Local support of element shape functions makes most global matrix entries zero, producing sparse mass and stiffness matrices.
- Backward Euler time stepping combined with Galerkin FEM yields a linear system for linear heat equations, while nonlinear equations require a nonlinear root-finding method.
Chapters
- Many time-dependent PDE workflows solve a spatial boundary-value problem at each time step, then advance the solution through time.
- Solving for all of space-time at once is possible in principle, but creates a more complex problem than ordinary time marching.
- Physics-informed neural networks can approximate a space-time solution without explicitly stepping through t0, t1, and t2.
- The heat equation follows from conservation: the net flux into a control volume equals its energy accumulation.
- For constant thermal conductivity, the divergence of the conductive flux reduces in 1D to a second spatial derivative of temperature.
- When conductivity depends on temperature, it remains inside the spatial derivative, so applying the chain rule matters before discretization.
- Forward Euler uses the current temperature profile to calculate the next time step directly.
- For stiff diffusion problems, explicit stepping can produce spurious high-frequency oscillations that grow and destabilize the solution.
- Reducing the time step can restore stability, but the allowable step is tied to spatial resolution and can become very small.
- Backward Euler evaluates the spatial operator at the unknown future time, coupling neighboring future temperatures.
- The resulting update is a system of equations rather than an independent pointwise calculation.
- The lecture characterizes backward Euler as unconditionally stable, while emphasizing that stability alone does not guarantee an accurate answer.
- Crank-Nicolson averages information from the current and future time levels, giving second-order accuracy in time.
- Its implicit matrix has the same basic sparsity pattern as backward Euler, while known current-time terms contribute to the right-hand-side vector.
- The method is unconditionally stable but can preserve and damp oscillations because it includes information from the explicit side.
- A 1D explicit Euler update produces an identity matrix for the future unknowns, making the update especially cheap to calculate.
- Backward Euler couples each interior node to itself and its neighbors, producing a tridiagonal matrix in 1D.
- Crank-Nicolson keeps a similar sparse matrix structure, with additional known-value calculations placed in the right-hand side.
- Finite difference approximates derivatives with local stencils, whereas FEM is built around integral formulations.
- Integral methods are less sensitive to small numerical wiggles than numerical differentiation, which can amplify them into large gradients.
- FEM supports complex boundaries, locally refined meshes, and material properties that vary across the domain.
- The example uses the ODE u′ = −u on the interval from 0 to 1, with the boundary value u(0) = 1.
- The exact solution is exponential, but the first approximation is a straight line whose unknown endpoint value determines its slope.
- A finite-difference-style endpoint equation gives a simple line, illustrating how a coarse approximation can miss the curve.
- The residual is formed by moving the ODE terms to one side after substituting the proposed linear solution.
- Squaring the residual prevents positive and negative errors from canceling; integrating it measures error across the full interval.
- Minimizing the integrated squared residual gives a better-fit line, but symbolic expansion, integration, and differentiation become cumbersome at scale.
- The method of weighted residuals multiplies the residual by a chosen test function and requires its domain integral to equal zero.
- The test function provides flexibility in how approximation error is measured, without explicitly squaring and minimizing the residual.
- For the decay example, choosing a simple test function yields a tractable integral and an endpoint estimate close to the least-squares result.
- Gaussian quadrature replaces symbolic integration with a weighted sum of integrand evaluations at selected points.
- The lecture maps the standard interval from −1 to 1 onto the problem interval from 0 to 1, accounting for the coordinate transformation with a Jacobian factor.
- A two-point Gaussian rule integrates polynomials through cubic order exactly, allowing the example’s weighted residual integral to be evaluated without symbolic algebra.
- A differential equation is expressed abstractly as a linear operator applied to an unknown function, set equal to a source term.
- The residual is the operator result minus the source; it vanishes for an exact solution and remains nonzero for an approximation.
- The approximate solution is represented as a weighted sum of basis or shape functions, with scalar weights passing through linear differentiation.
- A Dirac-delta test function reduces the weighted-residual integral to the residual evaluated at a point, producing a collocation method.
- The Galerkin method sets the test functions equal to the shape functions used to approximate the solution.
- Using the same basis for trial and test functions supports symmetry in the resulting system and helps produce useful sparsity.
- FEM breaks a domain into connected finite elements, commonly triangles in 2D and tetrahedra in 3D.
- A mesh must cover the domain without gaps and avoid degenerate, extremely narrow elements that poorly represent the geometry.
- Local refinement places smaller elements near features such as a pipe wall while retaining coarser elements where the solution varies less.
- A line can be specified by endpoint values, other point values, or a point and slope; finite elements generalize these choices to each element.
- Nodes are mesh connection points, while degrees of freedom can represent function values, gradients, or other quantities.
- The selected degrees of freedom determine how neighboring elements connect and which integration scheme is appropriate.
- Lagrange elements use polynomial shape functions, with order zero representing constants and order one representing linear interpolation.
- A second-order element uses three interpolation points, including an interior point, to represent a quadratic within the element.
- Lagrange basis functions are convenient because each is one at its associated node and zero at the other interpolation nodes.
- Sharing endpoint values between adjacent linear elements gives continuity of the function, but does not generally make the derivative continuous.
- Elements specified using independent interior information can be discontinuous at their shared boundary.
- The lecture identifies discontinuous Galerkin methods as useful in computational fluid dynamics when transported quantities make continuity constraints challenging.
- First-order Lagrange basis functions form tent-shaped profiles that are nonzero near their associated nodes.
- Gaussian quadrature extends from 1D intervals to 2D and 3D elements by using element-specific points and weights.
- Specialized element families support fields involving operators such as gradient, divergence, and curl, especially in electromagnetism.
- The strong form of steady heat conduction contains a second spatial derivative and therefore requires sufficient smoothness in the solution.
- A piecewise-linear approximation has derivative changes at element boundaries, so it may not satisfy the strong form pointwise.
- The weak form instead seeks the best weighted fit within the chosen approximation space, allowing piecewise-linear solutions.
- The equation is multiplied by a test function and integrated over the spatial domain.
- Integration by parts, equivalently connected to Green’s or the divergence theorem, moves one derivative from the solution or flux onto the test function.
- This converts a second-derivative problem into integrals involving first derivatives, reducing the smoothness required of the approximate solution.
- A Dirichlet condition fixes the function value, while a Neumann condition specifies flux and can enter through a boundary integral.
- The weak form can include surface effects directly, which is useful when important physics is concentrated at a boundary.
- Because the derivative is no longer applied directly to the flux, temperature-dependent conductivity can be handled without differentiating that material property in the same way as the strong form.
- The approximate temperature and test function are expanded as sums of shape functions weighted by unknown coefficients.
- Each shape function is nonzero only on the elements it belongs to, a property called small support.
- Small support means distant degrees of freedom do not interact directly, producing sparse matrices suitable for efficient solution.
- Galerkin substitution moves the unknown weights outside the integrals and leaves integrals of pairs of shape functions.
- The resulting shape-function products define the mass matrix; products of their gradients define the stiffness matrix.
- The weak form is assembled into a matrix equation, with sparsity arising from local element support.
- Commercial finite-element tools such as COMSOL and ANSYS automate much of the weak-form implementation and matrix assembly.
- Assembly can consume substantial computation because element-level contributions must be combined into global matrices.
- The lecturer recommends understanding the weak form before attempting custom assembly, which is a deeper optimization task.
- The worked problem uses a 1D heat equation with thermal conductivity, an initial temperature field, and boundary conditions.
- The test function is multiplied through the equation before integration over the spatial interval.
- Integration by parts handles the flux-divergence term and begins converting the strong equation into its weak form.
- Backward Euler introduces the time derivative using the current and previous time levels before the Galerkin expansions are substituted.
- Choosing linear Lagrange elements supplies the element-level matrix contributions, which assemble into a sparse system for the unknown temperature coefficients.
- A linear PDE leads to a linear system; nonlinear material behavior instead requires a nonlinear root finder after the weak-form derivation.
Transcript excerpt
0:00 um explicit oiler. So all this is to do with uh partial differential equations. Technically PTE include like any kind of mixed derivatives. So technically two-dimensional boundary value problems are a PTE but honestly like whenever somebody talks about PDS they're talking about time stepping time and space. The way that you approach it is you do a boundary value problem for your spatial domain and then you need some kind of time marching. The idea there is that you solve for something and then you use that information or you you you use your boundary value problem on top of like some kind of time stepping routine. Um that is not a universal case anymore. That's been the way that it's been done uh previously. Um yeah, this is kind of
0:49 this is kind of weird and it's a bit of an advanced topic, but we have time so let's do it. Um, previously people were doing things like, okay, you have time and space. You're going to separate out space. Space is a boundary value problem. You're going to solve for that and then you're going to march in time. You're going to progress that in time. You could imagine your your space is say one-dimensional, your time is another dimension, right? There is a solution in both space and time. Typically what you would do is you would solve for your space and then propagate march march march march march. There's nothing stopping you from a theoretical standpoint of solving all of space time
1:37 at once. You could do it. It's not so easy because now you have additional complexities. You don't just have like you're you're kind of making a more complicated problem out of an easier one. Um I want to say method of lines is
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Numerical Methods for Engineering.