FEM2D_HEAT
Finite Element Solution in 2D
Time Dependent Heat Equation


FEM2D_HEAT is a C++ program, using double precision arithmetic, which solves the time-dependent 2D heat equation using the finite element method in space, and a method of lines in time with the backward Euler approximation for the time derivative.

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

        Ut - ( Uxx + Uyy ) = F(x,y,t)  in the box;
                  U(x,y,t) = G(x,y,t) for (x,y) on the boundary;
                  U(x,y,t) = H(x,y,t) for t = t_init.
      

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". Because quadratic basis functions are to be used, each triangle will be associated not only with the three corner nodes that defined it, but with three extra midside nodes. If we include these additional nodes, there are now a total of (2*NX-1)*(2*NY-1) nodes in the region.

We now assume that, at any fixed time b, the unknown function U(x,y,t) can be represented as a linear combination of the basis functions associated with each node. The value of U at the boundary nodes is obvious, so we concentrate on the NUNK interior nodes where U(x,y,t) is unknown. For each node I, we determine a basis function PHI(I)(x,y), and evaluate the following finite element integral:

        Integral ( Ux(x,y,t) * dPHIdx(I)(x,y) + dUdy(x,y,t) * dPHIdy(I)(x,y) ) =
        Integral ( F(x,y,t) * PHI(I)(x,y)
      

The time derivative is handled by the backward Euler approximation.

The program allows the user to supply two routines:

There are a few variables that are easy to manipulate. In particular, the user can change the variables NX and NY in the main program, to change the number of nodes and elements. The variables (XL,YB) and (XR,YT) define the location of the lower left and upper right corners of the rectangular region, and these can also be changed in a single place in the main program.

The program writes out a file containing an Encapsulated PostScript image of the nodes and elements, with numbers. Unfortunately, for values of NX and NY over 10, the plot is too cluttered to read. For lower values, however, it is a valuable map of what is going on in the geometry.

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.

Author:

Janet Peterson.

Related Data and Programs:

CONTOUR_SEQUENCE4 is a MATLAB program which can make contour plots of the sequence of solutions computed by FEM2D_HEAT.

FEM is a data directory which contains a description of the data files that can be used to describe a finite element model.

FEM_50 is a MATLAB finite element program in just 50 lines of code.

FEM_50_HEAT is a modified version of FEM_50 suitable for solving the heat equation.

FEM_BASIS_T3_DISPLAY is a MATLAB program which displays a basis function associated with a linear triangle ("T3") mesh.

FEM_BASIS_T6_DISPLAY is a MATLAB program which reads a quadratic triangle mesh and displays any associated basis function.

FEM_IO is a set of MATLAB routines for reading or writing the node, element and data files that define a finite element model.

FEM_SAMPLE is a C++ library of routines for evaluating a finite element function defined on an order 3 or order 6 triangulation.

FEM_TO_TEC is a MATLAB program that can convert an FEM model into a TEC graphics file.

FEM1D, is an executable C++ program which applies the finite element method, with piecewise linear basis functions, to a two point boundary value problem;

FEM1D_ADAPTIVE is a C++ program that applies the finite element method to a linear two point boundary value problem in a 1D region, using adaptive refinement to improve the solution.

FEM1D_NONLINEAR is a C++ program that applies the finite element method to a nonlinear two point boundary value problem in a 1D region.

FEM1D_PMETHOD is a C++ program that applies the p-method version of the finite element method to a linear two point boundary value problem in a 1D region.

FEM2D_HEAT is also available in a FORTRAN90 version and a MATLAB version.

FEM2D_POISSON is an executable C++ program for solving Poisson's equation on a triangulated square, using the finite element method.

FEMPACK is a C++ library of routines that may be useful in building a finite element application.

FREE_FEM_HEAT is a C++ executable program that solves the time dependent heat equation on an arbitrary triangulated region in 2D.

FREE_FEM_NAVIER_STOKES is a C++ executable program for solving the steady incompressible Navier Stokes equations in an arbitrary triangulated region, using the finite element method.

FREE_FEM_POISSON is a C++ executable program for solving Poisson's equation on a triangulated region, using the finite element method.

FREE_FEM_STOKES is a C++ executable program for solving the Stokes equations on a triangulated region, using the finite element method.

HOT_PIPE is a sample problem that can be run with FEM_50_HEAT.

HOT_POINT is a sample problem that can be run with FEM_50_HEAT.

PLTMG_SINGLE is a FORTRAN77 library of routines for solving elliptic partial differential equations using the finite element method with piecewise linear triangles and the multigrid approach.

TRIANGULATION_ORDER3 is a data directory which contains a description and examples of how an order 3 (linear) triangulation is defined by a node and element file.

TRIANGULATION_ORDER6 is a data directory which contains a description and examples of how an order 6 (quadratic) triangulation is defined by a node and element file.

TRIANGULATION_ORDER6_CONTOUR is a MATLAB script which can make contours of the solution.

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:

Examples and Tests:

Data files created by the program:

The MATLAB program CONTOUR_SEQUENCE4 can make contour plots from the sequence of solutions:

List of Routines:

You can go up one level to the C++ source codes.


Last revised on 18 October 2006.