Finite Element Solution of the 2D Poisson Equation

FEM2D_POISSON_RECTANGLE_LINEAR is a FORTRAN77 program which solves the 2D Poisson equation using the finite element method with piecewise linear triangular elements.

The computational region is a rectangle, with Dirichlet boundary conditions applied along the boundary. The state variable U(X,Y) is then constrained by:

        - ( Uxx + Uyy ) = F(x,y)  in the region
                 U(x,y) = G(x,y)  on the region boundary

The computational region is first covered with an NX by NY rectangular array of points, creating (NX-1)*(NY-1) subrectangles. Each subrectangle is divided into two triangles, creating a total of 2*(NX-1)*(NY-1) geometric "elements".

We now assume that the unknown function U(x,y) can be represented as a linear combination of the basis functions associated with each node. For each node I, we determine a basis function PHI(I)(x,y), and evaluate the following finite element integral:

        Integral ( Ux(x,y) * PHIx(I)(x,y) + Uy(x,y) * PHIy(I)(x,y) ) =
        Integral ( F(x,y) * PHI(I)(x,y)
The set of all such equations yields a linear system for the coefficients of the representation of U.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


FEM2D_POISSON_RECTANGLE_LINEAR is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

FEM2D_POISSON_RECTANGLE, a FORTRAN77 program which solves the 2D Poisson equation on a rectangle, using the finite element method, and piecewise quadratic triangular elements.


  1. Hans Rudolf Schwarz,
    Finite Element Methods,
    Academic Press, 1988,
    ISBN: 0126330107,
    LC: TA347.F5.S3313.
  2. Gilbert Strang, George Fix,
    An Analysis of the Finite Element Method,
    Cambridge, 1973,
    ISBN: 096140888X,
    LC: TA335.S77.
  3. Olgierd Zienkiewicz,
    The Finite Element Method,
    Sixth Edition,
    Butterworth-Heinemann, 2005,
    ISBN: 0750663200,
    LC: TA640.2.Z54

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the FORTRAN77 source codes.

Last revised on 05 January 2011.