 # Finite Element Solution of 1D Poisson Equation with Galerkin Spectral Decomposition

Initializing live version Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

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 .

[more]

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 DSolve. 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 .

[less]

Contributed by: Jessica Alfonsi (University of Padova, Italy) (March 2011)
Open content licensed under CC BY-NC-SA

## Snapshots   ## Details

The Mathematica program here has been adapted and extended from the Java code LaplaceFEM.java in the following book:

R. H. Landau, M. J. Paez, and C. C. Bordeianu, A Survey of Computational Physics, Princeton: Princeton University Press, 2008.

A standard reference for the basics of the finite-element method applied to electromagnetics is, for instance:

J. Jin, The Finite Element Method in Electromagnetics, 2nd. ed., New York: John Wiley and Sons, 2002.

## Permanent Citation

Jessica Alfonsi (University of Padova, Italy)

 Feedback (field required) Email (field required) Name Occupation Organization Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback. Send