Numerical Methods
Finite Element Method
Every Boeing part undergoes FEM simulation before manufacturing. Coronary stents are FEM-tested under various blood pressures. The iPhone chassis is FEM-optimized for minimum weight. FEM is the language of engineering design.
- **Structural analysis in ANSYS/ABAQUS:** FEM for stresses and deformations in 3D parts; stiffness matrices with millions of DOFs
- **FEniCS in research:** open-source; Python API; used in academic fluid dynamics and biomechanics
- **Electromagnetic simulation:** Maxwell's equations via FEM; ANSYS HFSS, OpenEMS for antennas and ICs
Предварительные знания
Weak Formulation
The finite element method (FEM) starts from the **weak (variational) formulation** of a PDE. Instead of requiring the equation at every point (strong form), we require it to hold 'on average' against a set of test functions. This allows irregular meshes, discontinuous coefficients, and natural boundary conditions.
**Weak formulation of Poisson's equation:** Strong form: −∇·(k∇u) = f, u|_{∂Ω} = 0 Multiply by test function v and integrate over Ω: ∫_Ω k∇u·∇v dΩ = ∫_Ω f·v dΩ for all v ∈ H₀¹(Ω) (integration by parts removes the second derivative!) **Advantages:** - Requires less smoothness (H¹ instead of H²) - Naturally includes Neumann boundary conditions - Handles discontinuous coefficients k(x)
The key insight: integration by parts shifts the derivative from the unknown u onto the test function v. This symmetrizes the problem (stiffness matrix is symmetric for self-adjoint operators) and reduces smoothness requirements.
Why does FEM use the weak (integral) formulation rather than the strong form?
Galerkin Method and Matrix Assembly
The Galerkin method approximates u as a finite sum of basis functions φᵢ: u_h = Σᵢ uᵢ·φᵢ. Substituting into the weak form with test functions v = φⱼ yields the system Ku = f, where Kᵢⱼ = ∫ k∇φᵢ·∇φⱼ dΩ is the stiffness matrix.
**Stiffness matrix and load vector:** Kᵢⱼ = ∫_Ω k·∇φᵢ·∇φⱼ dΩ ← stiffness matrix fᵢ = ∫_Ω f·φᵢ dΩ ← load vector **Local-to-global assembly:** 1. For each element Ωₑ: compute K_local and f_local 2. Scatter into global K and f using the DOF table **Basis functions φᵢ:** - P1 (linear): φᵢ = 1 at node i, 0 at others - P2 (quadratic): parabolic interpolation - Higher order: hp-FEM
Why is the FEM stiffness matrix K sparse?
FEniCS and Applications
FEniCS/FEniCSx is an open-source FEM platform that allows formulating PDEs mathematically and automatically generating optimized code for matrix assembly and solving. Used in aerospace engineering, biomechanics, and electromagnetics.
| Method | Mesh | Order | Application |
|---|---|---|---|
| FD (FDM) | Regular | O(h²) | Rectangular domains, images |
| FEM P1 | Triangular/tetrahedral | O(h²) | Complex geometries |
| FEM P2 | Triangular | O(h⁴) | High accuracy |
| hp-FEM | Adaptive | Exponential | Singularities, precision |
| FVM | Polygonal | O(h²) | Computational fluid dynamics |
What is the main advantage of FEM over FD for problems with complex geometry?
Key Ideas
- **Weak form:** integration by parts reduces smoothness requirements; natural boundary conditions included automatically
- **Galerkin method:** u = Σ uᵢφᵢ → system Ku = f; Kᵢⱼ = ∫k∇φᵢ·∇φⱼ
- **Sparsity of K:** Kᵢⱼ ≠ 0 only for neighboring nodes; O(n) nonzeros for P1
- **FEniCS:** Python API for automatic assembly and solving; solve(a == L, u, bc)
Related Topics
FEM combines PDEs, linear algebra, and numerical methods:
- Finite Difference Methods for PDEs — FD is a special case of FEM on regular grids; the same sparse linear systems arise
- Sparse Matrices — The stiffness matrix K is sparse; CSR/CSC storage and iterative solvers are mandatory
Вопросы для размышления
- Why does P2 FEM (quadratic elements) give O(h⁴) accuracy instead of O(h²) for P1?
- How is a Neumann boundary condition (specified flux) naturally incorporated into the weak formulation?
- What is hp-adaptivity in FEM and when is it preferred over uniform mesh refinement?