FEM2D_PROJECT_FUNCTION is a FORTRAN90 program which projects a function W(X,Y), given as a formula, into a given finite element 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) dxwhile, 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.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
FEM2D_PROJECT_FUNCTION is available in a C++ version and a FORTRAN90 version and a MATLAB version.
FEM_50, a MATLAB program which implements a finite element calculation in just 50 lines of code.
FEM_50_HEAT, a MATLAB program which implements a finite element calculation specifically for the heat equation.
FEM_BASIS_T3_DISPLAY, a MATLAB program which displays a basis function associated with a linear triangle ("T3") mesh.
FEM_BASIS_T6_DISPLAY, a MATLAB program which displays a basis function associated with a quadratic triangle ("T6") mesh.
FEM_IO, a FORTRAN90 library which reads or writes the node, element and data files that define a finite element model.
FEM_TO_TEC, a FORTRAN90 program which can convert an FEM model into a TEC graphics file.
FEM2D, a data directory which contains examples of 2D FEM files, text files that describe a 2D finite element geometry and associated nodal values;
FEM2D_HEAT, a FORTRAN90 program which solves the time dependent heat equation in the unit square.
FEM2D_PACK, a FORTRAN90 library which contains utilities for 2D finite element calculations.
FEM2D_POISSON, a FORTRAN90 program which solves the 2D Poisson equation on a rectangle, using the finite element method, and piecewise quadratic triangular elements.
FEM2D_PROJECT, a FORTRAN90 program which projects a function F(X,Y), given as a data, into a given finite element space of piecewise linear triangular elements.
FEM2D_SAMPLE, a FORTRAN90 library which evaluates a finite element function defined on an order 3 or order 6 triangulation.
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.
You can go up one level to the FORTRAN90 source codes.