December 17, 2016

This Demonstration shows the finite element method (FEM) applied to the solution of the 1D Poisson equation. A capacitor with plates at a fixed distance ... with each plate held at potential ... and ... , respectively, is shown on the right. The 1D Poisson equation for the potential ... is ... , with the charge density ... between the plates in the range ... for simplicity. The solution ... over the entire domain ... is subject to the Dirichlet boundary conditions (BCs): ... and ... . In order to assess the validity of the approximate FEM solution, this Demonstration first computes the exact solution ... of the Poisson partial-differential equation (PDE) and related BCs with the built-in Mathematica command ... . The exact solution is plotted as a dashed blue line on the left together with the FEM solution. In a finite-element method, the domain on which the PDE is solved is split into several subdomains (or elements) and a trial solution is hypothesized for each element. Then those solutions are patched together. Finally, the parameters of the trial solution are adjusted to obtain a best fit to the exact solution. In particular, Galerkin's spectral decomposition is equivalent to a minimization of the integral of the difference between the approximate and exact solutions (it belongs to the class of weighted residual methods). For this 1D problem the subdomain elements are straight lines of equal length. The trial hat functions used in the linear expansion of the solution are linear interpolations between the solution values to be determined at the nodes ... . The next step is the assembly of the (sparse tridiagonal) stiffness matrix ... and the load vector ... with the proper elements accounting for the inclusion of Dirichlet BCs, since it can be demonstrated that these problems reduce to the solution of a linear system of equations ... , where the solution vector ... contains the expansion coefficients of the solution, which are the solution values at the nodes. One can notice that the elements in the stiffness matrix ... are combinations of inverse step sizes and independent of the charge density ... , whereas the elements in the load vector ... change for different ... 's, but the required integrals can be performed analytically or by other methods. This Demonstration shows how the relative error between FEM and analytical solution decreases as the number of elements increases. The error is computed as ... .