From Basis to Shape Functions
The discrete formulation requires choosing a basis for the space and assembling the stiffness matrix and load vector . In practice these global basis functions are not constructed directly; they emerge from simpler, locally defined functions called shape functions.
Partition into non-overlapping elements whose interiors are disjoint and whose union covers . On each element a small set of shape functions is defined, each supported entirely within . The global space is then assembled from these local pieces — either by identifying shape functions on adjacent elements along shared boundaries (as in the standard continuous Galerkin method) or by keeping them independent (as in the discontinuous Galerkin method). Either way, each global basis function has support on at most a small number of elements.
Since is bilinear, the stiffness matrix entry decomposes as
where denotes the restriction of to element . The contribution from is zero unless the supports of both and overlap with , which can only happen for nearby basis functions. This is the origin of the sparsity of the stiffness matrix. Assembly therefore proceeds element by element: for each one computes a small element stiffness matrix and scatters its entries into the global . The load vector is assembled the same way, each element contributing a small element load vector to .