FEM2D_POISSON_SPARSE
Finite Element Method applied to 2D Poisson Equation
Sparse Matrix Storage


FEM2D_POISSON_SPARSE is a MATLAB program which applies the finite element method to solve a form of Poisson's equation over an arbitrary triangulated two-dimensional region.

The linear system is created and stored using MATLAB's sparse matrix storage. The system is factored and solved by MATLAB, using sparse matrix solution techniques.

The geometry is entirely external to the program. The user specifies one file of nodal coordinates, and one file that describes the elements by indexing the node coordinates.

The program makes a default assumption that all boundary conditions correspond to Dirichlet boundary conditions. The user can adjust these boundary conditions (and even specify Dirichlet constraints on any variable at any node) by setting the appropriate data in certain user routines.

At the moment, Neumann conditions, if specified, must have a zero right hand side. The machinery to integrate a nonzero Neumann condition has not been set up yet.

Usage:

fem2d_poisson_sparse ( 'prefix' )
where 'prefix' is the common input filename prefix:

Computational Region

The computational region is unknown by the program. The user specifies it by preparing a file containing the coordinates of the nodes, and a file containing the indices of nodes that make up elements that form a triangulation of the region. For the following ridiculously small example:

        4----5
        |\   |\
        | \  | \
        |  \ |  \
        |   \|   \
        1----2----3
      
the node file would be:
         0.0 0.0
         1.0 0.0
         2.0 0.0
         0.0 1.0
         1.0 1.0
      
and the element file would be
        1 2 4
        5 4 2
        2 3 5
      

The program is set up to handle the linear Poisson equation with a right hand side function, and nonhomogeneous Dirichlet boundary conditions. The state variable U(X,Y) is then constrained by:

        - Del H(x,y) Del U(x,y) + K(x,y) * U(x,y) = F(x,y)  inside the region;
                                           U(x,y) = G(x,y)  on the boundary.
      

To specify the right hand side function F(x,y), the coefficient functions H(x,y) and K(x,y) and the boundary condition function G(x,y), the user has to supply routines:

The program is also able to write out a file containing the solution value at every node. This file may be used to create contour plots of the solution.

Licensing:

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

Languages:

FEM2D_POISSON_SPARSE is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

FEM2D_POISSON, a MATLAB program which solves Poisson's equation on a triangulated region, using the finite element method and a banded solver. In order to run, it requires user-supplied routines that define problem data.

FEM2D_POISSON_SPARSE_BAFFLE, a MATLAB library which defines the geometry of a rectangle channel containing 13 hexagonal baffles, as well as boundary conditions for a given Poisson problem, and is called by fem2d_poisson_sparse as part of a solution procedure.

FEM2D_POISSON_SPARSE_ELL, a MATLAB library which defines the geometry of an L-shaped region, as well as boundary conditions for a given Poisson problem, and is called by fem2d_poisson_sparse as part of a solution procedure.

FEM2D_POISSON_SPARSE_LAKE, a MATLAB library which defines the geometry of a lake-shaped region, as well as boundary conditions for a given Poisson problem, and is called by fem2d_poisson_sparse as part of a solution procedure.

MGMRES, a MATLAB library which applies the restarted Generalized Minimum Residual (GMRES) algorithm to solve a sparse linear system, by Lili Ju.

TRIANGULATION_ORDER3_CONTOUR, a MATLAB program which makes a contour plot of scattered data, or of data defined on an order 3 triangulation. In particular, it can display contour plots of scalar data output by fem2d_poisson or fem2d_poisson_sparse.

Reference:

  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:

List of Routines:

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


Last revised on 13 December 2012.