Finite Element & Finite Volume Methods

a shape function

Think of building any silhouette out of a fixed set of cardboard tents, each tent standing over one peg and sloping down to zero at its neighbours. Slide each tent up or down by a chosen height, add them all up, and you can trace out a whole zigzag profile. In the finite element method the tents are shape functions: simple, local building blocks, one tied to each mesh node, and the approximate solution is just a weighted sum of them.

The classic example is the 1D 'hat' (or 'tent') function: phi_i(x) equals 1 at node i, falls linearly to 0 at the two neighbouring nodes, and is exactly zero everywhere else. Because phi_i is 1 at its own node and 0 at all others, the coefficient c_i in u_h = sum c_j phi_j is literally the solution's value at node i — the unknowns ARE the nodal values. The functions are LOCAL: each one is nonzero only over the one or two elements touching its node, so when you compute integrals like integral(phi_i' phi_j') most pairs give zero, and the stiffness matrix comes out sparse. Higher-order shape functions (quadratics, cubics) add extra nodes on edges and interiors to capture curvature; in 2D and 3D the same idea gives pyramids over triangles, tetrahedra, or quadrilaterals.

Shape functions are where 'finite element' gets its name — the mesh is cut into elements, and on each element the solution is a low-degree polynomial stitched continuously to its neighbours. The honest trade-off is approximation power versus cost: linear hats are cheap and robust but converge only at O(h^2) in the energy-squared sense; richer polynomials converge faster on smooth solutions but cost more per element and can misbehave near corners or discontinuities, where refining the mesh (smaller h) is often safer than raising the polynomial degree.

On nodes at x = 0, 0.5, 1, the hat function for the middle node is phi(x) = 2x on [0,0.5] and 2 - 2x on [0.5,1], zero outside. Then u_h(x) = c1 phi_1 + c2 phi_2 + c3 phi_3 is piecewise linear, with u_h(0.5) = c2 exactly — the coefficient equals the nodal value.

Each hat is 1 at its own node and 0 at all others, so coefficients are nodal values.

Locality is the whole point: because each shape function overlaps only its few neighbours, the stiffness and mass matrices are sparse. Global polynomials over the whole domain would couple every node to every other and lose that sparsity entirely.

Also called
basis functioninterpolation functionhat functiontent function基函數帽函數插值函數