fem2d_project_function


fem2d_project_function, a C++ code which projects a function W(X,Y), given as a formula, into a given finite element method (FEM) space of piecewise linear triangular elements.

The result is that the function W(x,y) is approximated by a finite element function U(x,y) formed using piecewise linear triangular elements.

The computational region is a rectangle, which is divided up into a mesh of triangles using a grid of NX by NY points. For node K at grid point (I,J) in the interior, the associated basis function Vk(x,y) is used to pose the equation:

        Integral U(x,y) Vk(x,y) dx = Integral W(x,y) Vk(x,y) dx
      
while, for node K at grid point (I,J) on the boundary, the associated degree of freedom is determined by the boundary condition
        U(x,y) = W(x,y),
      

The conditions define a linear system for the coefficients Uk in the finite element expansion of U(x,y):

        U(x,y) = sum ( 1 <= K <= M*N ) Uk * Vk(x,y)
      

The program computes these coefficients, compares U and W pointwise at the nodes, and computes the L2 norms of U, W and U-W.

Licensing:

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

Languages:

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

Related Data and Programs:

FEM1D_PROJECT, a C++ code which projects data into a finite element space, including the least squares approximation of data, or the projection of a finite element solution from one mesh to another.

FEM2D, a data directory which contains examples of 2D FEM files, three text files that describe a 2D finite element geometry;

FEM2D_HEAT, a C++ code which solves the time dependent heat equation in the unit square.

FEM2D_PACK, a C++ code which includes utitlies for 2D finite element calculations.

fem2d_poisson_rectangle_linear, a C++ code which solves the 2D Poisson equation on a rectangle, using the finite element method, and piecewise quadratic triangular elements.

FEM2D_PROJECT, a C++ code which projects a function F(X,Y), given as a data, into a given finite element method (FEM) space of piecewise linear triangular elements.

fem2d_project_function_test

FEM2D_SAMPLE, a C++ code which evaluates a finite element function defined on an order 3 or order 6 triangulation.

HOT_PIPE, a MATLAB program which uses FEM_50_HEAT to solve the heat equation for a pipe model.

HOT_POINT, a MATLAB program which uses FEM_50_HEAT to solve the heat equation for a 2D region with a hot point.

TRIANGULATION_ORDER3, 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_ORDER3_CONTOUR, a MATLAB program which makes contour plot of data defined on an order 3 triangulation.

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:


Last revised on 05 March 2020.